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:   Tue, 23 Apr 2019 09:27:40 -0700
From:   Linus Torvalds <torvalds@...ux-foundation.org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Waiman Long <llong@...hat.com>, Waiman Long <longman@...hat.com>,
        Ingo Molnar <mingo@...hat.com>,
        Will Deacon <will.deacon@....com>,
        Thomas Gleixner <tglx@...utronix.de>,
        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 v4 14/16] locking/rwsem: Guard against making count negative

On Tue, Apr 23, 2019 at 7:17 AM Peter Zijlstra <peterz@...radead.org> wrote:
>
> I'm not aware of an architecture where disabling interrupts is faster
> than disabling preemption.

I don't thin kit ever is, but I'd worry a bit about the
preempt_enable() just because it also checks if need_resched() is true
when re-enabling preemption.

So doing preempt_enable() as part of rwsem_read_trylock() might cause
us to schedule in *exactly* the wrong place,

So if we play preemption games, I wonder if we should make them more
explicit than hiding them in that helper function, because
particularly for the slow path case, I think we'd be much better off
just avoiding the busy-loop in the slow path, rather than first
scheduling due to preempt_enable(), and then starting to look at the
slow path onlly afterwards.

IOW, I get the feeling that the preemption-off area might be better
off being potentially much bigger, and covering the whole (or a large
portion) of the semaphore operation, rather than just the
rwsem_read_trylock() fastpath.

Hmm?

                   Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