2014-07-11 18:52:09

by Konrad Rzeszutek Wilk

[permalink] [raw]
Subject: [PATCH] xen: Introduce 'xen_nopv' to disable PV extensions for HVM guests.

From: Konrad Rzeszutek Wilk <[email protected]>

By default when CONFIG_XEN and CONFIG_XEN_PVHVM kernels are
run, they will enable the PV extensions (drivers, interrupts, timers,
etc) - which is the best option for the majority of
use cases.

However, in some cases (kexec not fully working, benchmarking)
we want to disable Xen PV extensions. As such introduce the
'xen_nopv' parameter that will do it.

Signed-off-by: Konrad Rzeszutek Wilk <[email protected]>
Reviewed-by: David Vrabel <[email protected]>
---
[v2: s/off/xen_nopv/ per Boris Ostrovsky recommendation.]
[v3: Add Reviewed-by]
---
Documentation/kernel-parameters.txt | 4 ++++
arch/x86/xen/enlighten.c | 13 +++++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index c1b9aa8..5dcfa6e 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -3691,6 +3691,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
Disables the ticketlock slowpath using Xen PV
optimizations.

+ xen_nopv [X86,XEN]
+ Disables the PV optimizations forcing the guest to run
+ as generic HVM guest with no PV drivers.
+
xirc2ps_cs= [NET,PCMCIA]
Format:
<irq>,<irq_mask>,<io>,<full_duplex>,<do_sound>,<lockup_hack>[,<irq2>[,<irq3>[,<irq4>]]]
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index ffb101e..eb82239 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1826,8 +1826,19 @@ static void __init xen_hvm_guest_init(void)
xen_hvm_init_mmu_ops();
}

