Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1708597 > unrolled thread

[PATCH 0/3] x86: paravirt related cleanup

Started byJuergen Gross <jgross@suse.com>
First post2017-08-10 15:00 +0200
Last post2017-08-10 18:30 +0200
Articles 9 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/3] x86: paravirt related cleanup Juergen Gross <jgross@suse.com> - 2017-08-10 15:00 +0200
    [PATCH 3/3] x86/vsmp: remove vsmp paravirt support Juergen Gross <jgross@suse.com> - 2017-08-10 15:00 +0200
      RE: [PATCH 3/3] x86/vsmp: remove vsmp paravirt support "Shai Fultheim (Shai@ScaleMP.com)" <Shai@ScaleMP.com> - 2017-08-10 17:30 +0200
        Re: [PATCH 3/3] x86/vsmp: remove vsmp paravirt support Juergen Gross <jgross@suse.com> - 2017-08-10 17:40 +0200
    [PATCH 1/3] paravirt,xen: remove xen_patch() Juergen Gross <jgross@suse.com> - 2017-08-10 15:00 +0200
      Re: [PATCH 1/3] paravirt,xen: remove xen_patch() Peter Zijlstra <peterz@infradead.org> - 2017-08-10 18:30 +0200
        Re: [PATCH 1/3] paravirt,xen: remove xen_patch() Juergen Gross <jgross@suse.com> - 2017-08-10 19:40 +0200
      Re: [PATCH 1/3] paravirt,xen: remove xen_patch() Josh Poimboeuf <jpoimboe@redhat.com> - 2017-08-10 18:30 +0200
      Re: [PATCH 1/3] paravirt,xen: remove xen_patch() Peter Zijlstra <peterz@infradead.org> - 2017-08-10 18:30 +0200

#1708597 — [PATCH 0/3] x86: paravirt related cleanup

FromJuergen Gross <jgross@suse.com>
Date2017-08-10 15:00 +0200
Subject[PATCH 0/3] x86: paravirt related cleanup
Message-ID<ucVe9-5GH-1@gated-at.bofh.it>
Cleanup special cases of paravirt patching:

- Xen doesn't need a custom patching function, it can use
  paravirt_patch_default()

- Remove lguest completely from the tree. A LKML mail asking for any
  users 3 months ago did not reveal any need for keeping lguest [1].

- Remove vsmp paravirt support. This is more kind of a RFC. The code
  suggests paravirt support in vsmp might be optional and there is no
  documentation (at least I found none) to support its need.

In case the patches make it to the tree there is quite some potential
for further simplification of paravirt stuff. Especially most of the
pv operations can be put under the CONFIG_XEN_PV umbrella.

Juergen Gross (3):
  paravirt,xen: remove xen_patch()
  x86/lguest: remove lguest support
  x86/vsmp: remove vsmp paravirt support

 MAINTAINERS                           |   11 -
 arch/x86/Kbuild                       |    3 -
 arch/x86/Kconfig                      |    3 -
 arch/x86/include/asm/lguest.h         |   91 -
 arch/x86/include/asm/lguest_hcall.h   |   74 -
 arch/x86/include/asm/processor.h      |    2 +-
 arch/x86/include/uapi/asm/bootparam.h |    2 +-
 arch/x86/kernel/asm-offsets_32.c      |   20 -
 arch/x86/kernel/head_32.S             |    2 -
 arch/x86/kernel/platform-quirks.c     |    1 -
 arch/x86/kernel/vsmp_64.c             |   69 +-
 arch/x86/kvm/Kconfig                  |    1 -
 arch/x86/lguest/Kconfig               |   14 -
 arch/x86/lguest/Makefile              |    2 -
 arch/x86/lguest/boot.c                | 1558 ---------------
 arch/x86/lguest/head_32.S             |  192 --
 arch/x86/xen/enlighten_pv.c           |   59 +-
 drivers/Makefile                      |    1 -
 drivers/block/Kconfig                 |    2 +-
 drivers/char/Kconfig                  |    2 +-
 drivers/char/virtio_console.c         |    2 +-
 drivers/lguest/Kconfig                |   13 -
 drivers/lguest/Makefile               |   26 -
 drivers/lguest/README                 |   47 -
 drivers/lguest/core.c                 |  398 ----
 drivers/lguest/hypercalls.c           |  304 ---
 drivers/lguest/interrupts_and_traps.c |  706 -------
 drivers/lguest/lg.h                   |  258 ---
 drivers/lguest/lguest_user.c          |  446 -----
 drivers/lguest/page_tables.c          | 1239 ------------
 drivers/lguest/segments.c             |  228 ---
 drivers/lguest/x86/core.c             |  724 -------
 drivers/lguest/x86/switcher_32.S      |  388 ----
 drivers/net/Kconfig                   |    2 +-
 drivers/tty/hvc/Kconfig               |    2 +-
 drivers/virtio/Kconfig                |    4 +-
 include/linux/lguest.h                |   73 -
 include/linux/lguest_launcher.h       |   44 -
 include/uapi/linux/virtio_ring.h      |    4 +-
 tools/Makefile                        |   11 +-
 tools/lguest/.gitignore               |    2 -
 tools/lguest/Makefile                 |   14 -
 tools/lguest/extract                  |   58 -
 tools/lguest/lguest.c                 | 3420 ---------------------------------
 tools/lguest/lguest.txt               |  125 --
 45 files changed, 18 insertions(+), 10629 deletions(-)
 delete mode 100644 arch/x86/include/asm/lguest.h
 delete mode 100644 arch/x86/include/asm/lguest_hcall.h
 delete mode 100644 arch/x86/lguest/Kconfig
 delete mode 100644 arch/x86/lguest/Makefile
 delete mode 100644 arch/x86/lguest/boot.c
 delete mode 100644 arch/x86/lguest/head_32.S
 delete mode 100644 drivers/lguest/Kconfig
 delete mode 100644 drivers/lguest/Makefile
 delete mode 100644 drivers/lguest/README
 delete mode 100644 drivers/lguest/core.c
 delete mode 100644 drivers/lguest/hypercalls.c
 delete mode 100644 drivers/lguest/interrupts_and_traps.c
 delete mode 100644 drivers/lguest/lg.h
 delete mode 100644 drivers/lguest/lguest_user.c
 delete mode 100644 drivers/lguest/page_tables.c
 delete mode 100644 drivers/lguest/segments.c
 delete mode 100644 drivers/lguest/x86/core.c
 delete mode 100644 drivers/lguest/x86/switcher_32.S
 delete mode 100644 include/linux/lguest.h
 delete mode 100644 include/linux/lguest_launcher.h
 delete mode 100644 tools/lguest/.gitignore
 delete mode 100644 tools/lguest/Makefile
 delete mode 100644 tools/lguest/extract
 delete mode 100644 tools/lguest/lguest.c
 delete mode 100644 tools/lguest/lguest.txt

