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, 19 Aug 2021 07:59:16 +0800
From:   Changbin Du <changbin.du@...il.com>
To:     Boqun Feng <boqun.feng@...il.com>
Cc:     Changbin Du <changbin.du@...il.com>,
        Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        "Paul E. McKenney" <paulmck@...nel.org>,
        Josh Triplett <josh@...htriplett.org>,
        Sergey Senozhatsky <senozhatsky@...omium.org>,
        linux-kernel@...r.kernel.org, rcu@...r.kernel.org
Subject: Re: [PATCH] preempt: add in_serving_irq() and apply to rcutiny and
 vsprintf

On Tue, Aug 17, 2021 at 12:03:16AM +0800, Boqun Feng wrote:
> On Sat, Aug 14, 2021 at 09:42:34AM +0800, Changbin Du wrote:
> > At some places we need to determine whether we're in nmi, hardirq or
> > softirq context. This adds a macro in_serving_irq() as a shortcut for
> > that.
> > 
> > Meanwhile, apply this new macro to existing code in rcutiny and vsprintf.
> > 
> > Signed-off-by: Changbin Du <changbin.du@...il.com>
> > ---
> >  include/linux/preempt.h | 4 +++-
> >  include/linux/rcutiny.h | 3 +--
> >  lib/vsprintf.c          | 2 +-
> >  3 files changed, 5 insertions(+), 4 deletions(-)
> > 
> > diff --git a/include/linux/preempt.h b/include/linux/preempt.h
> > index 9881eac0698f..9a1c924e2c6c 100644
> > --- a/include/linux/preempt.h
> > +++ b/include/linux/preempt.h
> > @@ -92,12 +92,14 @@
> >   * in_nmi()		- We're in NMI context
> >   * in_hardirq()		- We're in hard IRQ context
> >   * in_serving_softirq()	- We're in softirq context
> > + * in_serving_irq()	- We're in nmi, hardirq or softirq context
> >   * in_task()		- We're in task context
> >   */
> >  #define in_nmi()		(nmi_count())
> >  #define in_hardirq()		(hardirq_count())
> >  #define in_serving_softirq()	(softirq_count() & SOFTIRQ_OFFSET)
> > -#define in_task()		(!(in_nmi() | in_hardirq() | in_serving_softirq()))
> > +#define in_serving_irq()	(in_nmi() | in_hardirq() | in_serving_softirq())
> > +#define in_task()		(!in_serving_irq())
> >  
> 
> So in_serving_irq() is !in_task(), right? If so, why not...
> 
Adding in_serving_irq() is to reflect the real purpose so improve readability.
And can we preserve that !in_task() means in serving irq context in future? I don't know.

-- 
Cheers,
Changbin Du

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