-
Notifications
You must be signed in to change notification settings - Fork 349
[Do Not Review] Secondary core tearing down series #4718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Can one of the admins verify this patch? |
1f49a53 to
73fc2b1
Compare
7c7669a to
99c153e
Compare
4105535 to
5cea70f
Compare
src/schedule/ll_schedule.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change looks like a rename and only part of it is needed ?
src/include/sof/schedule/schedule.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we do this per core ? What's the flow ?
src/schedule/ll_schedule.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about EDF scheduler ?
src/drivers/intel/cavs/idc.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be renamed to reflect the use cases i.e. we have
- power down the core (with memories off i.e. S4)
- power down the core (with memories on i.e. S3)
The flows will also be very similar for both 1 & 2 and diverge at some point, so this could be
idc_core_power_down();which in turn would call a generic
core_power_down(int pm_flags);
src/include/sof/schedule/schedule.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@keyonjie we already call schedule_free() in cpu_power_down_core(). Is this really ncessary on tpo of that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ranj063 , yes, we already call schedule_free(), the problem is that neither the generic schedule_data struct nor the scheduler specific struct (e.g. edf_schedule_data and ll_schedule_data) is freed. Here the PR is for fixing the memory freeing. This will make sense in case of only the secondary cores are in loops of power off <--> on, e.g. dynamic pipelines run on a secondary core.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@keyonjie do you have an issue to show the behaviour? I have run secondary core power on/off (all 4 cores) loops for 10000 cycles without any issues. I added a debugfs entry in the kernel and wrote a script to test it. Have yyou done something similar and noticed issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@keyonjie do you have an issue to show the behaviour? I have run secondary core power on/off (all 4 cores) loops for 10000 cycles without any issues. I added a debugfs entry in the kernel and wrote a script to test it. Have yyou done something similar and noticed issues?
Thanks, @ranj063 I didn't run this kind of test, can you share your patch to test it? Your comment below about the "free_heap(SOF_MEM_ZONE_SYS)" explains why we are not seeing system memory leak.
I would still suggest this change as it is a graceful and symmetric way to tearing down each modules, it can make sure each allocated buffer is freed and writeback/invalidated, no matter it is located in system or some other zone in future, we should not rely on the powerful free_heap() and dcache_writeback_invalidate_all().
src/drivers/intel/cavs/idc.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here. idc_free() is also called from cpu_power_down_core()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same. the original idc_free() is lack of freeing of struct idc and its payload, they are allocated in generic src/idc/idc.c so add the freeing to there also, and the platform specific platform_idc_free() only do the register clearing and interrupt unregistering stuff.
|
@keyonjie I think the main problem is with the shutting down of the primary core. The secondary core power down sequence is actually quite rock solid. |
|
@keyonjie I'm still unsure about the need for this change. If this series is related to your changes in #4747 , you need to mention it. AFAICT, looking at free_heap(SOF_MEM_ZONE_SYS); in cpu_power_down_core(), frees the entire sys zone for the secondary cores. But if your change is needed because you are getting rid of the mem zones, then this change needs to be folded into the other PR where you do that and in a way that you don't break bisect. For ex: freeing the sys zone today will lead to a pnic. So you need to remove the panic first, free the zone and the add the changes in to remove the zone. It is very hard to review these patches otherwise |
d484277 to
5745c64
Compare
To power down a secondary core safely, we need to unregister and free the schedulers that run on the corresponding core cleanly, which will help to create clean one on the next powering up to the core. Move the scheduler data allocation to SYSTEM_RUNTIME zone, and free it at core powering down. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Add scheuler free support to align to multi-core cAVS platform implementation. We don't need explicit freeing in tb_pipeline_free() anymore. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
To power down a secondary core gracefully, we need to free the IDC related memory used on the corresponding core cleanly, which will help to create clean one on the next powering up to the core. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
To power down a secondary core gracefully, we need to free the notifier related memory used on the corresponding core cleanly, which will help to create clean one on the next powering up to the core. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
|
I can agree too that this is not needed and probably wrong. Currently we are not freeing such things because they are not designed to free: System Zone. Fixed size heap where alloc always succeeds and is never Thats why you have changed them to SYS_RUNTIME, but are they? We will not alloc idc again in runtime. So we will abuse mem zone design only to get something like free(1) free(2) and anyway free(all) |
|
@abonislawski @ranj063 thanks for review, looks this doesn't fix any secondary core power down/on issues although no side effect observed either. Let me put it away at the moment. |
|
closing this as it doesn't look needed. |
unregister/free schedulers, IDCs, for DSP core tearing down gracefully.