-
Notifications
You must be signed in to change notification settings - Fork 592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kernel/sched: fix logging after stack overflow #6622
Conversation
2991b9b
to
110ebbf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed logging after stack overflow in kernel sched, this change is good to merge.
if (*(uint32_t *)(rtcb->stack_base_ptr) != STACK_COLOR) { | ||
dbg_noarg("############### STACK OVERFLOW at pid %d ", rtcb->pid); | ||
lldbg_noarg("\n############### STACK OVERFLOW at pid %d ", rtcb->pid); | ||
#if CONFIG_TASK_NAME_SIZE > 0 | ||
dbg_noarg("(%s) ", rtcb->name); | ||
lldbg_noarg("(%s) ", rtcb->name); | ||
#endif | ||
dbg_noarg("###################\n"); | ||
lldbg_noarg("###################\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could cause log mix.
Because we will call the PANIC after this message, how about adding enter_critical_section?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the same codes are at 4 different locations. How about making a new api for that?
1c57080
to
be7f3e9
Compare
@@ -88,6 +88,33 @@ | |||
* Public Functions | |||
****************************************************************************/ | |||
|
|||
/**************************************************************************** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry but let's add this with new file, not here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
f6ba762
to
b72722c
Compare
/**************************************************************************** | ||
* kernel/sched/sched_checkstackoverflow.c | ||
* | ||
* Redistribution and use in source and binary forms, with or without |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add this license. Let's remove.
os/kernel/sched/Make.defs
Outdated
@@ -60,7 +60,7 @@ CSRCS += sched_setscheduler.c sched_getscheduler.c | |||
CSRCS += sched_yield.c sched_rrgetinterval.c sched_foreach.c | |||
CSRCS += sched_lock.c sched_unlock.c sched_lockcount.c sched_self.c | |||
CSRCS += sched_getaffinity.c sched_setaffinity.c | |||
CSRCS += sched_getcpu.c | |||
CSRCS += sched_getcpu.c sched_checkstackoverflow.c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function is called with CONFIG_SW_STACK_OVERFLOW_DETECTION.
It means this file is valid with the config. Let's add conditional for this.
Or, remove the conditional at all c file, and in header, let's do like below
#ifdef CONFIG_XXX
void sched_checkstackoverflow(FAR struct tcb_s *rtcb);
#else
#define sched_checkstackoverflow(x)
#endif
b72722c
to
89b1e5a
Compare
- This commit changes logging method from dbg to lldbg to print stack overflow information. This is done because after stack overflow, using dbg does not work because of more stack memory requirement. But in the lldbg case, it uses low level syslog, so it uses minimal stack memory.
89b1e5a
to
aaca92a
Compare
This commit changes logging method from dbg to lldbg to print stack overflow information. This is done because after stack overflow, using dbg does not work because of more stack memory requirement. But in the lldbg case, it uses low level syslog, so it uses minimal stack memory.
logs before:
logs after changing to lldbg: