xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [Xen-devel] [PATCH 3/6] x86: Add nopv parameter to disable PV extensions
       [not found] <1561294903-6166-1-git-send-email-zhenzhong.duan@oracle.com>
@ 2019-06-23 13:01 ` Zhenzhong Duan
  2019-06-24 13:07   ` Juergen Gross
  2019-06-24 13:18   ` Juergen Gross
  2019-06-23 13:01 ` [Xen-devel] [PATCH 4/6] Revert "xen: Introduce 'xen_nopv' to disable PV extensions for HVM guests." Zhenzhong Duan
  1 sibling, 2 replies; 5+ messages in thread
From: Zhenzhong Duan @ 2019-06-23 13:01 UTC (permalink / raw)
  To: linux-kernel
  Cc: jgross, sstabellini, Zhenzhong Duan, mingo, bp, hpa, xen-devel,
	boris.ostrovsky, tglx

In virtualization environment, PV extensions (drivers, interrupts,
timers, etc) are enabled in the majority of use cases which is the
best option.

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

There is already 'xen_nopv' parameter for XEN platform but not for
others. 'xen_nopv' can then be removed with this change.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Cc: xen-devel@lists.xenproject.org
---
 Documentation/admin-guide/kernel-parameters.txt |  4 ++++
 arch/x86/kernel/cpu/hypervisor.c                | 11 +++++++++++
 2 files changed, 15 insertions(+)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 138f666..b352f36 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -5268,6 +5268,10 @@
 			improve timer resolution at the expense of processing
 			more timer interrupts.
 
+	nopv=		[X86]
+			Disables the PV optimizations forcing the guest to run
+			as generic 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/kernel/cpu/hypervisor.c b/arch/x86/kernel/cpu/hypervisor.c
index 479ca47..4f2c875 100644
--- a/arch/x86/kernel/cpu/hypervisor.c
+++ b/arch/x86/kernel/cpu/hypervisor.c
@@ -85,10 +85,21 @@ static void __init copy_array(const void *src, void *target, unsigned int size)
 			to[i] = from[i];
 }
 
+static bool nopv;
+static __init int xen_parse_nopv(char *arg)
+{
+	nopv = true;
+	return 0;
+}
+early_param("nopv", xen_parse_nopv);
+
 void __init init_hypervisor_platform(void)
 {
 	const struct hypervisor_x86 *h;
 
+	if (nopv)
+		return;
+
 	h = detect_hypervisor_vendor();
 
 	if (!h)
-- 
1.8.3.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Xen-devel] [PATCH 4/6] Revert "xen: Introduce 'xen_nopv' to disable PV extensions for HVM guests."
       [not found] <1561294903-6166-1-git-send-email-zhenzhong.duan@oracle.com>
  2019-06-23 13:01 ` [Xen-devel] [PATCH 3/6] x86: Add nopv parameter to disable PV extensions Zhenzhong Duan
@ 2019-06-23 13:01 ` Zhenzhong Duan
  1 sibling, 0 replies; 5+ messages in thread
From: Zhenzhong Duan @ 2019-06-23 13:01 UTC (permalink / raw)
  To: linux-kernel
  Cc: jgross, sstabellini, Zhenzhong Duan, mingo, bp, hpa, xen-devel,
	boris.ostrovsky, tglx

This reverts commit 8d693b911bb9c57009c24cb1772d205b84c7985c.

Instead we use an unified parameter 'nopv' for all the hypervisor
platforms.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Cc: xen-devel@lists.xenproject.org
---
 Documentation/admin-guide/kernel-parameters.txt |  4 ----
 arch/x86/xen/enlighten_hvm.c                    | 12 +-----------
 2 files changed, 1 insertion(+), 15 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index b352f36..ebb75c1 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -5251,10 +5251,6 @@
 			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_scrub_pages=	[XEN]
 			Boolean option to control scrubbing pages before giving them back
 			to Xen, for use by other domains. Can be also changed at runtime
diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c
index ac4943c..7fcb4ea 100644
--- a/arch/x86/xen/enlighten_hvm.c
+++ b/arch/x86/xen/enlighten_hvm.c
@@ -210,18 +210,8 @@ static void __init xen_hvm_guest_init(void)
 #endif
 }
 
