lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 21 Nov 2013 11:17:19 +0100
From:	Peter Zijlstra <peterz@...radead.org>
To:	Frederic Weisbecker <fweisbec@...il.com>
Cc:	Ingo Molnar <mingo@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] lockdep: Simplify a bit hardirq <-> softirq transitions

On Wed, Nov 20, 2013 at 01:07:34AM +0100, Frederic Weisbecker wrote:
> Instead of saving the hardirq state on a per CPU variable, which require
> an explicit call before the softirq handling and some complication,
> just save and restore the hardirq tracing state through functions
> return values and parameters.
> 
> It simplifies a bit the black magic that works around the fact that
> softirqs can be called from hardirqs while hardirqs can nest on softirqs
> but those two cases have very different semantics and only the latter
> case assume both states.
> 
> Signed-off-by: Frederic Weisbecker <fweisbec@...il.com>
> Cc: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Ingo Molnar <mingo@...nel.org>
> Cc: Linus Torvalds <torvalds@...ux-foundation.org>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> ---
>  kernel/softirq.c | 37 ++++++++++++++++---------------------
>  1 file changed, 16 insertions(+), 21 deletions(-)
> 
> diff --git a/kernel/softirq.c b/kernel/softirq.c
> index eb0acf4..dc43ee8 100644
> --- a/kernel/softirq.c
> +++ b/kernel/softirq.c
> @@ -215,40 +215,35 @@ EXPORT_SYMBOL(local_bh_enable_ip);
>  
>  #ifdef CONFIG_TRACE_IRQFLAGS
>  /*
>   * When we run softirqs from irq_exit() and thus on the hardirq stack we need
>   * to keep the lockdep irq context tracking as tight as possible in order to
>   * not miss-qualify lock contexts and miss possible deadlocks.
>   */
>  
> +static inline bool lockdep_softirq_start(void)
>  {
> +	bool in_hardirq = false;
>  
> +	if (trace_hardirq_context(current)) {
> +		in_hardirq = true;
>  		trace_hardirq_exit();
> +	}
> +
>  	lockdep_softirq_enter();
> +
> +	return in_hardirq;
>  }
>  
> +static inline void lockdep_softirq_end(bool in_hardirq)
>  {
>  	lockdep_softirq_exit();
> +
> +	if (in_hardirq)
>  		trace_hardirq_enter();
>  }

Yeah, I suppose that works. Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