Skip to content

Commit 60810cd

Browse files
lyakhlgirdwood
authored andcommitted
dp: application: check left-over partitions
Before dropping the DP thread memory domain, check if any partitions are left still attached to it. If so, warn and remove them. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent 6649dcd commit 60810cd

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/schedule/zephyr_dp_schedule_application.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,23 @@ static void scheduler_dp_domain_free(struct task_dp_pdata *pdata)
369369
k_mem_domain_remove_partition(mdom, pdata->mpart + SOF_DP_PART_CFG);
370370
k_mem_domain_remove_partition(mdom, pdata->mpart + SOF_DP_PART_CFG_CACHE);
371371

372+
if (mdom->num_partitions) {
373+
/* Violation: all partitions should be freed by now */
374+
unsigned int n = mdom->num_partitions;
375+
376+
LOG_WRN("%u domain partition(s) not freed, force-freeing them all", n);
377+
378+
for (unsigned int i = 0; i < arch_mem_domain_max_partitions_get() && n; i++) {
379+
struct k_mem_partition *dpart = &mdom->partitions[i];
380+
381+
if (dpart->size) {
382+
k_mem_domain_remove_partition(mdom, dpart);
383+
n--;
384+
}
385+
}
386+
}
387+
388+
/* All partitions removed, the domain can be freed now */
372389
pmod->mdom = NULL;
373390
objpool_free(&dp_mdom_head, mdom);
374391
}

0 commit comments

Comments
 (0)