-static bool xen_nopv;
-static __init int xen_parse_nopv(char *arg)
-{
-       xen_nopv = true;
-       return 0;
-}
-early_param("xen_nopv", xen_parse_nopv);
-
 bool __init xen_hvm_need_lapic(void)
 {
-	if (xen_nopv)
-		return false;
 	if (xen_pv_domain())
 		return false;
 	if (!xen_hvm_domain())
@@ -233,7 +223,7 @@ bool __init xen_hvm_need_lapic(void)
 
 static uint32_t __init xen_platform_hvm(void)
 {
-	if (xen_pv_domain() || xen_nopv)
+	if (xen_pv_domain())
 		return 0;
 
 	return xen_cpuid_base();
-- 
1.8.3.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Xen-devel] [PATCH 3/6] x86: Add nopv parameter to disable PV extensions
  2019-06-23 13:01 ` [Xen-devel] [PATCH 3/6] x86: Add nopv parameter to disable PV extensions Zhenzhong Duan
@ 2019-06-24 13:07   ` Juergen Gross
  2019-06-24 13:18   ` Juergen Gross
  1 sibling, 0 replies; 5+ messages in thread
From: Juergen Gross @ 2019-06-24 13:07 UTC (permalink / raw)
  To: Zhenzhong Duan, linux-kernel
  Cc: sstabellini, mingo, bp, hpa, xen-devel, boris.ostrovsky, tglx

On 23.06.19 15:01, Zhenzhong Duan wrote:
> In virtualization environment, PV extensions (drivers, interrupts,
> timers, etc) are enabled in the majority of use cases which is the
> best option.
> 
> However, in some cases (kexec not fully working, benchmarking)
> we want to disable PV extensions. As such introduce the
> 'nopv' parameter that will do it.
> 
> There is already 'xen_nopv' parameter for XEN platform but not for
> others. 'xen_nopv' can then be removed with this change.
> 
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
> Cc: xen-devel@lists.xenproject.org
> ---
>   Documentation/admin-guide/kernel-parameters.txt |  4 ++++
>   arch/x86/kernel/cpu/hypervisor.c                | 11 +++++++++++
>   2 files changed, 15 insertions(+)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 138f666..b352f36 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -5268,6 +5268,10 @@
>   			improve timer resolution at the expense of processing
>   			more timer interrupts.
>   
> +	nopv=		[X86]
> +			Disables the PV optimizations forcing the guest to run
> +			as generic 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/kernel/cpu/hypervisor.c b/arch/x86/kernel/cpu/hypervisor.c
> index 479ca47..4f2c875 100644
> --- a/arch/x86/kernel/cpu/hypervisor.c
> +++ b/arch/x86/kernel/cpu/hypervisor.c
> @@ -85,10 +85,21 @@ static void __init copy_array(const void *src, void *target, unsigned int size)
>   			to[i] = from[i];
>   }
>   
> +static bool nopv;
> +static __init int xen_parse_nopv(char *arg)

You really don't want to use the "xen_" prefix here.


Juergen

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Xen-devel] [PATCH 3/6] x86: Add nopv parameter to disable PV extensions
  2019-06-23 13:01 ` [Xen-devel] [PATCH 3/6] x86: Add nopv parameter to disable PV extensions Zhenzhong Duan
  2019-06-24 13:07   ` Juergen Gross
@ 2019-06-24 13:18   ` Juergen Gross
  2019-06-24 13:50     ` Zhenzhong Duan
  1 sibling, 1 reply; 5+ messages in thread
From: Juergen Gross @ 2019-06-24 13:18 UTC (permalink / raw)
  To: Zhenzhong Duan, linux-kernel
  Cc: sstabellini, mingo, bp, hpa, xen-devel, boris.ostrovsky, tglx

On 23.06.19 15:01, Zhenzhong Duan wrote:
> In virtualization environment, PV extensions (drivers, interrupts,
> timers, etc) are enabled in the majority of use cases which is the
> best option.
> 
> However, in some cases (kexec not fully working, benchmarking)
> we want to disable PV extensions. As such introduce the
> 'nopv' parameter that will do it.
> 
> There is already 'xen_nopv' parameter for XEN platform but not for
> others. 'xen_nopv' can then be removed with this change.
> 
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
> Cc: xen-devel@lists.xenproject.org
> ---
>   Documentation/admin-guide/kernel-parameters.txt |  4 ++++
>   arch/x86/kernel/cpu/hypervisor.c                | 11 +++++++++++
>   2 files changed, 15 insertions(+)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 138f666..b352f36 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -5268,6 +5268,10 @@
>   			improve timer resolution at the expense of processing
>   			more timer interrupts.
>   
> +	nopv=		[X86]
> +			Disables the PV optimizations forcing the guest to run
> +			as generic 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/kernel/cpu/hypervisor.c b/arch/x86/kernel/cpu/hypervisor.c
> index 479ca47..4f2c875 100644
> --- a/arch/x86/kernel/cpu/hypervisor.c
> +++ b/arch/x86/kernel/cpu/hypervisor.c
> @@ -85,10 +85,21 @@ static void __init copy_array(const void *src, void *target, unsigned int size)
>   			to[i] = from[i];
>   }
>   
> +static bool nopv;
> +static __init int xen_parse_nopv(char *arg)
> +{
> +	nopv = true;
> +	return 0;
> +}
> +early_param("nopv", xen_parse_nopv);
> +
>   void __init init_hypervisor_platform(void)
>   {
>   	const struct hypervisor_x86 *h;
>   
> +	if (nopv)
> +		return;
> +

Oh, this is no good idea.

There are guest types which just won't work without pv interfaces, like
Xen PV and Xen PVH. Letting them fail due to just a wrong command line
parameter is not nice, especially as the failure might be very hard to
track down to the issue for the user.

I guess you could add a "ignore_nopv" member to struct hypervisor_x86
set to true for the mentioned guest types and call the detect functions
only if nopv is false or ignore_nopv is true.


Juergen

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Xen-devel] [PATCH 3/6] x86: Add nopv parameter to disable PV extensions
  2019-06-24 13:18   ` Juergen Gross
@ 2019-06-24 13:50     ` Zhenzhong Duan
  0 siblings, 0 replies; 5+ messages in thread
From: Zhenzhong Duan @ 2019-06-24 13:50 UTC (permalink / raw)
  To: Juergen Gross, linux-kernel
  Cc: sstabellini, mingo, bp, hpa, xen-devel, boris.ostrovsky, tglx


On 2019/6/24 21:18, Juergen Gross wrote:
> On 23.06.19 15:01, Zhenzhong Duan wrote:
>> In virtualization environment, PV extensions (drivers, interrupts,
>> timers, etc) are enabled in the majority of use cases which is the
>> best option.
>>
>> However, in some cases (kexec not fully working, benchmarking)
>> we want to disable PV extensions. As such introduce the
>> 'nopv' parameter that will do it.
>>
>> There is already 'xen_nopv' parameter for XEN platform but not for
>> others. 'xen_nopv' can then be removed with this change.
>>
>> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
>> Cc: xen-devel@lists.xenproject.org
>> ---
>>   Documentation/admin-guide/kernel-parameters.txt |  4 ++++
>>   arch/x86/kernel/cpu/hypervisor.c                | 11 +++++++++++
>>   2 files changed, 15 insertions(+)
>>
>> diff --git a/Documentation/admin-guide/kernel-parameters.txt 
>> b/Documentation/admin-guide/kernel-parameters.txt
>> index 138f666..b352f36 100644
>> --- a/Documentation/admin-guide/kernel-parameters.txt
>> +++ b/Documentation/admin-guide/kernel-parameters.txt
>> @@ -5268,6 +5268,10 @@
>>               improve timer resolution at the expense of processing
>>               more timer interrupts.
>>   +    nopv=        [X86]
>> +            Disables the PV optimizations forcing the guest to run
>> +            as generic 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/kernel/cpu/hypervisor.c 
>> b/arch/x86/kernel/cpu/hypervisor.c
>> index 479ca47..4f2c875 100644
>> --- a/arch/x86/kernel/cpu/hypervisor.c
>> +++ b/arch/x86/kernel/cpu/hypervisor.c
>> @@ -85,10 +85,21 @@ static void __init copy_array(const void *src, 
>> void *target, unsigned int size)
>>               to[i] = from[i];
>>   }
>>   +static bool nopv;
>> +static __init int xen_parse_nopv(char *arg)
>> +{
>> +    nopv = true;
>> +    return 0;
>> +}
>> +early_param("nopv", xen_parse_nopv);
>> +
>>   void __init init_hypervisor_platform(void)
>>   {
>>       const struct hypervisor_x86 *h;
>>   +    if (nopv)
>> +        return;
>> +
>
> Oh, this is no good idea.
>
> There are guest types which just won't work without pv interfaces, like
> Xen PV and Xen PVH. Letting them fail due to just a wrong command line
> parameter is not nice, especially as the failure might be very hard to
> track down to the issue for the user.
Yes, thanks for catching.
>
> I guess you could add a "ignore_nopv" member to struct hypervisor_x86
> set to true for the mentioned guest types and call the detect functions
> only if nopv is false or ignore_nopv is true.

I think your suggestion is good, I'll rework it based on your suggestion.

Thanks

Zhenzhong


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-06-24 13:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1561294903-6166-1-git-send-email-zhenzhong.duan@oracle.com>
2019-06-23 13:01 ` [Xen-devel] [PATCH 3/6] x86: Add nopv parameter to disable PV extensions Zhenzhong Duan
2019-06-24 13:07   ` Juergen Gross
2019-06-24 13:18   ` Juergen Gross
2019-06-24 13:50     ` Zhenzhong Duan
2019-06-23 13:01 ` [Xen-devel] [PATCH 4/6] Revert "xen: Introduce 'xen_nopv' to disable PV extensions for HVM guests." Zhenzhong Duan

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).