[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140611113841.GD3588@twins.programming.kicks-ass.net>
Date: Wed, 11 Jun 2014 13:38:41 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Waiman Long <Waiman.Long@...com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, linux-arch@...r.kernel.org,
x86@...nel.org, linux-kernel@...r.kernel.org,
virtualization@...ts.linux-foundation.org,
xen-devel@...ts.xenproject.org, kvm@...r.kernel.org,
Paolo Bonzini <paolo.bonzini@...il.com>,
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Rik van Riel <riel@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Raghavendra K T <raghavendra.kt@...ux.vnet.ibm.com>,
David Vrabel <david.vrabel@...rix.com>,
Oleg Nesterov <oleg@...hat.com>,
Gleb Natapov <gleb@...hat.com>,
Scott J Norton <scott.norton@...com>,
Chegu Vinod <chegu_vinod@...com>
Subject: Re: [PATCH v11 09/16] qspinlock, x86: Allow unfair spinlock in a
virtual guest
On Wed, Jun 11, 2014 at 12:54:02PM +0200, Peter Zijlstra wrote:
> > @@ -252,6 +260,18 @@ void queue_spin_lock_slowpath(struct qspinlock *lock, u32 val)
> >
> > BUILD_BUG_ON(CONFIG_NR_CPUS >= (1U << _Q_TAIL_CPU_BITS));
> >
> > +#ifdef CONFIG_VIRT_UNFAIR_LOCKS
> > + /*
> > + * A simple test and set unfair lock
> > + */
> > + if (static_key_false(&virt_unfairlocks_enabled)) {
> > + cpu_relax(); /* Relax after a failed lock attempt */
>
> Meh, I don't think anybody can tell the difference if you put that in or
> not, therefore don't.
>
> > + while (!queue_spin_trylock(lock))
> > + cpu_relax();
> > + return;
> > + }
> > +#endif /* CONFIG_VIRT_UNFAIR_LOCKS */
>
> If you're really worried about those upper 24bits, you can always clear
> them when you get here.
I don't think its a problem at all; flipping the static_key requires
stop_machine, which guarantees us that there are no spinlocks held. So I
think you can actually BUG_ON() the upper 24bits.
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists