[patch V2 21/37] rseq: Make exit debugging static branch based

Thomas Gleixner posted 37 patches 1 month, 1 week ago
There is a newer version of this series
[patch V2 21/37] rseq: Make exit debugging static branch based
Posted by Thomas Gleixner 1 month, 1 week ago
Disconnect it from the config switch and use the static debug branch. This
is a temporary measure for validating the rework. At the end this check
needs to be hidden behind lockdep as it has nothing to do with the other
debug infrastructure, which mainly aids user space debugging by enabling a
zoo of checks which terminate misbehaving tasks instead of letting them
keep the hard to diagnose pieces.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 include/linux/rseq_entry.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/include/linux/rseq_entry.h
+++ b/include/linux/rseq_entry.h
@@ -275,7 +275,7 @@ static __always_inline void rseq_exit_to
 
 	rseq_stat_inc(rseq_stats.exit);
 
-	if (IS_ENABLED(CONFIG_DEBUG_RSEQ))
+	if (static_branch_unlikely(&rseq_debug_enabled))
 		WARN_ON_ONCE(ev->sched_switch);
 
 	/*
Re: [patch V2 21/37] rseq: Make exit debugging static branch based
Posted by Mathieu Desnoyers 1 month, 1 week ago
On 2025-08-23 12:39, Thomas Gleixner wrote:
> Disconnect it from the config switch and use the static debug branch. This
> is a temporary measure for validating the rework. At the end this check
> needs to be hidden behind lockdep as it has nothing to do with the other
> debug infrastructure, which mainly aids user space debugging by enabling a
> zoo of checks which terminate misbehaving tasks instead of letting them
> keep the hard to diagnose pieces.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

> ---
>   include/linux/rseq_entry.h |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/include/linux/rseq_entry.h
> +++ b/include/linux/rseq_entry.h
> @@ -275,7 +275,7 @@ static __always_inline void rseq_exit_to
>   
>   	rseq_stat_inc(rseq_stats.exit);
>   
> -	if (IS_ENABLED(CONFIG_DEBUG_RSEQ))
> +	if (static_branch_unlikely(&rseq_debug_enabled))
>   		WARN_ON_ONCE(ev->sched_switch);
>   
>   	/*
> 


-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com