Commit 15f94f6
ipc4: logging: prevent re-initialization on multiple enable calls
Multiple IPC4_ENABLE_LOGS commands can cause FW crashes due to
re-initialization of already active resources. This occurs when:
- Backend is auto-started at boot and test sends enable command
- Test sends multiple enable commands for reconfiguration
- Enable is called without checking current state
Changes:
- Use K_MUTEX_DEFINE() for static mutex initialization instead of
runtime k_mutex_init() to prevent re-initialization
- Check work queue handler before initializing with
k_work_init_delayable() to avoid re-initializing active work queue
- Check log_backend_is_active() before calling log_backend_enable() to
handle auto-started backend case
- Check work queue handler before flushing and clear it after flush
- Check backend active state before calling log_backend_disable()
This makes the enable/disable operations idempotent and safe to call
multiple times, allowing future support for runtime reconfiguration of
logging parameters (aging timer, log level, etc.) while preventing
crashes from resource re-initialization.
Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>1 parent 87ff3ba commit 15f94f6
1 file changed
Lines changed: 16 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
144 | 147 | | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
149 | 151 | | |
150 | 152 | | |
151 | 153 | | |
| |||
157 | 159 | | |
158 | 160 | | |
159 | 161 | | |
160 | | - | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
161 | 168 | | |
162 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
163 | 172 | | |
164 | 173 | | |
165 | 174 | | |
| |||
0 commit comments