From: David Vrabel <david.vrabel@citrix.com>
To: Peter Zijlstra <peterz@infradead.org>, Waiman.Long@hp.com
Cc: raghavendra.kt@linux.vnet.ibm.com, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org, hpa@zytor.com,
boris.ostrovsky@oracle.com, linux-arch@vger.kernel.org,
x86@kernel.org, mingo@redhat.com, doug.hatch@hp.com,
xen-devel@lists.xenproject.org, paulmck@linux.vnet.ibm.com,
riel@redhat.com, scott.norton@hp.com, paolo.bonzini@gmail.com,
tglx@linutronix.de, virtualization@lists.linux-foundation.org,
oleg@redhat.com, luto@amacapital.net, david.vrabel@citrix.com,
torvalds@linux-foundation.org
Subject: Re: [Xen-devel] [PATCH 0/9] qspinlock stuff -v15
Date: Thu, 19 Mar 2015 18:01:34 +0000 [thread overview]
Message-ID: <550B0EFE.1040309@citrix.com> (raw)
In-Reply-To: <20150316131613.720617163@infradead.org>
On 16/03/15 13:16, Peter Zijlstra wrote:
>
> I feel that if someone were to do a Xen patch we can go ahead and merge this
> stuff (finally!).
This seems work for me, but I've not got time to give it a more thorough
testing.
You can fold this into your series.
There doesn't seem to be a way to disable QUEUE_SPINLOCKS when supported by
the arch, is this intentional? If so, the existing ticketlock code could go.
David
8<------------------------------
x86/xen: paravirt support for qspinlocks
Provide the wait and kick ops necessary for paravirt-aware queue
spinlocks.
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
---
arch/x86/xen/spinlock.c | 40 +++++++++++++++++++++++++++++++++++++---
1 file changed, 37 insertions(+), 3 deletions(-)
diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
index 956374c..b019b2a 100644
--- a/arch/x86/xen/spinlock.c
+++ b/arch/x86/xen/spinlock.c
@@ -95,17 +95,43 @@ static inline void spin_time_accum_blocked(u64 start)
}
#endif /* CONFIG_XEN_DEBUG_FS */
+static DEFINE_PER_CPU(int, lock_kicker_irq) = -1;
+static DEFINE_PER_CPU(char *, irq_name);
+static bool xen_pvspin = true;
+
+#ifdef CONFIG_QUEUE_SPINLOCK
+
+#include <asm/qspinlock.h>
+
+PV_CALLEE_SAVE_REGS_THUNK(__pv_queue_spin_unlock);
+
+static void xen_qlock_wait(u8 *ptr, u8 val)
+{
+ int irq = __this_cpu_read(lock_kicker_irq);
+
+ xen_clear_irq_pending(irq);
+
+ barrier();
+
+ if (READ_ONCE(*ptr) == val)
+ xen_poll_irq(irq);
+}
+
+static void xen_qlock_kick(int cpu)
+{
+ xen_send_IPI_one(cpu, XEN_SPIN_UNLOCK_VECTOR);
+}
+
+#else
+
struct xen_lock_waiting {
struct arch_spinlock *lock;
__ticket_t want;
};
-static DEFINE_PER_CPU(int, lock_kicker_irq) = -1;
-static DEFINE_PER_CPU(char *, irq_name);
static DEFINE_PER_CPU(struct xen_lock_waiting, lock_waiting);
static cpumask_t waiting_cpus;
-static bool xen_pvspin = true;
__visible void xen_lock_spinning(struct arch_spinlock *lock, __ticket_t want)
{
int irq = __this_cpu_read(lock_kicker_irq);
@@ -217,6 +243,7 @@ static void xen_unlock_kick(struct arch_spinlock *lock, __ticket_t next)
}
}
}
+#endif /* !QUEUE_SPINLOCK */
static irqreturn_t dummy_handler(int irq, void *dev_id)
{
@@ -280,8 +307,15 @@ void __init xen_init_spinlocks(void)
return;
}
printk(KERN_DEBUG "xen: PV spinlocks enabled\n");
+#ifdef CONFIG_QUEUE_SPINLOCK
+ pv_lock_ops.queue_spin_lock_slowpath = __pv_queue_spin_lock_slowpath;
+ pv_lock_ops.queue_spin_unlock = PV_CALLEE_SAVE(__pv_queue_spin_unlock);
+ pv_lock_ops.wait = xen_qlock_wait;
+ pv_lock_ops.kick = xen_qlock_kick;
+#else
pv_lock_ops.lock_spinning = PV_CALLEE_SAVE(xen_lock_spinning);
pv_lock_ops.unlock_kick = xen_unlock_kick;
+#endif
}
/*
--
1.7.10.4
next prev parent reply other threads:[~2015-03-19 18:01 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-16 13:16 [PATCH 0/9] qspinlock stuff -v15 Peter Zijlstra
2015-03-16 13:16 ` Peter Zijlstra
2015-03-16 13:16 ` [PATCH 1/9] qspinlock: A simple generic 4-byte queue spinlock Peter Zijlstra
2015-03-16 13:16 ` Peter Zijlstra
2015-03-16 13:16 ` [PATCH 2/9] qspinlock, x86: Enable x86-64 to use " Peter Zijlstra
2015-03-16 13:16 ` Peter Zijlstra
2015-03-16 13:16 ` [PATCH 3/9] qspinlock: Add pending bit Peter Zijlstra
2015-03-16 13:16 ` Peter Zijlstra
2015-03-16 13:16 ` [PATCH 4/9] qspinlock: Extract out code snippets for the next patch Peter Zijlstra
2015-03-16 13:16 ` Peter Zijlstra
2015-03-16 13:16 ` [PATCH 5/9] qspinlock: Optimize for smaller NR_CPUS Peter Zijlstra
2015-03-16 13:16 ` Peter Zijlstra
2015-03-16 13:16 ` [PATCH 6/9] qspinlock: Use a simple write to grab the lock Peter Zijlstra
2015-03-16 13:16 ` Peter Zijlstra
2015-03-16 13:16 ` [PATCH 7/9] qspinlock: Revert to test-and-set on hypervisors Peter Zijlstra
2015-03-16 13:16 ` Peter Zijlstra
2015-03-16 13:16 ` [PATCH 8/9] qspinlock: Generic paravirt support Peter Zijlstra
2015-03-16 13:16 ` Peter Zijlstra
2015-03-18 20:50 ` Waiman Long
2015-03-19 10:12 ` Peter Zijlstra
2015-03-19 12:25 ` Peter Zijlstra
2015-03-19 12:25 ` Peter Zijlstra
2015-03-19 13:43 ` Peter Zijlstra
2015-03-19 23:25 ` Waiman Long
2015-04-01 16:20 ` Waiman Long
2015-04-01 16:20 ` Waiman Long
2015-04-01 17:12 ` Peter Zijlstra
2015-04-01 17:12 ` Peter Zijlstra
2015-04-01 17:42 ` Peter Zijlstra
2015-04-01 17:42 ` Peter Zijlstra
2015-04-01 18:17 ` Peter Zijlstra
2015-04-01 18:17 ` Peter Zijlstra
2015-04-01 18:54 ` Waiman Long
2015-04-01 18:48 ` Peter Zijlstra
2015-04-01 19:58 ` Waiman Long
2015-04-01 19:58 ` Waiman Long
2015-04-01 21:03 ` Peter Zijlstra
2015-04-01 21:03 ` Peter Zijlstra
2015-04-02 16:28 ` Waiman Long
2015-04-02 17:20 ` Peter Zijlstra
2015-04-02 17:20 ` Peter Zijlstra
2015-04-02 19:48 ` Peter Zijlstra
2015-04-03 3:39 ` Waiman Long
2015-04-03 3:39 ` Waiman Long
2015-04-03 13:43 ` Peter Zijlstra
2015-04-03 13:43 ` Peter Zijlstra
2015-04-01 18:54 ` Waiman Long
2015-04-01 20:10 ` Waiman Long
2015-04-01 20:10 ` Waiman Long
2015-03-16 13:16 ` [PATCH 9/9] qspinlock, x86, kvm: Implement KVM support for paravirt qspinlock Peter Zijlstra
2015-03-16 13:16 ` [PATCH 9/9] qspinlock,x86,kvm: " Peter Zijlstra
2015-03-19 2:45 ` [PATCH 9/9] qspinlock, x86, kvm: " Waiman Long
2015-03-19 10:01 ` [PATCH 9/9] qspinlock,x86,kvm: " Peter Zijlstra
2015-03-19 10:01 ` Peter Zijlstra
2015-03-19 21:08 ` [PATCH 9/9] qspinlock, x86, kvm: " Waiman Long
2015-03-19 21:08 ` [PATCH 9/9] qspinlock,x86,kvm: " Waiman Long
2015-03-20 7:43 ` [PATCH 9/9] qspinlock, x86, kvm: " Raghavendra K T
2015-03-20 7:43 ` [PATCH 9/9] qspinlock,x86,kvm: " Raghavendra K T
2015-03-16 14:08 ` [Xen-devel] [PATCH 0/9] qspinlock stuff -v15 David Vrabel
2015-03-16 14:08 ` David Vrabel
2015-03-18 20:36 ` Waiman Long
2015-03-19 18:01 ` David Vrabel [this message]
2015-03-19 18:01 ` [Xen-devel] " David Vrabel
2015-03-19 18:32 ` Peter Zijlstra
2015-03-19 18:32 ` Peter Zijlstra
2015-03-25 19:47 ` Konrad Rzeszutek Wilk
2015-03-26 20:21 ` Peter Zijlstra
2015-03-26 20:21 ` Peter Zijlstra
2015-03-27 14:07 ` Konrad Rzeszutek Wilk
2015-03-27 14:07 ` Konrad Rzeszutek Wilk
2015-03-30 16:41 ` Waiman Long
2015-03-30 16:25 ` Waiman Long
2015-03-30 16:29 ` Peter Zijlstra
2015-03-30 16:29 ` Peter Zijlstra
2015-03-30 16:43 ` Waiman Long
2015-03-30 16:43 ` Waiman Long
2015-03-27 6:40 ` Raghavendra K T
2015-03-27 6:40 ` Raghavendra K T
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=550B0EFE.1040309@citrix.com \
--to=david.vrabel@citrix.com \
--cc=Waiman.Long@hp.com \
--cc=boris.ostrovsky@oracle.com \
--cc=doug.hatch@hp.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=paolo.bonzini@gmail.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=raghavendra.kt@linux.vnet.ibm.com \
--cc=riel@redhat.com \
--cc=scott.norton@hp.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).