Commit 6014386
committed
ipc: userspace: fix IPC serialization with multiple cores
Fix a race in IPC serialization with multi-core. One sequence
observed:
- MOD_SET_DX IPC to power up core 1
- IPC reply to host
- CREATE_PIPELINE IPC (routed via core 0 to core 1)
- core 1 IPC thread starts, signals ipc_user->sem semaphore
- core 0 does NOT wait for thread as ipc_user->init_needed is set late
- ipc_user->sem signal for thread start is handled as
indication that IPC is handled (this is wrong)
- IPC reply to host (before CREATE_PIPELINE is handled)
- INIT_INSTANCE IPC (routed via core 0 to core 1)
- core 0 sees init_needed, but it is already signaled so execution
continues
-> DSP panic as IPC mailbox is modified while still in use
Additional complication is that there is no hard requirement for host
to send an IPC destinated to a particular core x, just after MOD_SET_DX
was sent to power up this specific core. This is the normal sequence,
but FW needs to at least gracefully handle alternative sequences.
Fix the serialization issue by moving IPC thread startup synchronization
to MOD_SET_DX handling. When a secondary core is booted up the first
time after last primary core boot, additional setup steps are done.
Reset "init_needed[]" after each primary core boot, and make MOD_SET_DX
synchronous when a new secondary core is booted up, not sending a response
back to host until the secondary core is booted up and the one-time
initialization is done. Note that after this, secondary cores may be powered
down and up many times, but the initialization (and related synchronization)
is no longer needed.
With these changes, there is no longer need to synchronize with secondary
core when forwarding IPC messages (in ipc_user_forward_cmd()). It is now
guaranteed the target core is running and set up correctly. If any failures
happen, these are reported already at MOD_SET_DX.
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>1 parent 22c33a6 commit 6014386
2 files changed
Lines changed: 24 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
446 | 446 | | |
447 | 447 | | |
448 | 448 | | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | 449 | | |
459 | 450 | | |
460 | 451 | | |
| |||
607 | 598 | | |
608 | 599 | | |
609 | 600 | | |
610 | | - | |
611 | | - | |
612 | | - | |
613 | 601 | | |
614 | 602 | | |
615 | 603 | | |
| |||
628 | 616 | | |
629 | 617 | | |
630 | 618 | | |
631 | | - | |
| 619 | + | |
632 | 620 | | |
633 | 621 | | |
634 | 622 | | |
| |||
637 | 625 | | |
638 | 626 | | |
639 | 627 | | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
640 | 633 | | |
641 | 634 | | |
642 | 635 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
331 | 348 | | |
332 | 349 | | |
333 | 350 | | |
| |||
385 | 402 | | |
386 | 403 | | |
387 | 404 | | |
| 405 | + | |
388 | 406 | | |
389 | 407 | | |
390 | 408 | | |
| |||
0 commit comments