-- 
2.12.3

[toc] | [next] | [standalone]


#1708602 — [PATCH 3/3] x86/vsmp: remove vsmp paravirt support

FromJuergen Gross <jgross@suse.com>
Date2017-08-10 15:00 +0200
Subject[PATCH 3/3] x86/vsmp: remove vsmp paravirt support
Message-ID<ucVea-5GH-29@gated-at.bofh.it>
In reply to#1708597
vSMP has seen its last functional patch more than 3 years ago. It is
not clear whether the vSMP paravirtualized irq functions are still
needed.

Remove them as they seem to be optional and their existence is blocking
some simplification work of paravirt infrastructure.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/Kconfig          |  1 -
 arch/x86/kernel/vsmp_64.c | 69 +----------------------------------------------
 2 files changed, 1 insertion(+), 69 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 3fac2570a2e1..13a3d8744ae4 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -495,7 +495,6 @@ config X86_NUMACHIP
 config X86_VSMP
 	bool "ScaleMP vSMP"
 	select HYPERVISOR_GUEST
-	select PARAVIRT
 	depends on X86_64 && PCI
 	depends on X86_EXTENDED_PLATFORM
 	depends on SMP
diff --git a/arch/x86/kernel/vsmp_64.c b/arch/x86/kernel/vsmp_64.c
index b034b1b14b9c..5d392b809ee4 100644
--- a/arch/x86/kernel/vsmp_64.c
+++ b/arch/x86/kernel/vsmp_64.c
@@ -21,7 +21,6 @@
 #include <asm/apic.h>
 #include <asm/pci-direct.h>
 #include <asm/io.h>
-#include <asm/paravirt.h>
 #include <asm/setup.h>
 
 #define TOPOLOGY_REGISTER_OFFSET 0x10
@@ -29,64 +28,7 @@
 /* Flag below is initialized once during vSMP PCI initialization. */
 static int irq_routing_comply = 1;
 
-#if defined CONFIG_PCI && defined CONFIG_PARAVIRT
-/*
- * Interrupt control on vSMPowered systems:
- * ~AC is a shadow of IF.  If IF is 'on' AC should be 'off'
- * and vice versa.
- */
-
-asmlinkage __visible unsigned long vsmp_save_fl(void)
-{
-	unsigned long flags = native_save_fl();
-
-	if (!(flags & X86_EFLAGS_IF) || (flags & X86_EFLAGS_AC))
-		flags &= ~X86_EFLAGS_IF;
-	return flags;
-}
-PV_CALLEE_SAVE_REGS_THUNK(vsmp_save_fl);
-
-__visible void vsmp_restore_fl(unsigned long flags)
-{
-	if (flags & X86_EFLAGS_IF)
-		flags &= ~X86_EFLAGS_AC;
-	else
-		flags |= X86_EFLAGS_AC;
-	native_restore_fl(flags);
-}
-PV_CALLEE_SAVE_REGS_THUNK(vsmp_restore_fl);
-
-asmlinkage __visible void vsmp_irq_disable(void)
-{
-	unsigned long flags = native_save_fl();
-
-	native_restore_fl((flags & ~X86_EFLAGS_IF) | X86_EFLAGS_AC);
-}
-PV_CALLEE_SAVE_REGS_THUNK(vsmp_irq_disable);
-
-asmlinkage __visible void vsmp_irq_enable(void)
-{
-	unsigned long flags = native_save_fl();
-
-	native_restore_fl((flags | X86_EFLAGS_IF) & (~X86_EFLAGS_AC));
-}
-PV_CALLEE_SAVE_REGS_THUNK(vsmp_irq_enable);
-
-static unsigned __init vsmp_patch(u8 type, u16 clobbers, void *ibuf,
-				  unsigned long addr, unsigned len)
-{
-	switch (type) {
-	case PARAVIRT_PATCH(pv_irq_ops.irq_enable):
-	case PARAVIRT_PATCH(pv_irq_ops.irq_disable):
-	case PARAVIRT_PATCH(pv_irq_ops.save_fl):
-	case PARAVIRT_PATCH(pv_irq_ops.restore_fl):
-		return paravirt_patch_default(type, clobbers, ibuf, addr, len);
-	default:
-		return native_patch(type, clobbers, ibuf, addr, len);
-	}
-
-}
-
+#if defined CONFIG_PCI
 static void __init set_vsmp_pv_ops(void)
 {
 	void __iomem *address;
@@ -115,15 +57,6 @@ static void __init set_vsmp_pv_ops(void)
 	}
 #endif
 
