Skip to content

Commit c7ceef6

Browse files
Andy RossAnas Nashif
authored andcommitted
kernel_event_logger: Ignore events before subsystem init
Thread and interrupt events may well arrive before the subsystem initialization call has been made. Just swallow such events. In particular, an incoming change to the way _ready_thread works causes the main and idle thread initialization to throw thread ready events (which isn't wrong!), which the current setup can't handle. Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
1 parent 9d367ee commit c7ceef6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

subsys/logging/kernel_event_logger.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ u32_t _sys_k_event_logger_sleep_start_time;
3333
int _sys_k_event_logger_mask;
3434
#endif
3535

36+
static int initialized;
37+
3638
/**
3739
* @brief Initialize the kernel event logger system.
3840
*
@@ -47,6 +49,8 @@ static int _sys_k_event_logger_init(struct device *arg)
4749
sys_event_logger_init(&sys_k_event_logger, _sys_k_event_logger_buffer,
4850
CONFIG_KERNEL_EVENT_LOGGER_BUFFER_SIZE);
4951

52+
initialized = 1;
53+
5054
return 0;
5155
}
5256
SYS_INIT(_sys_k_event_logger_init,
@@ -143,6 +147,10 @@ void _sys_k_event_logger_interrupt(void)
143147
{
144148
u32_t data[2];
145149

150+
if (!initialized) {
151+
return;
152+
}
153+
146154
if (!sys_k_must_log_event(KERNEL_EVENT_LOGGER_INTERRUPT_EVENT_ID)) {
147155
return;
148156
}
@@ -205,6 +213,10 @@ static void log_thread_event(enum sys_k_event_logger_thread_event event,
205213
{
206214
u32_t data[3];
207215

216+
if (!initialized) {
217+
return;
218+
}
219+
208220
if (!sys_k_must_log_event(KERNEL_EVENT_LOGGER_THREAD_EVENT_ID)) {
209221
return;
210222
}

0 commit comments

Comments
 (0)