All of lore.kernel.org
 help / color / mirror / Atom feed
From: Waiman Long <waiman.long@hp.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Arnd Bergmann <arnd@arndb.de>,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	the arch/x86 maintainers <x86@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Michel Lespinasse <walken@google.com>,
	Andi Kleen <andi@firstfloor.org>, Rik van Riel <riel@redhat.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>,
	George Spelvin <linux@horizon.com>,
	Tim Chen <tim.c.chen@linux.intel.com>,
	Daniel J Blueman <daniel@numascale.com>,
	Alexander Fyodorov <halcy@yandex.ru>,
	Aswin Chandramouleeswaran <aswin@hp.com>,
	Scott J Norton <scott.norton@hp.com>,
	Thavatchai
Subject: Re: [PATCH v4 0/3] qspinlock: Introducing a 4-byte queue spinlock
Date: Thu, 20 Feb 2014 12:54:07 -0500	[thread overview]
Message-ID: <5306413F.3010106@hp.com> (raw)
In-Reply-To: <CA+55aFwyVgLJq2OgKZBK7g+T5-_M4o+dnEAr+qtYxA5t_=HSvA@mail.gmail.com>

On 02/19/2014 03:17 PM, Linus Torvalds wrote:
> On Wed, Feb 19, 2014 at 11:24 AM, Waiman Long<waiman.long@hp.com>  wrote:
>> We do have a CONFIG_PARAVIRT macro that turns on or off PV support. The
>> queue spinlock can be easily changed into an unfair lock which allows lock
>> stealing. We could have a config option to make it unfair in the PARAVIRT
>> environment, but I don't think Linus like the idea of an unfair lock.
> I could care less for the paravirt case. As long as the native case
> ends up being sane (even when CONFIG_PARAVIRT is set at compile time),
> I'm fine.
>
> When actually running in a paravirtualized environment, locks are
> always going to have problems.
>
>                    Linus

I think we could implement 2 versions of _raw_spin_lock. The primary one 
is fair and the other one is unfair with a jump label that jump from the 
fair version to the unfair version. At boot time, the kernel can check 
to see it is really running in a PV environment and then activate the 
jump label to use the unfair version.

Now the key is how to detect if a kernel is really running in a PV 
environment. I need to ask some virtualization experts on that.

-Longman

WARNING: multiple messages have this Message-ID (diff)
From: Waiman Long <waiman.long@hp.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Arnd Bergmann <arnd@arndb.de>,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	the arch/x86 maintainers <x86@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Michel Lespinasse <walken@google.com>,
	Andi Kleen <andi@firstfloor.org>, Rik van Riel <riel@redhat.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>,
	George Spelvin <linux@horizon.com>,
	Tim Chen <tim.c.chen@linux.intel.com>,
	Daniel J Blueman <daniel@numascale.com>,
	Alexander Fyodorov <halcy@yandex.ru>,
	Aswin Chandramouleeswaran <aswin@hp.com>,
	Scott J Norton <scott.norton@hp.com>,
	Thavatchai Makphaibulchoke <thavatchai.makpahibulchoke@hp.com>
Subject: Re: [PATCH v4 0/3] qspinlock: Introducing a 4-byte queue spinlock
Date: Thu, 20 Feb 2014 12:54:07 -0500	[thread overview]
Message-ID: <5306413F.3010106@hp.com> (raw)
Message-ID: <20140220175407.K1nkB7SijACuwaLURhFgTkmzBYbgUqSONEXfsNTLCTE@z> (raw)
In-Reply-To: <CA+55aFwyVgLJq2OgKZBK7g+T5-_M4o+dnEAr+qtYxA5t_=HSvA@mail.gmail.com>

On 02/19/2014 03:17 PM, Linus Torvalds wrote:
> On Wed, Feb 19, 2014 at 11:24 AM, Waiman Long<waiman.long@hp.com>  wrote:
>> We do have a CONFIG_PARAVIRT macro that turns on or off PV support. The
>> queue spinlock can be easily changed into an unfair lock which allows lock
>> stealing. We could have a config option to make it unfair in the PARAVIRT
>> environment, but I don't think Linus like the idea of an unfair lock.
> I could care less for the paravirt case. As long as the native case
> ends up being sane (even when CONFIG_PARAVIRT is set at compile time),
> I'm fine.
>
> When actually running in a paravirtualized environment, locks are
> always going to have problems.
>
>                    Linus

I think we could implement 2 versions of _raw_spin_lock. The primary one 
is fair and the other one is unfair with a jump label that jump from the 
fair version to the unfair version. At boot time, the kernel can check 
to see it is really running in a PV environment and then activate the 
jump label to use the unfair version.

Now the key is how to detect if a kernel is really running in a PV 
environment. I need to ask some virtualization experts on that.