-	if (cap & ctl & (1 << 4)) {
-		/* Setup irq ops and turn on vSMP  IRQ fastpath handling */
-		pv_irq_ops.irq_disable = PV_CALLEE_SAVE(vsmp_irq_disable);
-		pv_irq_ops.irq_enable  = PV_CALLEE_SAVE(vsmp_irq_enable);
-		pv_irq_ops.save_fl  = PV_CALLEE_SAVE(vsmp_save_fl);
-		pv_irq_ops.restore_fl  = PV_CALLEE_SAVE(vsmp_restore_fl);
-		pv_init_ops.patch = vsmp_patch;
-		ctl &= ~(1 << 4);
-	}
 	writel(ctl, address + 4);
 	ctl = readl(address + 4);
 	pr_info("vSMP CTL: control set to:0x%08x\n", ctl);
-- 
2.12.3

[toc] | [prev] | [next] | [standalone]


#1708734 — RE: [PATCH 3/3] x86/vsmp: remove vsmp paravirt support

From"Shai Fultheim (Shai@ScaleMP.com)" <Shai@ScaleMP.com>
Date2017-08-10 17:30 +0200
SubjectRE: [PATCH 3/3] x86/vsmp: remove vsmp paravirt support
Message-ID<ucXzk-7tV-27@gated-at.bofh.it>
In reply to#1708602
NACK.  This is needed and used by thousands of installations.


________________________________________________________
Shai Fultheim | M +1 (408) 480-1612 | E Shai@ScaleMP.com

This email message and any attachments to it are ScaleMP confidential information.

-----Original Message-----
From: Ingo Molnar [mailto:mingo.kernel.org@gmail.com] On Behalf Of Juergen Gross
Sent: Thursday, August 10, 2017 15:53
To: linux-kernel@vger.kernel.org; xen-devel@lists.xenproject.org; x86@kernel.org
Cc: hpa@zytor.com; mingo@redhat.com; tglx@linutronix.de; boris.ostrovsky@oracle.com; rusty@rustcorp.com.au; lguest@lists.ozlabs.org; Juergen Gross <jgross@suse.com>
Subject: [PATCH 3/3] x86/vsmp: remove vsmp paravirt support

vSMP has seen its last functional patch more than 3 years ago. It is
not clear whether the vSMP paravirtualized irq functions are still
needed.

Remove them as they seem to be optional and their existence is blocking
some simplification work of paravirt infrastructure.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/Kconfig          |  1 -
 arch/x86/kernel/vsmp_64.c | 69 +----------------------------------------------
 2 files changed, 1 insertion(+), 69 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 3fac2570a2e1..13a3d8744ae4 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -495,7 +495,6 @@ config X86_NUMACHIP
 config X86_VSMP
 	bool "ScaleMP vSMP"
 	select HYPERVISOR_GUEST
-	select PARAVIRT
 	depends on X86_64 && PCI
 	depends on X86_EXTENDED_PLATFORM
 	depends on SMP
diff --git a/arch/x86/kernel/vsmp_64.c b/arch/x86/kernel/vsmp_64.c
index b034b1b14b9c..5d392b809ee4 100644
--- a/arch/x86/kernel/vsmp_64.c
+++ b/arch/x86/kernel/vsmp_64.c
@@ -21,7 +21,6 @@
 #include <asm/apic.h>
 #include <asm/pci-direct.h>
 #include <asm/io.h>
-#include <asm/paravirt.h>
 #include <asm/setup.h>
 
 #define TOPOLOGY_REGISTER_OFFSET 0x10
@@ -29,64 +28,7 @@
 /* Flag below is initialized once during vSMP PCI initialization. */
 static int irq_routing_comply = 1;
 
