lkml.org 
[lkml]   [2015]   [Oct]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH v1 2/2] xen_nopv: Combine a bunch of the PV features that can be disabled
Date
under one parameter. Removes the xen_nopvspin parameter and
makes it part of the xen_nopv.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
Documentation/kernel-parameters.txt | 15 +++++------
arch/x86/xen/enlighten.c | 50 +++++++++++++++++++++++++++++++++----
arch/x86/xen/spinlock.c | 18 ++++---------
arch/x86/xen/xen-ops.h | 4 +++
4 files changed, 62 insertions(+), 25 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 22a4b68..73cd745 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -4125,13 +4125,14 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
the unplug protocol
never -- do not unplug even if version check succeeds

- xen_nopvspin [X86,XEN]
- Disables the ticketlock slowpath using Xen PV
- optimizations.
-
- xen_nopv [X86]
- Disables the PV optimizations forcing the HVM guest to
- run as generic HVM guest with no PV drivers.
+ xen_nopv= [X86,XEN]
+ Disables various (or all) PV optimizations forcing the
+ HVM (or PV) guest to run without them.
+ Format: [off0,][off]
+ all -- every PV feature on HVM.
+ spin -- Disables the ticketlock slowpath using Xen PV
+ optimizations (PV and HVM).
+ ipi - Disable PV event channel IPI (on HVM).

xirc2ps_cs= [NET,PCMCIA]
Format:
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 30d12af..c644d2c 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1829,17 +1829,57 @@ static void __init xen_hvm_guest_init(void)
}
#endif

-static bool xen_nopv = false;
+static unsigned int xen_nopv_feat;
+#define XEN_NOPV_SPIN 1<<1
+#define XEN_NOPV_IPI 1<<2
+#define XEN_NOPV_ALL (XEN_NOPV_SPIN | XEN_NOPV_IPI)
+
+bool xen_no_pvspin(void)
+{
+ return xen_nopv_feat & XEN_NOPV_SPIN;
+}
+
+bool xen_no_pv(void)
+{
+ return xen_nopv_feat & XEN_NOPV_ALL;
+}
+
+bool xen_no_pvipi(void)
+{
+ return xen_nopv_feat & XEN_NOPV_IPI;
+}
+
static __init int xen_parse_nopv(char *arg)
{
- xen_nopv = true;
- return 0;
+ char *p, *q;
+ int l;
+
+ for (p = arg; p; p = q) {
+ q = strchr(p, ',');
+ if (q) {
+ l = q - p;
+ q++;
+ } else {
+ l = strlen(p);
+ }
+ if (!strncmp(p, "spin", l))
+ xen_nopv_feat |= XEN_NOPV_SPIN;
+ else if (!strncmp(p, "all", l))
+ xen_nopv_feat = XEN_NOPV_ALL;
+ else if (!strncmp(p, "ipi", l))
+ xen_nopv_feat |= XEN_NOPV_IPI;
+ else
+ printk(KERN_WARNING "unrecognised option '%s' "
+ "in parameter 'xen_nopv'\n", p);
+ }
+ printk(KERN_DEBUG "xen_nopv_feat = 0x%x\n", xen_nopv_feat);
+ return 0;
}
early_param("xen_nopv", xen_parse_nopv);

static uint32_t __init xen_platform(void)
{
- if (xen_nopv)
+ if (xen_no_pv())
return 0;

return xen_cpuid_base();
@@ -1847,7 +1887,7 @@ static uint32_t __init xen_platform(void)

bool xen_hvm_need_lapic(void)
{
- if (xen_nopv)
+ if (xen_no_pv())
return false;
if (xen_pv_domain())
return false;
diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
index 9e2ba5c..31b91e9 100644
--- a/arch/x86/xen/spinlock.c
+++ b/arch/x86/xen/spinlock.c
@@ -19,7 +19,6 @@

static DEFINE_PER_CPU(int, lock_kicker_irq) = -1;
static DEFINE_PER_CPU(char *, irq_name);
-static bool xen_pvspin = true;

#ifdef CONFIG_QUEUED_SPINLOCKS

@@ -277,7 +276,7 @@ void xen_init_lock_cpu(int cpu)
int irq;
char *name;

- if (!xen_pvspin)
+ if (!xen_no_pvspin())
return;

WARN(per_cpu(lock_kicker_irq, cpu) >= 0, "spinlock on CPU%d exists on IRQ%d!\n",
@@ -302,7 +301,7 @@ void xen_init_lock_cpu(int cpu)

void xen_uninit_lock_cpu(int cpu)
{
- if (!xen_pvspin)
+ if (!xen_no_pvspin())
return;

unbind_from_irqhandler(per_cpu(lock_kicker_irq, cpu), NULL);
@@ -323,7 +322,7 @@ void xen_uninit_lock_cpu(int cpu)
void __init xen_init_spinlocks(void)
{

- if (!xen_pvspin) {
+ if (!xen_no_pvspin()) {
printk(KERN_DEBUG "xen: PV spinlocks disabled\n");
return;
}
@@ -348,7 +347,7 @@ void __init xen_init_spinlocks(void)
*/
static __init int xen_init_spinlocks_jump(void)
{
- if (!xen_pvspin)
+ if (!xen_no_pvspin())
return 0;

if (!xen_domain())
@@ -359,13 +358,6 @@ static __init int xen_init_spinlocks_jump(void)
}
early_initcall(xen_init_spinlocks_jump);

-static __init int xen_parse_nopvspin(char *arg)
-{
- xen_pvspin = false;
- return 0;
-}
-early_param("xen_nopvspin", xen_parse_nopvspin);
-
#if defined(CONFIG_XEN_DEBUG_FS) && !defined(CONFIG_QUEUED_SPINLOCKS)

static struct dentry *d_spin_debug;
@@ -377,7 +369,7 @@ static int __init xen_spinlock_debugfs(void)
if (d_xen == NULL)
return -ENOMEM;

- if (!xen_pvspin)
+ if (xen_no_pvspin())
return 0;

d_spin_debug = debugfs_create_dir("spinlocks", d_xen);
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index 1399423..3652d38 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -149,4 +149,8 @@ __visible void xen_adjust_exception_frame(void);
extern int xen_panic_handler_init(void);

void xen_pvh_secondary_vcpu_init(int cpu);
+
+bool xen_no_pvspin(void);
+bool xen_no_pvipi(void);
+bool xen_no_pv(void);
#endif /* XEN_OPS_H */
--
2.4.3


\
 
 \ /
  Last update: 2015-10-07 22:41    [W:0.065 / U:0.744 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site