Skip to content

Commit

Permalink
note: handle tcb is empty, so that it can also record before the driv…
Browse files Browse the repository at this point in the history
…er initialization

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
  • Loading branch information
Gary-Hobson committed Feb 23, 2023
1 parent 7a4bd09 commit ce92c97
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions drivers/note/note_driver.c
Expand Up @@ -235,11 +235,23 @@ static void note_common(FAR struct tcb_s *tcb,

note->nc_length = length;
note->nc_type = type;
note->nc_priority = tcb->sched_priority;

if (tcb == NULL)
{
note->nc_priority = CONFIG_INIT_PRIORITY;
#ifdef CONFIG_SMP
note->nc_cpu = 0;
#endif
memset(note->nc_pid, 0, sizeof(tcb->pid));
}
else
{
note->nc_priority = tcb->sched_priority;
#ifdef CONFIG_SMP
note->nc_cpu = tcb->cpu;
note->nc_cpu = tcb->cpu;
#endif
sched_note_flatten(note->nc_pid, &tcb->pid, sizeof(tcb->pid));
sched_note_flatten(note->nc_pid, &tcb->pid, sizeof(tcb->pid));
}

#ifdef CONFIG_SCHED_INSTRUMENTATION_HIRES
sched_note_flatten(note->nc_systime_nsec, &ts.tv_nsec, sizeof(ts.tv_nsec));
Expand Down

0 comments on commit ce92c97

Please sign in to comment.