-#if defined CONFIG_PCI && defined CONFIG_PARAVIRT
-/*
- * Interrupt control on vSMPowered systems:
- * ~AC is a shadow of IF.  If IF is 'on' AC should be 'off'
- * and vice versa.
- */
-
-asmlinkage __visible unsigned long vsmp_save_fl(void)
-{
-	unsigned long flags = native_save_fl();
-
-	if (!(flags & X86_EFLAGS_IF) || (flags & X86_EFLAGS_AC))
-		flags &= ~X86_EFLAGS_IF;
-	return flags;
-}
-PV_CALLEE_SAVE_REGS_THUNK(vsmp_save_fl);
-
-__visible void vsmp_restore_fl(unsigned long flags)
-{
-	if (flags & X86_EFLAGS_IF)
-		flags &= ~X86_EFLAGS_AC;
-	else
-		flags |= X86_EFLAGS_AC;
-	native_restore_fl(flags);
-}
-PV_CALLEE_SAVE_REGS_THUNK(vsmp_restore_fl);
-
-asmlinkage __visible void vsmp_irq_disable(void)
-{
-	unsigned long flags = native_save_fl();
-
-	native_restore_fl((flags & ~X86_EFLAGS_IF) | X86_EFLAGS_AC);
-}
-PV_CALLEE_SAVE_REGS_THUNK(vsmp_irq_disable);
-
-asmlinkage __visible void vsmp_irq_enable(void)
-{
-	unsigned long flags = native_save_fl();
-
-	native_restore_fl((flags | X86_EFLAGS_IF) & (~X86_EFLAGS_AC));
-}
-PV_CALLEE_SAVE_REGS_THUNK(vsmp_irq_enable);
-
-static unsigned __init vsmp_patch(u8 type, u16 clobbers, void *ibuf,
-				  unsigned long addr, unsigned len)
-{
-	switch (type) {
-	case PARAVIRT_PATCH(pv_irq_ops.irq_enable):
-	case PARAVIRT_PATCH(pv_irq_ops.irq_disable):
-	case PARAVIRT_PATCH(pv_irq_ops.save_fl):
-	case PARAVIRT_PATCH(pv_irq_ops.restore_fl):
-		return paravirt_patch_default(type, clobbers, ibuf, addr, len);
-	default:
-		return native_patch(type, clobbers, ibuf, addr, len);
-	}
-
-}
-
+#if defined CONFIG_PCI
 static void __init set_vsmp_pv_ops(void)
 {
 	void __iomem *address;
@@ -115,15 +57,6 @@ static void __init set_vsmp_pv_ops(void)
 	}
 #endif
 
-	if (cap & ctl & (1 << 4)) {
-		/* Setup irq ops and turn on vSMP  IRQ fastpath handling */
-		pv_irq_ops.irq_disable = PV_CALLEE_SAVE(vsmp_irq_disable);
-		pv_irq_ops.irq_enable  = PV_CALLEE_SAVE(vsmp_irq_enable);
-		pv_irq_ops.save_fl  = PV_CALLEE_SAVE(vsmp_save_fl);
-		pv_irq_ops.restore_fl  = PV_CALLEE_SAVE(vsmp_restore_fl);
-		pv_init_ops.patch = vsmp_patch;
-		ctl &= ~(1 << 4);
-	}
 	writel(ctl, address + 4);
 	ctl = readl(address + 4);
 	pr_info("vSMP CTL: control set to:0x%08x\n", ctl);
-- 
2.12.3

[toc] | [prev] | [next] | [standalone]


#1708743 — Re: [PATCH 3/3] x86/vsmp: remove vsmp paravirt support

FromJuergen Gross <jgross@suse.com>
Date2017-08-10 17:40 +0200
SubjectRe: [PATCH 3/3] x86/vsmp: remove vsmp paravirt support
Message-ID<ucXJ1-7xc-45@gated-at.bofh.it>
In reply to#1708734
On 10/08/17 17:28, Shai Fultheim (Shai@ScaleMP.com) wrote:
> NACK.  This is needed and used by thousands of installations.

Okay, thanks for reacting so fast. Will drop the patch.


Juergen

