preempt: Add a generic function to return the preemption string.
Subsystems (11)
Sebastian Andrzej Siewior
maintainerv4 cover preempt: Add a generic function to return the preemption string.
The individual architectures often add the preemption model to the begin of the backtrace. This is the case on X86 or ARM64 for the "die" case but not for regular warning. With the addition of DYNAMIC_PREEMPT for PREEMPT_RT we end up with CONFIG_PREEMPT and CONFIG_PREEMPT_RT set simultaneously. That means that everyone who tried to add that piece of information gets it wrong for PREEMPT_RT because PREEMPT is checked first.
This series adds a generic helper which is used by dump_stack_print_info() and other architectures which don't use the function and provide this information on their own.
I collected ACKs for all architectures but x86.
v3…v4 https://lore.kernel.org/all/[email protected]/
- repost
v2…v3 https://lore.kernel.org/all/[email protected]/
- powerpc/ s390 and xtensa had the preemption string twice. Removed from the arch code.
- Keeping the same printk() invocation, avoiding adding any level.
- #1 has now a table showing which strings are possible.
RFC…v2 https://lore.kernel.org/all/[email protected]/
- Split into individual patches.
- Implement preempt_model_str() based on feedback by Peter Zijlstra and Steven Rostedt.
Sebastian Andrzej Siewior (9):
sched: Add a generic function to return the preemption string. lib/dump_stack: Use preempt_model_str().
arm: Rely on generic printing of preemption model.
arm64: Rely on generic printing of preemption model.
powerpc: Rely on generic printing of preemption model.
s390: Rely on generic printing of preemption model.
x86: Rely on generic printing of preemption model.
xtensa: Rely on generic printing of preemption model.
tracing: Use preempt_model_str().
arch/arm/kernel/traps.c | 11 ++------- arch/arm64/kernel/traps.c | 10 +------- arch/powerpc/kernel/traps.c | 3 +-- arch/s390/kernel/dumpstack.c | 7 +----- arch/x86/kernel/dumpstack.c | 9 ++----- arch/xtensa/kernel/traps.c | 6 +---- include/linux/preempt.h | 2 ++ kernel/sched/core.c | 47 ++++++++++++++++++++++++++++++++++++ kernel/sched/debug.c | 10 +++++--- kernel/sched/sched.h | 1 + kernel/trace/trace.c | 7 +----- lib/dump_stack.c | 4 +-- 12 files changed, 67 insertions(+), 50 deletions(-)
Signature · 1 line
2.47.2
Sebastian Andrzej Siewior
maintainerPATCH v4 1/9 sched: Add a generic function to return the preemption string.
The individual architectures often add the preemption model to the begin of the backtrace. This is the case on X86 or ARM64 for the "die" case but not for regular warning. With the addition of DYNAMIC_PREEMPT for PREEMPT_RT we end up with CONFIG_PREEMPT and CONFIG_PREEMPT_RT set simultaneously. That means that everyone who tried to add that piece of information gets it wrong for PREEMPT_RT because PREEMPT is checked first.
Provide a generic function which returns the current scheduling model considering LAZY preempt and the current state of PREEMPT_DYNAMIC.
The resulting strings are:
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┓
┃ Model ┃ -RT -DYN ┃ +RT -DYN ┃ -RT +DYN ┃ +RT +DYN ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━┩
│NONE │ NONE │ n/a │ PREEMPT(none) │ n/a │
├───────────┼──────────────┼───────────────────┼────────────────────┼───────────────────┤
│VOLUNTARY │ VOLUNTARY │ n/a │ PREEMPT(voluntary) │ n/a │
├───────────┼──────────────┼───────────────────┼────────────────────┼───────────────────┤
│FULL │ PREEMPT │ PREEMPT_RT │ PREEMPT(full) │ PREEMPT_{RT,full} │
├───────────┼──────────────┼───────────────────┼────────────────────┼───────────────────┤
│LAZY │ PREEMPT_LAZY │ PREEMPT_{RT,LAZY} │ PREEMPT(lazy) │ PREEMPT_{RT,lazy} │
└───────────┴──────────────┴───────────────────┴────────────────────┴───────────────────┘[ The dynamic building of the string can lead to an empty string if the
function is invoked simultaneously on two CPUs. ]
--- include/linux/preempt.h | 2 ++ kernel/sched/core.c | 47 +++++++++++++++++++++++++++++++++++++++++ kernel/sched/debug.c | 10 +++++---- kernel/sched/sched.h | 1 + 4 files changed, 56 insertions(+), 4 deletions(-)
include/linux/preempt.h +2 -0
@@ -515,6 +515,8 @@ static inline bool preempt_model_rt(void)return IS_ENABLED (CONFIG_PREEMPT_RT ); } +extern const char *preempt_model_str (void ); +/* * Does the preemption model allow non-cooperative preemption? *
kernel/sched/core.c +47 -0
57 lines not on this page · raw message
kernel/sched/debug.c +6 -4
@@ -244,11 +244,13 @@ static ssize_t sched_dynamic_write(struct file *filp, const char __user *ubuf,static int sched_dynamic_show (struct seq_file *m,void *v) { -static const char * preempt_modes[] = { -"none" ,"voluntary" ,"full" ,"lazy" , - }; -int j =ARRAY_SIZE (preempt_modes) - !IS_ENABLED (CONFIG_ARCH_HAS_PREEMPT_LAZY );int i =IS_ENABLED (CONFIG_PREEMPT_RT ) *2 ; +int j; + +/* Count entries in NULL terminated preempt_modes */ +for (j =0 ; preempt_modes[j]; j++) + ; + j -= !IS_ENABLED (CONFIG_ARCH_HAS_PREEMPT_LAZY );for (; i < j; i++) {if (preempt_dynamic_mode == i)
kernel/sched/sched.h +1 -0
@@ -3619,6 +3619,7 @@ extern int preempt_dynamic_mode;extern int sched_dynamic_mode (const char *str);extern void sched_dynamic_update (int mode);#endif +extern const char *preempt_modes[];#ifdef CONFIG_SCHED_MM_CID
Signature · 1 line
2.47.2
Re: [PATCH v4 1/9] sched: Add a generic function to return the preemption string.
kernel/sched/debug.c static ssize_t sched_dynamic_write(struct file *filp, const char __user *ubuf, · line 252
Quoted 7 lines · Sebastian Andrzej Siewior
kernel/sched/debug.c +6
-0+const char *preempt_modes[] = { +"none" ,"voluntary" ,"full" ,"lazy" ,NULL , +}; +/* Count entries in NULL terminated preempt_modes */ +for (j =0 ; preempt_modes[j]; j++) + ;
I'm pretty sure the build-time ARRAY_SIZE() primitive is superior here. ;-)
Thanks,
Ingo
Sebastian Andrzej Siewior
maintainerRe: [PATCH v4 1/9] sched: Add a generic function to return the preemption string.
Quoted 7 lines · Ingo Molnar
Quoted 3 lines · Sebastian Andrzej Siewior
kernel/sched/core.c +3
-0+const char *preempt_modes[] = { +"none" ,"voluntary" ,"full" ,"lazy" ,NULL , +};
Quoted 5 lines
kernel/sched/debug.c static ssize_t sched_dynamic_write(struct file *filp, const char __user *ubuf, · line 252
Quoted 3 lines
kernel/sched/debug.c +3
-0+/* Count entries in NULL terminated preempt_modes */ +for (j =0 ; preempt_modes[j]; j++) + ;I'm pretty sure the build-time
ARRAY_SIZE()primitive is superior here. ;-)
It would be but it is not an option.
That array is defined in core.c where it is "always" required while debug.c needs it optionally. core.c is its one compile unit while debug.c is included by build_utility.c. So I don't see how this can work unless we shift things:
| CC kernel/sched/build_utility.o | In file included from include/linux/kernel.h:16, | from include/linux/cpumask.h:11, | from include/linux/smp.h:13, | from include/linux/sched/clock.h:5, | from kernel/sched/build_utility.c:12: | kernel/sched/debug.c: In function ‘sched_dynamic_show’: | include/linux/array_size.h:11:32: error: invalid application of ‘sizeof’ to incomplete type ‘const char *[]’ | 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | | ^ | kernel/sched/debug.c:250:13: note: in expansion of macro ‘ARRAY_SIZE’ | 250 | j = ARRAY_SIZE(preempt_modes); | | ^~~~~~~~~~
Quoted 3 lines
Thanks,
Ingo
Sebastian
Re: [PATCH v4 1/9] sched: Add a generic function to return the preemption string.
Quoted 14 lines · Sebastian Andrzej Siewior
Quoted 7 lines · Ingo Molnar
Quoted 3 lines · Sebastian Andrzej Siewior
kernel/sched/core.c +3
-0+const char *preempt_modes[] = { +"none" ,"voluntary" ,"full" ,"lazy" ,NULL , +};Quoted 5 lines
kernel/sched/debug.c static ssize_t sched_dynamic_write(struct file *filp, const char __user *ubuf, · line 252
Quoted 3 lines
kernel/sched/debug.c +3
-0+/* Count entries in NULL terminated preempt_modes */ +for (j =0 ; preempt_modes[j]; j++) + ;I'm pretty sure the build-time
ARRAY_SIZE()primitive is superior here. ;-)
Quoted 5 lines
It would be but it is not an option.
That array is defined incore.cwhere it is "always" required whiledebug.cneeds it optionally.core.cis its one compile unit whiledebug.cis included bybuild_utility.c. So I don't see how this can work unless we shift things:
Why not have it all in debug.c?
Thanks,
Ingo
Sebastian Andrzej Siewior
maintainerRe: [PATCH v4 1/9] sched: Add a generic function to return the preemption string.
Quoted 17 lines · Ingo Molnar
Quoted 14 lines · Sebastian Andrzej Siewior
Quoted 12 lines · Ingo Molnar
kernel/sched/debug.c static ssize_t sched_dynamic_write(struct file *filp, const char __user *ubuf, · line 252
Quoted 7 lines · Sebastian Andrzej Siewior
kernel/sched/debug.c +6
-0+const char *preempt_modes[] = { +"none" ,"voluntary" ,"full" ,"lazy" ,NULL , +}; +/* Count entries in NULL terminated preempt_modes */ +for (j =0 ; preempt_modes[j]; j++) + ;I'm pretty sure the build-time
ARRAY_SIZE()primitive is superior here. ;-)
Quoted 7 lines
Quoted 5 lines
It would be but it is not an option.
That array is defined incore.cwhere it is "always" required whiledebug.cneeds it optionally.core.cis its one compile unit whiledebug.cis included bybuild_utility.c. So I don't see how this can work unless we shift things:Why not have it all in
debug.c?
The debug.c include is behind CONFIG_SCHED_DEBUG. This needs to be moved into debug.c itself so that code can be added regardless of CONFIG_SCHED_DEBUG. It is not only sched-debug after that.
Then we have `preempt_dynamic_mode' logic which is in core.c but it is exported and used in debug.c
So if all this is not a concern then I can move it.
Quoted 3 lines
Thanks,
Ingo
Sebastian
Re: [PATCH v4 1/9] sched: Add a generic function to return the preemption string.
Quoted 24 lines · Sebastian Andrzej Siewior
Quoted 23 lines · Ingo Molnar
Quoted 19 lines · Sebastian Andrzej Siewior
Quoted 7 lines · Ingo Molnar
Quoted 3 lines · Sebastian Andrzej Siewior
kernel/sched/core.c +3
-0+const char *preempt_modes[] = { +"none" ,"voluntary" ,"full" ,"lazy" ,NULL , +};Quoted 5 lines
kernel/sched/debug.c static ssize_t sched_dynamic_write(struct file *filp, const char __user *ubuf, · line 252
Quoted 3 lines
kernel/sched/debug.c +3
-0+/* Count entries in NULL terminated preempt_modes */ +for (j =0 ; preempt_modes[j]; j++) + ;I'm pretty sure the build-time
ARRAY_SIZE()primitive is superior here. ;-)It would be but it is not an option.
That array is defined incore.cwhere it is "always" required whiledebug.cneeds it optionally.core.cis its one compile unit whiledebug.cis included bybuild_utility.c. So I don't see how this can work unless we shift things:
Quoted 5 lines
Quoted 1 line
Why not have it all in
debug.c?The
debug.cinclude is behindCONFIG_SCHED_DEBUG. This needs to be moved intodebug.citself so that code can be added regardless ofCONFIG_SCHED_DEBUG. It is not only sched-debug after that.
Yeah, that's a valid concern.
The thing is, CONFIG_SCHED_DEBUG is mostly meaningless these days - all major distributions enable it because of the statistics are useful for system administration, tooling and general software development.
So we should enable it permanently and remove the #ifdeffery. I'll send out a series to do so soon.
Thanks,
Ingo
Sebastian Andrzej Siewior
maintainerRe: [PATCH v4 1/9] sched: Add a generic function to return the preemption string.
Quoted 8 lines · Ingo Molnar
Yeah, that's a valid concern.
The thing is,
CONFIG_SCHED_DEBUGis mostly meaningless these days - all major distributions enable it because of the statistics are useful for system administration, tooling and general software development.So we should enable it permanently and remove the #ifdeffery. I'll send out a series to do so soon.
If that is the way to go, the please Cc me and I rebase on top of it.
Quoted 3 lines
Thanks,
Ingo
Sebastian
Re: [PATCH v4 1/9] sched: Add a generic function to return the preemption string.
Quoted 11 lines · Sebastian Andrzej Siewior
Quoted 8 lines · Ingo Molnar
Yeah, that's a valid concern.
The thing is,
CONFIG_SCHED_DEBUGis mostly meaningless these days - all major distributions enable it because of the statistics are useful for system administration, tooling and general software development.So we should enable it permanently and remove the #ifdeffery. I'll send out a series to do so soon.
If that is the way to go, the please Cc me and I rebase on top of it.
Let's do it the other way around - your series is mature enough I think, and the merge window is close.
Thanks,
Ingo
Re: [PATCH v4 1/9] sched: Add a generic function to return the preemption string.
In reply to Ingo MolnarQuoted 33 lines · Ingo Molnar
Quoted 24 lines · Sebastian Andrzej Siewior
Quoted 23 lines · Ingo Molnar
Quoted 19 lines · Sebastian Andrzej Siewior
Quoted 7 lines · Ingo Molnar
Quoted 3 lines · Sebastian Andrzej Siewior
kernel/sched/core.c +3
-0+const char *preempt_modes[] = { +"none" ,"voluntary" ,"full" ,"lazy" ,NULL , +};Quoted 5 lines
kernel/sched/debug.c static ssize_t sched_dynamic_write(struct file *filp, const char __user *ubuf, · line 252
Quoted 3 lines
kernel/sched/debug.c +3
-0+/* Count entries in NULL terminated preempt_modes */ +for (j =0 ; preempt_modes[j]; j++) + ;I'm pretty sure the build-time
ARRAY_SIZE()primitive is superior here. ;-)It would be but it is not an option.
That array is defined incore.cwhere it is "always" required whiledebug.cneeds it optionally.core.cis its one compile unit whiledebug.cis included bybuild_utility.c. So I don't see how this can work unless we shift things:Quoted 5 lines
Quoted 1 line
Why not have it all in
debug.c?The
debug.cinclude is behindCONFIG_SCHED_DEBUG. This needs to be moved intodebug.citself so that code can be added regardless ofCONFIG_SCHED_DEBUG. It is not only sched-debug after that.
Quoted 8 lines
Yeah, that's a valid concern.
The thing is,
CONFIG_SCHED_DEBUGis mostly meaningless these days - all major distributions enable it because of the statistics are useful for system administration, tooling and general software development.So we should enable it permanently and remove the #ifdeffery. I'll send out a series to do so soon.
Here's the series:
https://lore.kernel.org/r/[email protected]
Ingo Molnar (5):
sched/debug: Change SCHED_WARN_ON() to WARN_ON_ONCE()
sched/debug: Make 'const_debug' tunables unconditional __read_mostly sched/debug: Make CONFIG_SCHED_DEBUG functionality unconditional sched/debug, Documentation: Remove (most) CONFIG_SCHED_DEBUG references from documentation sched/debug: Remove CONFIG_SCHED_DEBUG
Forgot to Cc: you - will do so in future versions.
Thanks,
Ingo
[tip: sched/core] sched: Add a generic function to return the preemption string
In reply to Sebastian Andrzej SiewiorThe following commit has been merged into the sched/core branch of tip:
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 8bdc5daaa01e3054647d394d354762210ad88f17 Gitweb: https://git.kernel.org/tip/8bdc5daaa01e3054647d394d354762210ad88f17 Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Fri, 14 Mar 2025 17:08:02 +01:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Mon, 17 Mar 2025 11:23:38 +01:00
sched: Add a generic function to return the preemption string
The individual architectures often add the preemption model to the begin of the backtrace. This is the case on X86 or ARM64 for the "die" case but not for regular warning. With the addition of DYNAMIC_PREEMPT for PREEMPT_RT we end up with CONFIG_PREEMPT and CONFIG_PREEMPT_RT set simultaneously. That means that everyone who tried to add that piece of information gets it wrong for PREEMPT_RT because PREEMPT is checked first.
Provide a generic function which returns the current scheduling model considering LAZY preempt and the current state of PREEMPT_DYNAMIC.
The resulting strings are:
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┓
┃ Model ┃ -RT -DYN ┃ +RT -DYN ┃ -RT +DYN ┃ +RT +DYN ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━┩
│NONE │ NONE │ n/a │ PREEMPT(none) │ n/a │
├───────────┼──────────────┼───────────────────┼────────────────────┼───────────────────┤
│VOLUNTARY │ VOLUNTARY │ n/a │ PREEMPT(voluntary) │ n/a │
├───────────┼──────────────┼───────────────────┼────────────────────┼───────────────────┤
│FULL │ PREEMPT │ PREEMPT_RT │ PREEMPT(full) │ PREEMPT_{RT,full} │
├───────────┼──────────────┼───────────────────┼────────────────────┼───────────────────┤
│LAZY │ PREEMPT_LAZY │ PREEMPT_{RT,LAZY} │ PREEMPT(lazy) │ PREEMPT_{RT,lazy} │
└───────────┴──────────────┴───────────────────┴────────────────────┴───────────────────┘[ The dynamic building of the string can lead to an empty string if the
function is invoked simultaneously on two CPUs. ]
--- include/linux/preempt.h | 2 ++- kernel/sched/core.c | 47 ++++++++++++++++++++++++++++++++++++++++- kernel/sched/debug.c | 10 +++++---- kernel/sched/sched.h | 1 +- 4 files changed, 56 insertions(+), 4 deletions(-)
include/linux/preempt.h +2 -0
@@ -515,6 +515,8 @@ static inline bool preempt_model_rt(void)return IS_ENABLED (CONFIG_PREEMPT_RT ); } +extern const char *preempt_model_str (void ); +/* * Does the preemption model allow non-cooperative preemption? *
kernel/sched/core.c +47 -0
57 lines not on this page · raw message
kernel/sched/debug.c +6 -4
@@ -244,11 +244,13 @@ static ssize_t sched_dynamic_write(struct file *filp, const char __user *ubuf,static int sched_dynamic_show (struct seq_file *m,void *v) { -static const char * preempt_modes[] = { -"none" ,"voluntary" ,"full" ,"lazy" , - }; -int j =ARRAY_SIZE (preempt_modes) - !IS_ENABLED (CONFIG_ARCH_HAS_PREEMPT_LAZY );int i =IS_ENABLED (CONFIG_PREEMPT_RT ) *2 ; +int j; + +/* Count entries in NULL terminated preempt_modes */ +for (j =0 ; preempt_modes[j]; j++) + ; + j -= !IS_ENABLED (CONFIG_ARCH_HAS_PREEMPT_LAZY );for (; i < j; i++) {if (preempt_dynamic_mode == i)
kernel/sched/sched.h +1 -0
@@ -3633,6 +3633,7 @@ extern int preempt_dynamic_mode;extern int sched_dynamic_mode (const char *str);extern void sched_dynamic_update (int mode);#endif +extern const char *preempt_modes[];#ifdef CONFIG_SCHED_MM_CID
Sebastian Andrzej Siewior
maintainerPATCH v4 2/9 lib/dump_stack: Use preempt_model_str().
In reply to Sebastian Andrzej SiewiorUse preempt_model_str() to print the current preemption model. Use pr_warn() instead of printk() to pass a loglevel. This makes it part of generic WARN/ BUG traces.
--- lib/dump_stack.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/dump_stack.c +2 -2
@@ -54,7 +54,7 @@ void __init dump_stack_set_arch_desc(const char *fmt, ...)*/ void dump_stack_print_info (const char *log_lvl) { - printk("%sCPU: %d UID: %u PID: %d Comm: %.20s %s%s %s %.*s" BUILD_ID_FMT "\n", + printk("%sCPU: %d UID: %u PID: %d Comm: %.20s %s%s %s %.*s %s " BUILD_ID_FMT "\n", log_lvl, raw_smp_processor_id(), __kuid_val(current_real_cred()->euid), current->pid, current->comm,
@@ -62,7 +62,7 @@ void dump_stack_print_info(const char *log_lvl)print_tainted (),init_utsname ()->release, (int )strcspn (init_utsname ()->version," " ), - init_utsname()->version, BUILD_ID_VAL); + init_utsname()->version, preempt_model_str(), BUILD_ID_VAL);if (get_taint ())printk ("%s%s\n" , log_lvl,print_tainted_verbose ());
Signature · 1 line
2.47.2
[tip: sched/core] lib/dump_stack: Use preempt_model_str()
The following commit has been merged into the sched/core branch of tip:
The following commit has been merged into the sched/core branch of tip:
Commit-ID: d167706f68ee22635a244bd414927f4202a3e942 Gitweb: https://git.kernel.org/tip/d167706f68ee22635a244bd414927f4202a3e942 Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Fri, 14 Mar 2025 17:08:03 +01:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Mon, 17 Mar 2025 11:23:39 +01:00
lib/dump_stack: Use preempt_model_str()
Use preempt_model_str() to print the current preemption model. Use pr_warn() instead of printk() to pass a loglevel. This makes it part of generic WARN/ BUG traces.
--- lib/dump_stack.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/dump_stack.c +2 -2
@@ -54,7 +54,7 @@ void __init dump_stack_set_arch_desc(const char *fmt, ...)*/ void dump_stack_print_info (const char *log_lvl) { - printk("%sCPU: %d UID: %u PID: %d Comm: %.20s %s%s %s %.*s" BUILD_ID_FMT "\n", + printk("%sCPU: %d UID: %u PID: %d Comm: %.20s %s%s %s %.*s %s " BUILD_ID_FMT "\n", log_lvl, raw_smp_processor_id(), __kuid_val(current_real_cred()->euid), current->pid, current->comm,
@@ -62,7 +62,7 @@ void dump_stack_print_info(const char *log_lvl)print_tainted (),init_utsname ()->release, (int )strcspn (init_utsname ()->version," " ), - init_utsname()->version, BUILD_ID_VAL); + init_utsname()->version, preempt_model_str(), BUILD_ID_VAL);if (get_taint ())printk ("%s%s\n" , log_lvl,print_tainted_verbose ());
Sebastian Andrzej Siewior
maintainerPATCH v4 3/9 arm: Rely on generic printing of preemption model.
In reply to Sebastian Andrzej Siewior__die() invokes later __show_regs() -> show_regs_print_info() which prints the current preemption model.
Remove it from the initial line.
--- arch/arm/kernel/traps.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
arch/arm/kernel/traps.c +2 -9
@@ -258,13 +258,6 @@ void show_stack(struct task_struct *tsk, unsigned long *sp, const char *loglvl)barrier (); } -#ifdef CONFIG_PREEMPT -#define S_PREEMPT " PREEMPT" -#elif defined(CONFIG_PREEMPT_RT ) -#define S_PREEMPT " PREEMPT_RT" -#else -#define S_PREEMPT "" -#endif #ifdef CONFIG_SMP #define S_SMP " SMP"#else
@@ -282,8 +275,8 @@ static int __die(const char *str, int err, struct pt_regs *regs)static int die_counter;int ret; -pr_emerg ("Internal error: %s: %x [#%d]" S_PREEMPT S_SMP S_ISA "\n" , - str, err, ++die_counter); +pr_emerg ("Internal error: %s: %x [#%d]" S_SMP S_ISA "\n" , + str, err, ++die_counter);/* trap and error numbers are mostly meaningless on ARM */ ret =notify_die (DIE_OOPS , str, regs, err, tsk->thread.trap_no,SIGSEGV );
Signature · 1 line
2.47.2
[tip: sched/core] arm: Rely on generic printing of preemption model
The following commit has been merged into the sched/core branch of tip:
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 03288138baa522d143a208c2b7ab2931f26ef07f Gitweb: https://git.kernel.org/tip/03288138baa522d143a208c2b7ab2931f26ef07f Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Fri, 14 Mar 2025 17:08:04 +01:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Mon, 17 Mar 2025 11:23:39 +01:00
arm: Rely on generic printing of preemption model
__die() invokes later __show_regs() -> show_regs_print_info() which prints the current preemption model.
Remove it from the initial line.
--- arch/arm/kernel/traps.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
arch/arm/kernel/traps.c +2 -9
@@ -258,13 +258,6 @@ void show_stack(struct task_struct *tsk, unsigned long *sp, const char *loglvl)barrier (); } -#ifdef CONFIG_PREEMPT -#define S_PREEMPT " PREEMPT" -#elif defined(CONFIG_PREEMPT_RT ) -#define S_PREEMPT " PREEMPT_RT" -#else -#define S_PREEMPT "" -#endif #ifdef CONFIG_SMP #define S_SMP " SMP"#else
@@ -282,8 +275,8 @@ static int __die(const char *str, int err, struct pt_regs *regs)static int die_counter;int ret; -pr_emerg ("Internal error: %s: %x [#%d]" S_PREEMPT S_SMP S_ISA "\n" , - str, err, ++die_counter); +pr_emerg ("Internal error: %s: %x [#%d]" S_SMP S_ISA "\n" , + str, err, ++die_counter);/* trap and error numbers are mostly meaningless on ARM */ ret =notify_die (DIE_OOPS , str, regs, err, tsk->thread.trap_no,SIGSEGV );
Sebastian Andrzej Siewior
maintainerPATCH v4 4/9 arm64: Rely on generic printing of preemption model.
In reply to Sebastian Andrzej Siewior__die() invokes later show_regs() -> show_regs_print_info() which prints the current preemption model.
Remove it from the initial line.
--- arch/arm64/kernel/traps.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
arch/arm64/kernel/traps.c +1 -9
@@ -172,14 +172,6 @@ static void dump_kernel_instr(const char *lvl, struct pt_regs *regs)printk ("%sCode: %s\n" , lvl, str); } -#ifdef CONFIG_PREEMPT -#define S_PREEMPT " PREEMPT" -#elif defined(CONFIG_PREEMPT_RT ) -#define S_PREEMPT " PREEMPT_RT" -#else -#define S_PREEMPT "" -#endif -#define S_SMP " SMP"static int __die (const char *str,long err,struct pt_regs *regs)
@@ -187,7 +179,7 @@ static int __die(const char *str, long err, struct pt_regs *regs)static int die_counter;int ret; -pr_emerg ("Internal error: %s: %016lx [#%d]" S_PREEMPT S_SMP "\n" , +pr_emerg ("Internal error: %s: %016lx [#%d] " S_SMP "\n" , str, err, ++die_counter);/* trap and error numbers are mostly meaningless on ARM */
Signature · 1 line
2.47.2
[tip: sched/core] arm64: Rely on generic printing of preemption model
The following commit has been merged into the sched/core branch of tip:
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 4769437de0e2dd9d2660499a72d5e58b7072b786 Gitweb: https://git.kernel.org/tip/4769437de0e2dd9d2660499a72d5e58b7072b786 Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Fri, 14 Mar 2025 17:08:05 +01:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Mon, 17 Mar 2025 11:23:39 +01:00
arm64: Rely on generic printing of preemption model
__die() invokes later show_regs() -> show_regs_print_info() which prints the current preemption model.
Remove it from the initial line.
--- arch/arm64/kernel/traps.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
arch/arm64/kernel/traps.c +1 -9
@@ -172,14 +172,6 @@ static void dump_kernel_instr(const char *lvl, struct pt_regs *regs)printk ("%sCode: %s\n" , lvl, str); } -#ifdef CONFIG_PREEMPT -#define S_PREEMPT " PREEMPT" -#elif defined(CONFIG_PREEMPT_RT ) -#define S_PREEMPT " PREEMPT_RT" -#else -#define S_PREEMPT "" -#endif -#define S_SMP " SMP"static int __die (const char *str,long err,struct pt_regs *regs)
@@ -187,7 +179,7 @@ static int __die(const char *str, long err, struct pt_regs *regs)static int die_counter;int ret; -pr_emerg ("Internal error: %s: %016lx [#%d]" S_PREEMPT S_SMP "\n" , +pr_emerg ("Internal error: %s: %016lx [#%d] " S_SMP "\n" , str, err, ++die_counter);/* trap and error numbers are mostly meaningless on ARM */
Sebastian Andrzej Siewior
maintainerPATCH v4 5/9 powerpc: Rely on generic printing of preemption model.
In reply to Sebastian Andrzej SiewiorAfter the first printk in __die() there is show_regs() -> show_regs_print_info() which prints the current preemption model.
Remove the preempion model from the arch code.
--- arch/powerpc/kernel/traps.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/kernel/traps.c +1 -2
@@ -263,10 +263,9 @@ static int __die(const char *str, struct pt_regs *regs, long err) {printk ("Oops: %s, sig: %ld [#%d]\n" , str, err, ++die_counter); - printk("%s PAGE_SIZE=%luK%s%s%s%s%s%s %s\n", + printk("%s PAGE_SIZE=%luK%s %s%s%s%s %s\n", IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN) ? "LE" : "BE", PAGE_SIZE / 1024, get_mmu_str(), - IS_ENABLED(CONFIG_PREEMPT) ? " PREEMPT" : "", IS_ENABLED(CONFIG_SMP) ? " SMP" : "", IS_ENABLED(CONFIG_SMP) ? (" NR_CPUS=" __stringify(NR_CPUS)) : "", debug_pagealloc_enabled() ? " DEBUG_PAGEALLOC" : "",
Signature · 1 line
2.47.2
[tip: sched/core] powerpc: Rely on generic printing of preemption model
The following commit has been merged into the sched/core branch of tip:
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 732ed149f7ac6278e33ccd62d13c604a134e6933 Gitweb: https://git.kernel.org/tip/732ed149f7ac6278e33ccd62d13c604a134e6933 Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Fri, 14 Mar 2025 17:08:06 +01:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Mon, 17 Mar 2025 11:23:39 +01:00
powerpc: Rely on generic printing of preemption model
After the first printk in __die() there is show_regs() -> show_regs_print_info() which prints the current preemption model.
Remove the preempion model from the arch code.
--- arch/powerpc/kernel/traps.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/kernel/traps.c +1 -2
@@ -263,10 +263,9 @@ static int __die(const char *str, struct pt_regs *regs, long err) {printk ("Oops: %s, sig: %ld [#%d]\n" , str, err, ++die_counter); - printk("%s PAGE_SIZE=%luK%s%s%s%s%s%s %s\n", + printk("%s PAGE_SIZE=%luK%s %s%s%s%s %s\n", IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN) ? "LE" : "BE", PAGE_SIZE / 1024, get_mmu_str(), - IS_ENABLED(CONFIG_PREEMPT) ? " PREEMPT" : "", IS_ENABLED(CONFIG_SMP) ? " SMP" : "", IS_ENABLED(CONFIG_SMP) ? (" NR_CPUS=" __stringify(NR_CPUS)) : "", debug_pagealloc_enabled() ? " DEBUG_PAGEALLOC" : "",
Sebastian Andrzej Siewior
maintainerPATCH v4 6/9 s390: Rely on generic printing of preemption model.
In reply to Sebastian Andrzej Siewiordie() invokes later show_regs() -> show_regs_print_info() which prints the current preemption model.
Remove it from the initial line.
--- arch/s390/kernel/dumpstack.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
arch/s390/kernel/dumpstack.c +1 -6
@@ -198,13 +198,8 @@ void __noreturn die(struct pt_regs *regs, const char *str)console_verbose ();spin_lock_irq (&die_lock);bust_spinlocks (1 ); -printk ("%s: %04x ilc:%d [#%d] " , str, regs->int_code &0xffff , +printk ("%s: %04x ilc:%d [#%d]" , str, regs->int_code &0xffff , regs->int_code >>17 , ++die_counter); -#ifdef CONFIG_PREEMPT -pr_cont ("PREEMPT " ); -#elif defined(CONFIG_PREEMPT_RT ) -pr_cont ("PREEMPT_RT " ); -#endif pr_cont ("SMP " );if (debug_pagealloc_enabled ())pr_cont ("DEBUG_PAGEALLOC" );
Signature · 1 line
2.47.2
[tip: sched/core] s390: Rely on generic printing of preemption model
The following commit has been merged into the sched/core branch of tip:
The following commit has been merged into the sched/core branch of tip:
Commit-ID: b70f50be0c74bd9498fba9d33cc548722a2ec879 Gitweb: https://git.kernel.org/tip/b70f50be0c74bd9498fba9d33cc548722a2ec879 Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Fri, 14 Mar 2025 17:08:07 +01:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Mon, 17 Mar 2025 11:23:40 +01:00
s390: Rely on generic printing of preemption model
die() invokes later show_regs() -> show_regs_print_info() which prints the current preemption model.
Remove it from the initial line.
--- arch/s390/kernel/dumpstack.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
arch/s390/kernel/dumpstack.c +1 -6
@@ -198,13 +198,8 @@ void __noreturn die(struct pt_regs *regs, const char *str)console_verbose ();spin_lock_irq (&die_lock);bust_spinlocks (1 ); -printk ("%s: %04x ilc:%d [#%d] " , str, regs->int_code &0xffff , +printk ("%s: %04x ilc:%d [#%d]" , str, regs->int_code &0xffff , regs->int_code >>17 , ++die_counter); -#ifdef CONFIG_PREEMPT -pr_cont ("PREEMPT " ); -#elif defined(CONFIG_PREEMPT_RT ) -pr_cont ("PREEMPT_RT " ); -#endif pr_cont ("SMP " );if (debug_pagealloc_enabled ())pr_cont ("DEBUG_PAGEALLOC" );
Sebastian Andrzej Siewior
maintainerPATCH v4 7/9 x86: Rely on generic printing of preemption model.
In reply to Sebastian Andrzej SiewiorAfter __die_header(), __die_body() is always invoked. There we have show_regs() -> show_regs_print_info() which prints the current preemption model.
Remove it from the initial line.
--- arch/x86/kernel/dumpstack.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
arch/x86/kernel/dumpstack.c +2 -7
@@ -395,18 +395,13 @@ NOKPROBE_SYMBOL(oops_end);static void __die_header (const char *str,struct pt_regs *regs,long err) { -const char *pr ="" ; -/* Save the regs of the first oops for the executive summary later. */ if (!die_counter) exec_summary_regs = *regs; -if (IS_ENABLED (CONFIG_PREEMPTION )) - pr =IS_ENABLED (CONFIG_PREEMPT_RT ) ?" PREEMPT_RT" :" PREEMPT" ; - printk(KERN_DEFAULT - "Oops: %s: %04lx [#%d]%s%s%s%s%s\n", str, err & 0xffff, - ++die_counter, pr, + "Oops: %s: %04lx [#%d]%s%s%s%s\n", str, err & 0xffff, + ++die_counter, IS_ENABLED(CONFIG_SMP) ? " SMP" : "", debug_pagealloc_enabled() ? " DEBUG_PAGEALLOC" : "", IS_ENABLED(CONFIG_KASAN) ? " KASAN" : "",
Signature · 1 line
2.47.2
[tip: sched/core] x86: Rely on generic printing of preemption model
The following commit has been merged into the sched/core branch of tip:
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 96389cf365915b53a53ac88c48b620f7db2e1eff Gitweb: https://git.kernel.org/tip/96389cf365915b53a53ac88c48b620f7db2e1eff Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Fri, 14 Mar 2025 17:08:08 +01:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Mon, 17 Mar 2025 11:23:40 +01:00
x86: Rely on generic printing of preemption model
After __die_header(), __die_body() is always invoked. There we have show_regs() -> show_regs_print_info() which prints the current preemption model.
Remove it from the initial line.
--- arch/x86/kernel/dumpstack.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
arch/x86/kernel/dumpstack.c +2 -7
@@ -395,18 +395,13 @@ NOKPROBE_SYMBOL(oops_end);static void __die_header (const char *str,struct pt_regs *regs,long err) { -const char *pr ="" ; -/* Save the regs of the first oops for the executive summary later. */ if (!die_counter) exec_summary_regs = *regs; -if (IS_ENABLED (CONFIG_PREEMPTION )) - pr =IS_ENABLED (CONFIG_PREEMPT_RT ) ?" PREEMPT_RT" :" PREEMPT" ; - printk(KERN_DEFAULT - "Oops: %s: %04lx [#%d]%s%s%s%s%s\n", str, err & 0xffff, - ++die_counter, pr, + "Oops: %s: %04lx [#%d]%s%s%s%s\n", str, err & 0xffff, + ++die_counter, IS_ENABLED(CONFIG_SMP) ? " SMP" : "", debug_pagealloc_enabled() ? " DEBUG_PAGEALLOC" : "", IS_ENABLED(CONFIG_KASAN) ? " KASAN" : "",
Sebastian Andrzej Siewior
maintainerPATCH v4 8/9 xtensa: Rely on generic printing of preemption model.
In reply to Sebastian Andrzej Siewiordie() invokes later show_regs() -> show_regs_print_info() which prints the current preemption model.
Remove it from the initial line.
--- arch/xtensa/kernel/traps.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
arch/xtensa/kernel/traps.c +1 -5
@@ -629,15 +629,11 @@ DEFINE_SPINLOCK(die_lock);void __noreturn die (const char * str,struct pt_regs * regs,long err) {static int die_counter; -const char *pr ="" ; - -if (IS_ENABLED (CONFIG_PREEMPTION )) - pr =IS_ENABLED (CONFIG_PREEMPT_RT ) ?" PREEMPT_RT" :" PREEMPT" ;console_verbose ();spin_lock_irq (&die_lock); -pr_info ("%s: sig: %ld [#%d]%s\n" , str, err, ++die_counter, pr); +pr_info ("%s: sig: %ld [#%d]\n" , str, err, ++die_counter);show_regs (regs);if (!user_mode (regs))show_stack (NULL , (unsigned long *)regs->areg[1 ],KERN_INFO );
Signature · 1 line
2.47.2
[tip: sched/core] xtensa: Rely on generic printing of preemption model
The following commit has been merged into the sched/core branch of tip:
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 6966cd46f63205adc07ce4563ebbc3609e1c9fd7 Gitweb: https://git.kernel.org/tip/6966cd46f63205adc07ce4563ebbc3609e1c9fd7 Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Fri, 14 Mar 2025 17:08:09 +01:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Mon, 17 Mar 2025 11:23:40 +01:00
xtensa: Rely on generic printing of preemption model
die() invokes later show_regs() -> show_regs_print_info() which prints the current preemption model.
Remove it from the initial line.
--- arch/xtensa/kernel/traps.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
arch/xtensa/kernel/traps.c +1 -5
@@ -629,15 +629,11 @@ DEFINE_SPINLOCK(die_lock);void __noreturn die (const char * str,struct pt_regs * regs,long err) {static int die_counter; -const char *pr ="" ; - -if (IS_ENABLED (CONFIG_PREEMPTION )) - pr =IS_ENABLED (CONFIG_PREEMPT_RT ) ?" PREEMPT_RT" :" PREEMPT" ;console_verbose ();spin_lock_irq (&die_lock); -pr_info ("%s: sig: %ld [#%d]%s\n" , str, err, ++die_counter, pr); +pr_info ("%s: sig: %ld [#%d]\n" , str, err, ++die_counter);show_regs (regs);if (!user_mode (regs))show_stack (NULL , (unsigned long *)regs->areg[1 ],KERN_INFO );
Sebastian Andrzej Siewior
maintainerPATCH v4 9/9 tracing: Use preempt_model_str().
In reply to Sebastian Andrzej SiewiorUse preempt_model_str() instead of manually conducting the preemption model.
--- kernel/trace/trace.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
kernel/trace/trace.c +1 -6
@@ -4100,12 +4100,7 @@ print_trace_header(struct seq_file *m, struct trace_iterator *iter) entries, total, buf->cpu, -preempt_model_none () ?"server" : -preempt_model_voluntary () ?"desktop" : -preempt_model_full () ?"preempt" : -preempt_model_lazy () ?"lazy" : -preempt_model_rt () ?"preempt_rt" : -"unknown" , +preempt_model_str (),/* These are reserved for later use */ 0, 0, 0, 0);#ifdef CONFIG_SMP
Signature · 1 line
2.47.2
[tip: sched/core] tracing: Use preempt_model_str()
The following commit has been merged into the sched/core branch of tip:
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 3bffa47a02636ed4134d558caecd35e92051e48d Gitweb: https://git.kernel.org/tip/3bffa47a02636ed4134d558caecd35e92051e48d Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Fri, 14 Mar 2025 17:08:10 +01:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Mon, 17 Mar 2025 11:23:41 +01:00
tracing: Use preempt_model_str()
Use preempt_model_str() instead of manually conducting the preemption model.
--- kernel/trace/trace.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
kernel/trace/trace.c +1 -6
@@ -4100,12 +4100,7 @@ print_trace_header(struct seq_file *m, struct trace_iterator *iter) entries, total, buf->cpu, -preempt_model_none () ?"server" : -preempt_model_voluntary () ?"desktop" : -preempt_model_full () ?"preempt" : -preempt_model_lazy () ?"lazy" : -preempt_model_rt () ?"preempt_rt" : -"unknown" , +preempt_model_str (),/* These are reserved for later use */ 0, 0, 0, 0);#ifdef CONFIG_SMP
Quoted 10 lines · Sebastian Andrzej Siewior
Sebastian Andrzej Siewior (9):
sched: Add a generic function to return the preemption string.lib/dump_stack: Usepreempt_model_str().
arm: Rely on generic printing of preemption model.
arm64: Rely on generic printing of preemption model.
powerpc: Rely on generic printing of preemption model.
s390: Rely on generic printing of preemption model.
x86: Rely on generic printing of preemption model.
xtensa: Rely on generic printing of preemption model.
tracing: Usepreempt_model_str().
A meta request: please do not put periods into patch titles in this and future series...
Thanks,
Ingo
Sebastian Andrzej Siewior
maintainerQuoted 14 lines · Ingo Molnar
Quoted 10 lines · Sebastian Andrzej Siewior
Sebastian Andrzej Siewior (9):
sched: Add a generic function to return the preemption string.lib/dump_stack: Usepreempt_model_str().
arm: Rely on generic printing of preemption model.
arm64: Rely on generic printing of preemption model.
powerpc: Rely on generic printing of preemption model.
s390: Rely on generic printing of preemption model.
x86: Rely on generic printing of preemption model.
xtensa: Rely on generic printing of preemption model.
tracing: Usepreempt_model_str().
Quoted 2 lines
A meta request: please do not put periods into patch titles in this and future series...
No full stop at the end of the sentence then? I've been asked once to do so.
Quoted 3 lines
Thanks,
Ingo
Sebastian