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, 9 Apr 2015 09:47:36 -0700
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Ingo Molnar <mingo@...nel.org>,
	Paul McKenney <paulmck@...ux.vnet.ibm.com>
Cc:	Jason Low <jason.low2@...com>,
	Peter Zijlstra <peterz@...radead.org>,
	Davidlohr Bueso <dave@...olabs.net>,
	Tim Chen <tim.c.chen@...ux.intel.com>,
	Aswin Chandramouleeswaran <aswin@...com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] locking/rwsem: Use a return variable in rwsem_spin_on_owner()

On Thu, Apr 9, 2015 at 12:53 AM, Ingo Molnar <mingo@...nel.org> wrote:
>
> The point is to generally unify the 'out' paths - i.e. to merge it
> with the rcu_read_unlock() as well, so that we have really simple
> gotos and only a single exit path.

Maybe just have the rcu read-locking be done in the *caller* (possibly
through using just a helper wrapper function that does nothing but the
locking), so that you can just do a simple "return false" in the
function itself.

That said, it worries me a bit that we do that spinning while holding
the RCU read lock in the first place. Yes, we stop spinning if
"need_resched()" is set, but what effect - if any - does all of this
have on RCU latency? If somebody is waiting for a RCU grace period,
I'm not seeing that setting need-resched...

At least with CONFIG_PREEMPT_RCU, the read-unlock is *not* just doing
a preempt-disable, so it's not necessarily just about need_resched().
It does all the magic with 'rcu_read_unlock_special.s' too..

Adding Paul. From a RCU locking standpoint, the thing is basically
(not the real code, edited down):

        rcu_read_lock();
        while (sem->owner == owner) {
                if (!owner->on_cpu || need_resched())
                        break;
                cpu_relax_lowlatency();
        }
        rcu_read_unlock();

so we busy-loop while holding the RCU read lock while

   sem->owner == owner && owner->on_cpu && !need_resched()

is true. That is usually not very long, but we've already had
watchdogs go off when we get this wrong, so..

Paul, comments? Are there particular latency concerns wrt
CONFIG_PREEMPT_RCU here? Or am I just being silly?

                         Linus
--
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