* [PATCH] preempt: Allow CONFIG_DEBUG_PREEMPT for CONFIG_PREEMPT_VOLUNTARY
@ 2021-07-07 19:23 Valentin Schneider
2021-07-08 11:37 ` Frederic Weisbecker
0 siblings, 1 reply; 2+ messages in thread
From: Valentin Schneider @ 2021-07-07 19:23 UTC (permalink / raw)
To: linux-kernel
Cc: Frederic Weisbecker, Peter Zijlstra, Ingo Molnar, Thomas Gleixner
While recently staring at some preempt_count dumpster fire for a
CONFIG_PREEMPT_VOLUNTARY kernel, I wished I could turn on
CONFIG_DEBUG_PREEMPT on top of CONFIG_DEBUG_ATOMIC_SLEEP to see *where*
preemption had been disabled. It didn't take much to get that, and although
it didn't help my particular case, I think it can still be useful.
Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
---
kernel/sched/core.c | 3 +--
lib/Kconfig.debug | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 0c22cd026440..5673b85fa22d 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5109,8 +5109,7 @@ static inline void sched_tick_start(int cpu) { }
static inline void sched_tick_stop(int cpu) { }
#endif
-#if defined(CONFIG_PREEMPTION) && (defined(CONFIG_DEBUG_PREEMPT) || \
- defined(CONFIG_TRACE_PREEMPT_TOGGLE))
+#if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_TRACE_PREEMPT_TOGGLE)
/*
* If the value passed in is equal to the current preempt count
* then we just disabled preemption. Start timing the latency.
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 678c13967580..7fdd45eee343 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1204,7 +1204,7 @@ config DEBUG_TIMEKEEPING
config DEBUG_PREEMPT
bool "Debug preemptible kernel"
- depends on DEBUG_KERNEL && PREEMPTION && TRACE_IRQFLAGS_SUPPORT
+ depends on DEBUG_KERNEL && PREEMPT_COUNT && TRACE_IRQFLAGS_SUPPORT
default y
help
If you say Y here then the kernel will use a debug variant of the
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] preempt: Allow CONFIG_DEBUG_PREEMPT for CONFIG_PREEMPT_VOLUNTARY
2021-07-07 19:23 [PATCH] preempt: Allow CONFIG_DEBUG_PREEMPT for CONFIG_PREEMPT_VOLUNTARY Valentin Schneider
@ 2021-07-08 11:37 ` Frederic Weisbecker
0 siblings, 0 replies; 2+ messages in thread
From: Frederic Weisbecker @ 2021-07-08 11:37 UTC (permalink / raw)
To: Valentin Schneider
Cc: linux-kernel, Peter Zijlstra, Ingo Molnar, Thomas Gleixner
On Wed, Jul 07, 2021 at 08:23:06PM +0100, Valentin Schneider wrote:
> While recently staring at some preempt_count dumpster fire for a
> CONFIG_PREEMPT_VOLUNTARY kernel, I wished I could turn on
> CONFIG_DEBUG_PREEMPT on top of CONFIG_DEBUG_ATOMIC_SLEEP to see *where*
> preemption had been disabled. It didn't take much to get that, and although
> it didn't help my particular case, I think it can still be useful.
>
> Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
> ---
> kernel/sched/core.c | 3 +--
> lib/Kconfig.debug | 2 +-
> 2 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 0c22cd026440..5673b85fa22d 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -5109,8 +5109,7 @@ static inline void sched_tick_start(int cpu) { }
> static inline void sched_tick_stop(int cpu) { }
> #endif
>
> -#if defined(CONFIG_PREEMPTION) && (defined(CONFIG_DEBUG_PREEMPT) || \
> - defined(CONFIG_TRACE_PREEMPT_TOGGLE))
> +#if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_TRACE_PREEMPT_TOGGLE)
> /*
> * If the value passed in is equal to the current preempt count
> * then we just disabled preemption. Start timing the latency.
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index 678c13967580..7fdd45eee343 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -1204,7 +1204,7 @@ config DEBUG_TIMEKEEPING
>
> config DEBUG_PREEMPT
> bool "Debug preemptible kernel"
> - depends on DEBUG_KERNEL && PREEMPTION && TRACE_IRQFLAGS_SUPPORT
> + depends on DEBUG_KERNEL && PREEMPT_COUNT && TRACE_IRQFLAGS_SUPPORT
IIRC it used to be that way before. That was the reason for the split
of CONFIG_PREEMPT_COUNT from CONFIG_PREEMPT in the first place. Not
sure what happened. But anyway, your patch looks welcome.
Thanks.
> default y
> help
> If you say Y here then the kernel will use a debug variant of the
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-08 11:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07 19:23 [PATCH] preempt: Allow CONFIG_DEBUG_PREEMPT for CONFIG_PREEMPT_VOLUNTARY Valentin Schneider
2021-07-08 11:37 ` Frederic Weisbecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).