-Longman

  reply	other threads:[~2014-02-20 17:54 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-17 20:41 [PATCH v4 0/3] qspinlock: Introducing a 4-byte queue spinlock Waiman Long
2014-02-17 20:41 ` [PATCH v4 1/3] qspinlock: Introducing a 4-byte queue spinlock implementation Waiman Long
2014-02-17 22:45   ` [tip:x86/spinlocks] " tip-bot for Waiman Long
2014-02-18  7:30   ` [PATCH v4 1/3] " Peter Zijlstra
2014-02-18 19:29     ` Waiman Long
2014-02-18  7:33   ` Peter Zijlstra
2014-02-18 19:31     ` Waiman Long
2014-02-18  7:39   ` Peter Zijlstra
2014-02-18 19:39     ` Waiman Long
2014-02-18 21:34       ` Peter Zijlstra
2014-02-19  0:50         ` Waiman Long
2014-02-19  8:52           ` Peter Zijlstra
2014-02-19 19:26             ` Waiman Long
2014-02-18 21:37       ` Peter Zijlstra
2014-02-19  0:58         ` Waiman Long
2014-02-19  8:55           ` Peter Zijlstra
2014-02-19 19:30             ` Waiman Long
2014-02-17 20:41 ` [PATCH v4 2/3] qspinlock, x86: Enable x86-64 to use queue spinlock Waiman Long
2014-02-17 22:46   ` [tip:x86/spinlocks] " tip-bot for Waiman Long
2014-02-17 20:41 ` [PATCH v4 3/3] qspinlock, x86: Add x86 specific optimization for 2 contending tasks Waiman Long
2014-02-17 22:46   ` [tip:x86/spinlocks] " tip-bot for Waiman Long
2014-02-21 12:12   ` [PATCH v4 3/3] " Peter Zijlstra
2014-02-21 17:08     ` Waiman Long
2014-02-21 17:09       ` Waiman Long
2014-02-21 17:26         ` Peter Zijlstra
2014-02-22  1:36           ` Waiman Long
2014-02-21 17:28   ` Peter Zijlstra
2014-02-22  1:39     ` Waiman Long
2014-02-17 22:47 ` [PATCH v4 0/3] qspinlock: Introducing a 4-byte queue spinlock H. Peter Anvin
2014-02-18  7:31   ` Peter Zijlstra
2014-02-18  7:39     ` H. Peter Anvin
2014-02-18 19:30     ` Waiman Long
2014-02-18 21:28       ` Peter Zijlstra
2014-02-19  0:42         ` Waiman Long
2014-02-19  7:09           ` Raghavendra K T
2014-02-19  8:51           ` Peter Zijlstra
2014-02-19 19:24             ` Waiman Long
2014-02-19 19:48               ` Peter Zijlstra
2014-02-20 17:37                 ` Waiman Long
2014-02-20 17:44                   ` Linus Torvalds
2014-02-20 17:44                     ` Linus Torvalds
2014-02-20 18:15                   ` Peter Zijlstra
2014-02-19 20:17               ` Linus Torvalds
2014-02-19 20:17                 ` Linus Torvalds
2014-02-20 17:54                 ` Waiman Long [this message]
2014-02-20 17:54                   ` Waiman Long
2014-02-20 18:42                   ` Linus Torvalds
2014-02-20 18:42                     ` Linus Torvalds
2014-02-20 19:21                     ` Waiman Long
2014-02-20 19:21                       ` Waiman Long
2014-02-20 19:32                   ` Raghavendra K T
2014-02-20 19:32                     ` Raghavendra K T
2014-02-21 17:02                     ` Waiman Long
2014-02-21 17:02                       ` Waiman Long
2014-02-21 17:05                       ` Linus Torvalds
2014-02-21 17:05                         ` Linus Torvalds
2014-02-19 21:29               ` H. Peter Anvin
2014-02-18  7:38   ` Peter Zijlstra
2014-02-22 16:56     ` Ingo Molnar
2014-02-25  3:37       ` Waiman Long
2014-02-25  3:37         ` Waiman Long
2014-02-18 19:27   ` Waiman Long

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5306413F.3010106@hp.com \
    --to=waiman.long@hp.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=arnd@arndb.de \
    --cc=aswin@hp.com \
    --cc=daniel@numascale.com \
    --cc=halcy@yandex.ru \
    --cc=hpa@zytor.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@horizon.com \
    --cc=mingo@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=raghavendra.kt@linux.vnet.ibm.com \
    --cc=riel@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=scott.norton@hp.com \
    --cc=tglx@linutronix.de \
    --cc=tim.c.chen@linux.intel.com \
    --cc=torvalds@linux-foundation.org \
    --cc=walken@google.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.