+static bool xen_nopv = false;
+static __init int xen_parse_nopv(char *arg)
+{
+ xen_nopv = true;
+ return 0;
+}
+early_param("xen_nopv", xen_parse_nopv);
+
static uint32_t __init xen_hvm_platform(void)
{
+ if (xen_nopv)
+ return 0;
+
if (xen_pv_domain())
return 0;

@@ -1836,6 +1847,8 @@ static uint32_t __init xen_hvm_platform(void)

bool xen_hvm_need_lapic(void)
{
+ if (xen_nopv)
+ return false;
if (xen_pv_domain())
return false;
if (!xen_hvm_domain())
--
1.7.7.6


2014-07-11 22:52:22

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] xen: Introduce 'xen_nopv' to disable PV extensions for HVM guests.

On 07/11/2014 12:53 PM, [email protected] wrote:
>
> diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
> index c1b9aa8..5dcfa6e 100644
> --- a/Documentation/kernel-parameters.txt
> +++ b/Documentation/kernel-parameters.txt
> @@ -3691,6 +3691,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
> Disables the ticketlock slowpath using Xen PV
> optimizations.
>
> + xen_nopv [X86,XEN]
> + Disables the PV optimizations forcing the guest to run
> + as generic HVM guest with no PV drivers.
> +
> xirc2ps_cs= [NET,PCMCIA]
> Format:
> <irq>,<irq_mask>,<io>,<full_duplex>,<do_sound>,<lockup_hack>[,<irq2>[,<irq3>[,<irq4>]]]
> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
> index ffb101e..eb82239 100644
> --- a/arch/x86/xen/enlighten.c
> +++ b/arch/x86/xen/enlighten.c
> @@ -1826,8 +1826,19 @@ static void __init xen_hvm_guest_init(void)
> xen_hvm_init_mmu_ops();
> }
>
> +static bool xen_nopv = false;
> +static __init int xen_parse_nopv(char *arg)
> +{
> + xen_nopv = true;
> + return 0;
> +}
> +early_param("xen_nopv", xen_parse_nopv);
> +
> static uint32_t __init xen_hvm_platform(void)
> {
> + if (xen_nopv)
> + return 0;
> +
> if (xen_pv_domain())
> return 0;
>
> @@ -1836,6 +1847,8 @@ static uint32_t __init xen_hvm_platform(void)
>
> bool xen_hvm_need_lapic(void)
> {
> + if (xen_nopv)
> + return false;
> if (xen_pv_domain())
> return false;
> if (!xen_hvm_domain())
>

Any reason to not simply let xen_pv_domain() return false here?

Also, the latter seems a bit odd?

-hpa

2014-07-11 23:09:34

by Konrad Rzeszutek Wilk

[permalink] [raw]
Subject: Re: [PATCH] xen: Introduce 'xen_nopv' to disable PV extensions for HVM guests.


On Jul 11, 2014 6:52 PM, "H. Peter Anvin" <[email protected]> wrote:
>
> On 07/11/2014 12:53 PM, [email protected] wrote:
> >
> > diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
> > index c1b9aa8..5dcfa6e 100644
> > --- a/Documentation/kernel-parameters.txt
> > +++ b/Documentation/kernel-parameters.txt
> > @@ -3691,6 +3691,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
> >  Disables the ticketlock slowpath using Xen PV
> >  optimizations.
> > 
> > + xen_nopv [X86,XEN]
> > + Disables the PV optimizations forcing the guest to run
> > + as generic HVM guest with no PV drivers.
> > +
> >  xirc2ps_cs= [NET,PCMCIA]
> >  Format:
> >  <irq>,<irq_mask>,<io>,<full_duplex>,<do_sound>,<lockup_hack>[,<irq2>[,<irq3>[,<irq4>]]]
> > diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
> > index ffb101e..eb82239 100644
> > --- a/arch/x86/xen/enlighten.c
> > +++ b/arch/x86/xen/enlighten.c
> > @@ -1826,8 +1826,19 @@ static void __init xen_hvm_guest_init(void)
> >  xen_hvm_init_mmu_ops();
> >  }
> > 
> > +static bool xen_nopv = false;
> > +static __init int xen_parse_nopv(char *arg)
> > +{
> > +       xen_nopv = true;
> > +       return 0;
> > +}
> > +early_param("xen_nopv", xen_parse_nopv);
> > +
> >  static uint32_t __init xen_hvm_platform(void)
> >  {
> > + if (xen_nopv)
> > + return 0;
> > +
> >  if (xen_pv_domain())
> >  return 0;
> > 
> > @@ -1836,6 +1847,8 @@ static uint32_t __init xen_hvm_platform(void)
> > 
> >  bool xen_hvm_need_lapic(void)
> >  {
> > + if (xen_nopv)
> > + return false;
> >  if (xen_pv_domain())
> >  return false;
> >  if (!xen_hvm_domain())
> >
>
> Any reason to not simply let xen_pv_domain() return false here?

It does return false already.

Did you mean to collapse them together?
>
> Also, the latter seems a bit odd?
>
> -hpa
>
????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2014-07-11 23:14:14

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] xen: Introduce 'xen_nopv' to disable PV extensions for HVM guests.

On 07/11/2014 04:09 PM, Konrad Rzeszutek Wilk wrote:
>
> On Jul 11, 2014 6:52 PM, "H. Peter Anvin" <[email protected]> wrote:
>>
>> On 07/11/2014 12:53 PM, [email protected] wrote:
>>>
>>> diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
>>> index c1b9aa8..5dcfa6e 100644
>>> --- a/Documentation/kernel-parameters.txt
>>> +++ b/Documentation/kernel-parameters.txt
>>> @@ -3691,6 +3691,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
>>> Disables the ticketlock slowpath using Xen PV
>>> optimizations.
>>>
>>> + xen_nopv [X86,XEN]
>>> + Disables the PV optimizations forcing the guest to run
>>> + as generic HVM guest with no PV drivers.
>>> +
>>> xirc2ps_cs= [NET,PCMCIA]
>>> Format:
>>> <irq>,<irq_mask>,<io>,<full_duplex>,<do_sound>,<lockup_hack>[,<irq2>[,<irq3>[,<irq4>]]]
>>> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
>>> index ffb101e..eb82239 100644
>>> --- a/arch/x86/xen/enlighten.c
>>> +++ b/arch/x86/xen/enlighten.c
>>> @@ -1826,8 +1826,19 @@ static void __init xen_hvm_guest_init(void)
>>> xen_hvm_init_mmu_ops();
>>> }
>>>
>>> +static bool xen_nopv = false;
>>> +static __init int xen_parse_nopv(char *arg)
>>> +{
>>> + xen_nopv = true;
>>> + return 0;
>>> +}
>>> +early_param("xen_nopv", xen_parse_nopv);
>>> +
>>> static uint32_t __init xen_hvm_platform(void)
>>> {
>>> + if (xen_nopv)
>>> + return 0;
>>> +
>>> if (xen_pv_domain())
>>> return 0;
>>>
>>> @@ -1836,6 +1847,8 @@ static uint32_t __init xen_hvm_platform(void)
>>>
>>> bool xen_hvm_need_lapic(void)
>>> {
>>> + if (xen_nopv)
>>> + return false;
>>> if (xen_pv_domain())
>>> return false;
>>> if (!xen_hvm_domain())
>>>
>>
>> Any reason to not simply let xen_pv_domain() return false here?
>
> It does return false already.
>
> Did you mean to collapse them together?

OK, I'm confused. The description of the option makes it look like it
could disable things associated with PV domains, but it looks like it
actually disables things having to do with HVM domains...

-hpa

2014-07-11 23:31:59

by Konrad Rzeszutek Wilk

[permalink] [raw]
Subject: Re: [PATCH] xen: Introduce 'xen_nopv' to disable PV extensions for HVM guests.


On Jul 11, 2014 7:14 PM, "H. Peter Anvin" <[email protected]> wrote:
>
> On 07/11/2014 04:09 PM, Konrad Rzeszutek Wilk wrote:
> >
> > On Jul 11, 2014 6:52 PM, "H. Peter Anvin" <[email protected]> wrote:
> >>
> >> On 07/11/2014 12:53 PM, [email protected] wrote:
> >>>
> >>> diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
> >>> index c1b9aa8..5dcfa6e 100644
> >>> --- a/Documentation/kernel-parameters.txt
> >>> +++ b/Documentation/kernel-parameters.txt
> >>> @@ -3691,6 +3691,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
> >>>   Disables the ticketlock slowpath using Xen PV
> >>>   optimizations.
> >>>  
> >>> + xen_nopv [X86,XEN]
> >>> + Disables the PV optimizations forcing the guest to run
> >>> + as generic HVM guest with no PV drivers.
> >>> +
> >>>   xirc2ps_cs= [NET,PCMCIA]
> >>>   Format:
> >>>   <irq>,<irq_mask>,<io>,<full_duplex>,<do_sound>,<lockup_hack>[,<irq2>[,<irq3>[,<irq4>]]]
> >>> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
> >>> index ffb101e..eb82239 100644
> >>> --- a/arch/x86/xen/enlighten.c
> >>> +++ b/arch/x86/xen/enlighten.c
> >>> @@ -1826,8 +1826,19 @@ static void __init xen_hvm_guest_init(void)
> >>>   xen_hvm_init_mmu_ops();
> >>>   }
> >>>  
> >>> +static bool xen_nopv = false;
> >>> +static __init int xen_parse_nopv(char *arg)
> >>> +{
> >>> +       xen_nopv = true;
> >>> +       return 0;
> >>> +}
> >>> +early_param("xen_nopv", xen_parse_nopv);
> >>> +
> >>>   static uint32_t __init xen_hvm_platform(void)
> >>>   {
> >>> + if (xen_nopv)
> >>> + return 0;
> >>> +
> >>>   if (xen_pv_domain())
> >>>   return 0;
> >>>  
> >>> @@ -1836,6 +1847,8 @@ static uint32_t __init xen_hvm_platform(void)
> >>>  
> >>>   bool xen_hvm_need_lapic(void)
> >>>   {
> >>> + if (xen_nopv)
> >>> + return false;
> >>>   if (xen_pv_domain())
> >>>   return false;
> >>>   if (!xen_hvm_domain())
> >>>
> >>
> >> Any reason to not simply let xen_pv_domain() return false here?
> >
> > It does return false already.
> >
> > Did you mean to collapse them together?
>
> OK, I'm confused.  The description of the option makes it look like it
> could disable things associated with PV domains, but it looks like it
> actually disables things having to do with HVM domains...
>

Thank you for pointing that out. I will update the documentation to be more clear and specific. It is as you surmised only for HVM guest.

The a
> -hpa
>
????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?