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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 23 May 2019 15:58:39 +0100
From:   Will Deacon <will.deacon@....com>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     Waiman Long <longman@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Borislav Petkov <bp@...en8.de>,
        "H. Peter Anvin" <hpa@...or.com>,
        Linux List Kernel Mailing <linux-kernel@...r.kernel.org>,
        the arch/x86 maintainers <x86@...nel.org>,
        Davidlohr Bueso <dave@...olabs.net>,
        Tim Chen <tim.c.chen@...ux.intel.com>,
        huang ying <huang.ying.caritas@...il.com>
Subject: Re: [PATCH] locking/lock_events: Use this_cpu_add() when necessary

On Wed, May 22, 2019 at 12:54:13PM -0700, Linus Torvalds wrote:
> On Wed, May 22, 2019 at 8:40 AM Waiman Long <longman@...hat.com> wrote:
> >
> > +#if defined(CONFIG_PREEMPT) && \
> > +   (defined(CONFIG_DEBUG_PREEMPT) || !defined(CONFIG_X86))
> > +#define lockevent_percpu_inc(x)                this_cpu_inc(x)
> > +#define lockevent_percpu_add(x, v)     this_cpu_add(x, v)
> 
> Why that CONFIG_X86 special case?
> 
> On x86, the regular non-underscore versionm is perfectly fine, and the
> underscore is no faster or simpler.
> 
> So just make it be
> 
>    #if defined(CONFIG_PREEMPT)
>      .. non-underscore versions..
>    #else
>      .. underscore versions ..
>    #endif
> 
> and realize that x86 simply doesn't _care_. On x86, it will be one
> single instruction regardless.
> 
> Non-x86 may prefer the underscore versions for the non-preempt case.

To be honest, given this depends on LOCK_EVENT_COUNTS, I'd be inclined to
keep things simple and drop the underscore versions entirely. Saves having
to worry about things like "could I take an interrupt during the add?".

Will

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