Commit 56da991
committed
schedule: zephyr_ll: grant LL thread access to per-task semaphores
In CONFIG_SOF_USERSPACE_LL builds the LL scheduler thread runs
unprivileged, so every Zephyr kernel object it accesses must be
explicitly granted to it.
In commit ffa52df ("schedule: ll: dynamically allocate the semaphore"),
task semaphores were converted to dynamically allocated objects.
Only the bootstrap task's semaphore was granted to the LL thread (in
zephyr_ll_init_context()); tasks created later (e.g. chain_dma) were
not, so pausing/stopping such a task while it was running crashed the
DSP.
Fix the issue by grant the LL scheduling thread access to the task's
semaphore at allocation time, from the syscall implementation which runs
in privileged context.
Add zephyr_domain_thread_tid_for_core() to look up the LL thread for an
explicit core without relying on cpu_get_id(), and without dereferencing
user-accessible task struct.
Fixes: ffa52df ("schedule: ll: dynamically allocate the semaphore")
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>1 parent b8d5999 commit 56da991
3 files changed
Lines changed: 47 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
| 331 | + | |
331 | 332 | | |
332 | 333 | | |
333 | 334 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
292 | 300 | | |
293 | 301 | | |
294 | 302 | | |
| |||
343 | 351 | | |
344 | 352 | | |
345 | 353 | | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
346 | 357 | | |
347 | 358 | | |
348 | 359 | | |
| |||
477 | 488 | | |
478 | 489 | | |
479 | 490 | | |
| 491 | + | |
480 | 492 | | |
481 | 493 | | |
482 | 494 | | |
| |||
498 | 510 | | |
499 | 511 | | |
500 | 512 | | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
501 | 528 | | |
502 | 529 | | |
503 | 530 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
477 | 496 | | |
478 | 497 | | |
479 | 498 | | |
| |||
0 commit comments