> 
> 
> ________________________________________________________
> Shai Fultheim | M +1 (408) 480-1612 | E Shai@ScaleMP.com
> 
> This email message and any attachments to it are ScaleMP confidential information.
> 
> -----Original Message-----
> From: Ingo Molnar [mailto:mingo.kernel.org@gmail.com] On Behalf Of Juergen Gross
> Sent: Thursday, August 10, 2017 15:53
> To: linux-kernel@vger.kernel.org; xen-devel@lists.xenproject.org; x86@kernel.org
> Cc: hpa@zytor.com; mingo@redhat.com; tglx@linutronix.de; boris.ostrovsky@oracle.com; rusty@rustcorp.com.au; lguest@lists.ozlabs.org; Juergen Gross <jgross@suse.com>
> Subject: [PATCH 3/3] x86/vsmp: remove vsmp paravirt support
> 
> vSMP has seen its last functional patch more than 3 years ago. It is
> not clear whether the vSMP paravirtualized irq functions are still
> needed.
> 
> Remove them as they seem to be optional and their existence is blocking
> some simplification work of paravirt infrastructure.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
>  arch/x86/Kconfig          |  1 -
>  arch/x86/kernel/vsmp_64.c | 69 +----------------------------------------------
>  2 files changed, 1 insertion(+), 69 deletions(-)
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 3fac2570a2e1..13a3d8744ae4 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -495,7 +495,6 @@ config X86_NUMACHIP
>  config X86_VSMP
>  	bool "ScaleMP vSMP"
>  	select HYPERVISOR_GUEST
> -	select PARAVIRT
>  	depends on X86_64 && PCI
>  	depends on X86_EXTENDED_PLATFORM
>  	depends on SMP
> diff --git a/arch/x86/kernel/vsmp_64.c b/arch/x86/kernel/vsmp_64.c
> index b034b1b14b9c..5d392b809ee4 100644
> --- a/arch/x86/kernel/vsmp_64.c
> +++ b/arch/x86/kernel/vsmp_64.c
> @@ -21,7 +21,6 @@
>  #include <asm/apic.h>
>  #include <asm/pci-direct.h>
>  #include <asm/io.h>
> -#include <asm/paravirt.h>
>  #include <asm/setup.h>
>  
>  #define TOPOLOGY_REGISTER_OFFSET 0x10
> @@ -29,64 +28,7 @@
>  /* Flag below is initialized once during vSMP PCI initialization. */
>  static int irq_routing_comply = 1;
>  
> -#if defined CONFIG_PCI && defined CONFIG_PARAVIRT
> -/*
> - * Interrupt control on vSMPowered systems:
> - * ~AC is a shadow of IF.  If IF is 'on' AC should be 'off'
> - * and vice versa.
> - */
> -
> -asmlinkage __visible unsigned long vsmp_save_fl(void)
> -{
> -	unsigned long flags = native_save_fl();
> -
> -	if (!(flags & X86_EFLAGS_IF) || (flags & X86_EFLAGS_AC))
> -		flags &= ~X86_EFLAGS_IF;
> -	return flags;
> -}
> -PV_CALLEE_SAVE_REGS_THUNK(vsmp_save_fl);
> -
> -__visible void vsmp_restore_fl(unsigned long flags)
> -{
> -	if (flags & X86_EFLAGS_IF)
> -		flags &= ~X86_EFLAGS_AC;
> -	else
> -		flags |= X86_EFLAGS_AC;
> -	native_restore_fl(flags);
> -}
> -PV_CALLEE_SAVE_REGS_THUNK(vsmp_restore_fl);
> -
> -asmlinkage __visible void vsmp_irq_disable(void)
> -{
> -	unsigned long flags = native_save_fl();
> -
> -	native_restore_fl((flags & ~X86_EFLAGS_IF) | X86_EFLAGS_AC);
> -}
> -PV_CALLEE_SAVE_REGS_THUNK(vsmp_irq_disable);
> -
> -asmlinkage __visible void vsmp_irq_enable(void)
> -{
> -	unsigned long flags = native_save_fl();
> -
> -	native_restore_fl((flags | X86_EFLAGS_IF) & (~X86_EFLAGS_AC));
> -}
> -PV_CALLEE_SAVE_REGS_THUNK(vsmp_irq_enable);
> -
> -static unsigned __init vsmp_patch(u8 type, u16 clobbers, void *ibuf,
> -				  unsigned long addr, unsigned len)
> -{
> -	switch (type) {
> -	case PARAVIRT_PATCH(pv_irq_ops.irq_enable):
> -	case PARAVIRT_PATCH(pv_irq_ops.irq_disable):
> -	case PARAVIRT_PATCH(pv_irq_ops.save_fl):
> -	case PARAVIRT_PATCH(pv_irq_ops.restore_fl):
> -		return paravirt_patch_default(type, clobbers, ibuf, addr, len);
> -	default:
> -		return native_patch(type, clobbers, ibuf, addr, len);
> -	}
> -
> -}
> -
> +#if defined CONFIG_PCI
>  static void __init set_vsmp_pv_ops(void)
>  {
>  	void __iomem *address;
> @@ -115,15 +57,6 @@ static void __init set_vsmp_pv_ops(void)
>  	}
>  #endif
>  
> -	if (cap & ctl & (1 << 4)) {
> -		/* Setup irq ops and turn on vSMP  IRQ fastpath handling */
> -		pv_irq_ops.irq_disable = PV_CALLEE_SAVE(vsmp_irq_disable);
> -		pv_irq_ops.irq_enable  = PV_CALLEE_SAVE(vsmp_irq_enable);
> -		pv_irq_ops.save_fl  = PV_CALLEE_SAVE(vsmp_save_fl);
> -		pv_irq_ops.restore_fl  = PV_CALLEE_SAVE(vsmp_restore_fl);
> -		pv_init_ops.patch = vsmp_patch;
> -		ctl &= ~(1 << 4);
> -	}
>  	writel(ctl, address + 4);
>  	ctl = readl(address + 4);
>  	pr_info("vSMP CTL: control set to:0x%08x\n", ctl);
> 

[toc] | [prev] | [next] | [standalone]


#1708606 — [PATCH 1/3] paravirt,xen: remove xen_patch()

FromJuergen Gross <jgross@suse.com>
Date2017-08-10 15:00 +0200
Subject[PATCH 1/3] paravirt,xen: remove xen_patch()
Message-ID<ucVec-5GH-49@gated-at.bofh.it>
In reply to#1708597
Xen's paravirt patch function xen_patch() does some special casing for
irq_ops functions to apply relocations when those functions can be
patched inline instead of calls.

