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]
Message-ID: <20210910163704.ykotcrvbt6yaqron@linutronix.de>
Date:   Fri, 10 Sep 2021 18:37:04 +0200
From:   Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
        Will Deacon <will@...nel.org>,
        Waiman Long <longman@...hat.com>,
        Boqun Feng <boqun.feng@...il.com>,
        Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH] locking: Remove rt_rwlock_is_contended()

On 2021-09-10 18:16:14 [+0200], Peter Zijlstra wrote:
> On Tue, Sep 07, 2021 at 12:34:58PM +0200, Sebastian Andrzej Siewior wrote:
> > rt_rwlock_is_contended() has not users. It makes no sense to use it as
> > rwlock_is_contended() because it is a sleeping lock on RT and preemption
> > is possible. It reports always != 0 if used by a writer and even if
> > there is a waiter then the lock might not be handed over if the
> > current owner has the highest priority.
> 
> I'm confused now... so first you have two patches that wire up
> {spin,rwlock}_is_contended() and how you're arguing we shouldn't do
> that?

Yes. I got arguments against it after sleeping :)

> AFAICT the _is_contended() can still use useful even with preemption,
> the typicla use case is a long lock-holder deciding to drop the lock in
> order to let someone else in. That still works with preemptible locks,
> no?

Sure. We can do that. Then we should look into:
- fixing rwsem_is_contended() for the writer. The writer always observes
  true even with no waiter around.

- checking the top waiter list vs priority of the lock owner/current. If
  the current lock owner has the highest priority then the unlock+lock
  is probably pointless as he regains the lock.
  For the spin_lock() case, if the owner is SCHED_OTHER and the waiter
  is SCHED_OTHER then unlock+lock will give the lock to the previous
  owner due to rt_mutex_steal() working in his favour. Unless there is a
  preemption.

- reader checking for contention is probably pointless. It works with a
  pending writer and one reader since a second reader will hold-off the
  writer from acquiring the lock. Also if the reader does unlock+lock
  then writer might not be quick enough.

Sebastian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