Unfortunately none of the special case function replacements is small
enough to be patches inline, so the special case never applies.

As xen_patch() will call paravirt_patch_default() in all cases it can
be just dropped.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/xen/enlighten_pv.c | 59 +--------------------------------------------
 1 file changed, 1 insertion(+), 58 deletions(-)

diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
index 811e4ddb3f37..98491521bb43 100644
--- a/arch/x86/xen/enlighten_pv.c
+++ b/arch/x86/xen/enlighten_pv.c
@@ -981,59 +981,6 @@ void __ref xen_setup_vcpu_info_placement(void)
 	}
 }
 
-static unsigned xen_patch(u8 type, u16 clobbers, void *insnbuf,
-			  unsigned long addr, unsigned len)
-{
-	char *start, *end, *reloc;
-	unsigned ret;
-
-	start = end = reloc = NULL;
-
-#define SITE(op, x)							\
-	case PARAVIRT_PATCH(op.x):					\
-	if (xen_have_vcpu_info_placement) {				\
-		start = (char *)xen_##x##_direct;			\
-		end = xen_##x##_direct_end;				\
-		reloc = xen_##x##_direct_reloc;				\
-	}								\
-	goto patch_site
-
-	switch (type) {
-		SITE(pv_irq_ops, irq_enable);
-		SITE(pv_irq_ops, irq_disable);
-		SITE(pv_irq_ops, save_fl);
-		SITE(pv_irq_ops, restore_fl);
-#undef SITE
-
-	patch_site:
-		if (start == NULL || (end-start) > len)
-			goto default_patch;
-
-		ret = paravirt_patch_insns(insnbuf, len, start, end);
-
-		/* Note: because reloc is assigned from something that
-		   appears to be an array, gcc assumes it's non-null,
-		   but doesn't know its relationship with start and
-		   end. */
-		if (reloc > start && reloc < end) {
-			int reloc_off = reloc - start;
-			long *relocp = (long *)(insnbuf + reloc_off);
-			long delta = start - (char *)addr;
-
-			*relocp += delta;
-		}
-		break;
-
-	default_patch:
-	default:
-		ret = paravirt_patch_default(type, clobbers, insnbuf,
-					     addr, len);
-		break;
-	}
-
-	return ret;
-}
-
 static const struct pv_info xen_info __initconst = {
 	.shared_kernel_pmd = 0,
 
@@ -1043,10 +990,6 @@ static const struct pv_info xen_info __initconst = {
 	.name = "Xen",
 };
 
-static const struct pv_init_ops xen_init_ops __initconst = {
-	.patch = xen_patch,
-};
-
 static const struct pv_cpu_ops xen_cpu_ops __initconst = {
 	.cpuid = xen_cpuid,
 
@@ -1244,7 +1187,7 @@ asmlinkage __visible void __init xen_start_kernel(void)
 
 	/* Install Xen paravirt ops */
 	pv_info = xen_info;
-	pv_init_ops = xen_init_ops;
+	pv_init_ops.patch = paravirt_patch_default;
 	pv_cpu_ops = xen_cpu_ops;
 
 	x86_platform.get_nmi_reason = xen_get_nmi_reason;
-- 
2.12.3

[toc] | [prev] | [next] | [standalone]


#1708809 — Re: [PATCH 1/3] paravirt,xen: remove xen_patch()

FromPeter Zijlstra <peterz@infradead.org>
Date2017-08-10 18:30 +0200
SubjectRe: [PATCH 1/3] paravirt,xen: remove xen_patch()
Message-ID<ucYvn-83r-1@gated-at.bofh.it>
In reply to#1708606
On Thu, Aug 10, 2017 at 06:24:53PM +0200, Peter Zijlstra wrote:
> -ENTRY(xen_irq_enable_direct)
> -	FRAME_BEGIN
> -	/* Unmask events */
> -	movb $0, PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_mask
> -
> -	/*
> -	 * Preempt here doesn't matter because that will deal with any
> -	 * pending interrupts.  The pending check may end up being run
> -	 * on the wrong CPU, but that doesn't hurt.
> -	 */
> -
> -	/* Test for pending */
> -	testb $0xff, PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_pending
> -	jz 1f
> -
> -2:	call check_events
> -1:
> -ENDPATCH(xen_irq_enable_direct)
> -	FRAME_END
> -	ret
> -	ENDPROC(xen_irq_enable_direct)
> -	RELOC(xen_irq_enable_direct, 2b+1)

Oh my bad, part of that is still used.

arch/x86/xen/enlighten_pv.c:            pv_irq_ops.irq_enable = __PV_IS_CALLEE_SAVE(xen_irq_enable_direct);

It just needs cleanups for the ENDPATCH and such.

[toc] | [prev] | [next] | [standalone]


#1708919 — Re: [PATCH 1/3] paravirt,xen: remove xen_patch()

FromJuergen Gross <jgross@suse.com>
Date2017-08-10 19:40 +0200
SubjectRe: [PATCH 1/3] paravirt,xen: remove xen_patch()
Message-ID<ucZB8-fd-21@gated-at.bofh.it>
In reply to#1708809
On 10/08/17 18:29, Peter Zijlstra wrote:
> On Thu, Aug 10, 2017 at 06:24:53PM +0200, Peter Zijlstra wrote:
>> -ENTRY(xen_irq_enable_direct)
>> -	FRAME_BEGIN
>> -	/* Unmask events */
>> -	movb $0, PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_mask
>> -
>> -	/*
>> -	 * Preempt here doesn't matter because that will deal with any
>> -	 * pending interrupts.  The pending check may end up being run
>> -	 * on the wrong CPU, but that doesn't hurt.
>> -	 */
>> -
>> -	/* Test for pending */
>> -	testb $0xff, PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_pending
>> -	jz 1f
>> -
>> -2:	call check_events
>> -1:
>> -ENDPATCH(xen_irq_enable_direct)
>> -	FRAME_END
>> -	ret
>> -	ENDPROC(xen_irq_enable_direct)
>> -	RELOC(xen_irq_enable_direct, 2b+1)
> 
> Oh my bad, part of that is still used.
> 
> arch/x86/xen/enlighten_pv.c:            pv_irq_ops.irq_enable = __PV_IS_CALLEE_SAVE(xen_irq_enable_direct);
> 
> It just needs cleanups for the ENDPATCH and such.

Ah yes, of course.


Juergen

[toc] | [prev] | [next] | [standalone]


#1708812 — Re: [PATCH 1/3] paravirt,xen: remove xen_patch()

FromJosh Poimboeuf <jpoimboe@redhat.com>
Date2017-08-10 18:30 +0200
SubjectRe: [PATCH 1/3] paravirt,xen: remove xen_patch()
Message-ID<ucYvn-83r-11@gated-at.bofh.it>
In reply to#1708606
On Thu, Aug 10, 2017 at 02:52:52PM +0200, Juergen Gross wrote:
> Xen's paravirt patch function xen_patch() does some special casing for
> irq_ops functions to apply relocations when those functions can be
> patched inline instead of calls.
> 
> Unfortunately none of the special case function replacements is small
> enough to be patches inline, so the special case never applies.
> 
> As xen_patch() will call paravirt_patch_default() in all cases it can
> be just dropped.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Can the ENDPATCH and RELOC macros can also be removed, along with their
usages in xen-asm.S and xen-asm_64.S?

-- 
Josh

[toc] | [prev] | [next] | [standalone]


#1708821 — Re: [PATCH 1/3] paravirt,xen: remove xen_patch()

FromPeter Zijlstra <peterz@infradead.org>
Date2017-08-10 18:30 +0200
SubjectRe: [PATCH 1/3] paravirt,xen: remove xen_patch()
Message-ID<ucYvn-83r-3@gated-at.bofh.it>
In reply to#1708606
On Thu, Aug 10, 2017 at 02:52:52PM +0200, Juergen Gross wrote:
> Xen's paravirt patch function xen_patch() does some special casing for
> irq_ops functions to apply relocations when those functions can be
> patched inline instead of calls.
> 
> Unfortunately none of the special case function replacements is small
> enough to be patches inline, so the special case never applies.
> 
> As xen_patch() will call paravirt_patch_default() in all cases it can
> be just dropped.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
>  arch/x86/xen/enlighten_pv.c | 59 +--------------------------------------------
>  1 file changed, 1 insertion(+), 58 deletions(-)

> -		SITE(pv_irq_ops, irq_enable);
> -		SITE(pv_irq_ops, irq_disable);
> -		SITE(pv_irq_ops, save_fl);
> -		SITE(pv_irq_ops, restore_fl);

You forgot to remove the actual ASM that's then never used either.


 arch/x86/xen/Makefile  |   2 +-
 arch/x86/xen/xen-asm.S | 150 -------------------------------------------------
 arch/x86/xen/xen-ops.h |  12 ----
 3 files changed, 1 insertion(+), 163 deletions(-)

diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile
index bced7a369a11..551e12ba2a7b 100644
--- a/arch/x86/xen/Makefile
+++ b/arch/x86/xen/Makefile
@@ -14,7 +14,7 @@ CFLAGS_enlighten_pv.o		:= $(nostackp)
 CFLAGS_mmu_pv.o		:= $(nostackp)
 
 obj-y		:= enlighten.o multicalls.o mmu.o irq.o \
-			time.o xen-asm.o xen-asm_$(BITS).o \
+			time.o xen-asm_$(BITS).o \
 			grant-table.o suspend.o platform-pci-unplug.o
 
 obj-$(CONFIG_XEN_PVHVM)		+= enlighten_hvm.o mmu_hvm.o suspend_hvm.o
diff --git a/arch/x86/xen/xen-asm.S b/arch/x86/xen/xen-asm.S
deleted file mode 100644
index eff224df813f..000000000000
--- a/arch/x86/xen/xen-asm.S
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Asm versions of Xen pv-ops, suitable for either direct use or
- * inlining.  The inline versions are the same as the direct-use
- * versions, with the pre- and post-amble chopped off.
- *
- * This code is encoded for size rather than absolute efficiency, with
- * a view to being able to inline as much as possible.
- *
- * We only bother with direct forms (ie, vcpu in percpu data) of the
- * operations here; the indirect forms are better handled in C, since
- * they're generally too large to inline anyway.
- */
-
-#include <asm/asm-offsets.h>
-#include <asm/percpu.h>
-#include <asm/processor-flags.h>
-#include <asm/frame.h>
-
-#include "xen-asm.h"
-
-/*
- * Enable events.  This clears the event mask and tests the pending
- * event status with one and operation.  If there are pending events,
- * then enter the hypervisor to get them handled.
- */
-ENTRY(xen_irq_enable_direct)
-	FRAME_BEGIN
-	/* Unmask events */
-	movb $0, PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_mask
-
-	/*
-	 * Preempt here doesn't matter because that will deal with any
-	 * pending interrupts.  The pending check may end up being run
-	 * on the wrong CPU, but that doesn't hurt.
-	 */
-
-	/* Test for pending */
-	testb $0xff, PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_pending
-	jz 1f
-
-2:	call check_events
-1:
-ENDPATCH(xen_irq_enable_direct)
-	FRAME_END
-	ret
-	ENDPROC(xen_irq_enable_direct)
-	RELOC(xen_irq_enable_direct, 2b+1)
-
-
-/*
- * Disabling events is simply a matter of making the event mask
- * non-zero.
- */
-ENTRY(xen_irq_disable_direct)
-	movb $1, PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_mask
-ENDPATCH(xen_irq_disable_direct)
-	ret
-	ENDPROC(xen_irq_disable_direct)
-	RELOC(xen_irq_disable_direct, 0)
-
-/*
- * (xen_)save_fl is used to get the current interrupt enable status.
- * Callers expect the status to be in X86_EFLAGS_IF, and other bits
- * may be set in the return value.  We take advantage of this by
- * making sure that X86_EFLAGS_IF has the right value (and other bits
- * in that byte are 0), but other bits in the return value are
- * undefined.  We need to toggle the state of the bit, because Xen and
- * x86 use opposite senses (mask vs enable).
- */
-ENTRY(xen_save_fl_direct)
-	testb $0xff, PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_mask
-	setz %ah
-	addb %ah, %ah
-ENDPATCH(xen_save_fl_direct)
-	ret
-	ENDPROC(xen_save_fl_direct)
-	RELOC(xen_save_fl_direct, 0)
-
-
-/*
- * In principle the caller should be passing us a value return from
- * xen_save_fl_direct, but for robustness sake we test only the
- * X86_EFLAGS_IF flag rather than the whole byte. After setting the
- * interrupt mask state, it checks for unmasked pending events and
- * enters the hypervisor to get them delivered if so.
- */
-ENTRY(xen_restore_fl_direct)
-	FRAME_BEGIN
-#ifdef CONFIG_X86_64
-	testw $X86_EFLAGS_IF, %di
-#else
-	testb $X86_EFLAGS_IF>>8, %ah
-#endif
-	setz PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_mask
-	/*
-	 * Preempt here doesn't matter because that will deal with any
-	 * pending interrupts.  The pending check may end up being run
-	 * on the wrong CPU, but that doesn't hurt.
-	 */
-
-	/* check for unmasked and pending */
-	cmpw $0x0001, PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_pending
-	jnz 1f
-2:	call check_events
-1:
-ENDPATCH(xen_restore_fl_direct)
-	FRAME_END
-	ret
-	ENDPROC(xen_restore_fl_direct)
-	RELOC(xen_restore_fl_direct, 2b+1)
-
-
-/*
- * Force an event check by making a hypercall, but preserve regs
- * before making the call.
- */
-ENTRY(check_events)
-	FRAME_BEGIN
-#ifdef CONFIG_X86_32
-	push %eax
-	push %ecx
-	push %edx
-	call xen_force_evtchn_callback
-	pop %edx
-	pop %ecx
-	pop %eax
-#else
-	push %rax
-	push %rcx
-	push %rdx
-	push %rsi
-	push %rdi
-	push %r8
-	push %r9
-	push %r10
-	push %r11
-	call xen_force_evtchn_callback
-	pop %r11
-	pop %r10
-	pop %r9
-	pop %r8
-	pop %rdi
-	pop %rsi
-	pop %rdx
-	pop %rcx
-	pop %rax
-#endif
-	FRAME_END
-	ret
-ENDPROC(check_events)
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index 0d5004477db6..7b54fd7e9915 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -129,18 +129,6 @@ static inline void __init xen_efi_init(void)
 }
 #endif
 
-/* Declare an asm function, along with symbols needed to make it
-   inlineable */
-#define DECL_ASM(ret, name, ...)		\
-	__visible ret name(__VA_ARGS__);	\
-	extern char name##_end[] __visible;	\
-	extern char name##_reloc[] __visible
-
-DECL_ASM(void, xen_irq_enable_direct, void);
-DECL_ASM(void, xen_irq_disable_direct, void);
-DECL_ASM(unsigned long, xen_save_fl_direct, void);
-DECL_ASM(void, xen_restore_fl_direct, unsigned long);
-
 /* These are not functions, and cannot be called normally */
 __visible void xen_iret(void);
 __visible void xen_sysret32(void);

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web