Skip to contentSkip to conversation

x86/pv-shim: Avoid a command line parameter warning for CONFIG_PV_SHIM_EXCLUSIVE builds

PATCH In review Andrew Cooper 2 participants 6 messages Jan 29, 2019 – Jan 30, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/pv-shim: Avoid a command line parameter warning for CONFIG_PV_SHIM_EXCLUSIVE builds

When booting a guest using "pvshim=1" in the VM configuration file, libxl's default command line is "pv-shim console=xen,pv".

With a CONFIG_PV_SHIM_EXCLUSIVE hypervisor, the boolean_param() is compiled out, resulting in a command line parsing warning:

(d8) [ 1556.334664] (XEN) parameter "pv-shim" unknown!

Avoid the warning by including a second boolean_param() for "pv-shim" which writes into a unused variable.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Juergen Gross <[email protected]>

---
 xen/arch/x86/pv/shim.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
xen/arch/x86/pv/shim.c +5 -1
index 636a9d6..c45885a 100644
@@ -40,7 +40,11 @@
 #undef virt_to_mfn
 #define virt_to_mfn(va) _mfn(__virt_to_mfn(va))
 
-#ifndef CONFIG_PV_SHIM_EXCLUSIVE
+#ifdef CONFIG_PV_SHIM_EXCLUSIVE
+/* Tolerate "pv-shim" being passed to a CONFIG_PV_SHIM_EXCLUSIVE hypervisor. */
+static bool _discard;
+boolean_param("pv-shim", _discard);
+#else
 bool pv_shim;
 boolean_param("pv-shim", pv_shim);
 #endif
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 29.01.19 at 20:07, <[email protected]> wrote:
xen/arch/x86/pv/shim.c +0 -0
@@ -40,7 +40,11 @@
 #undef virt_to_mfn
 #define virt_to_mfn(va) _mfn(__virt_to_mfn(va))

xen/arch/x86/pv/shim.c line 50

Quoted 10 lines
xen/arch/x86/pv/shim.c +5 -1
 
-#ifndef CONFIG_PV_SHIM_EXCLUSIVE
+#ifdef CONFIG_PV_SHIM_EXCLUSIVE
+/* Tolerate "pv-shim" being passed to a CONFIG_PV_SHIM_EXCLUSIVE hypervisor. */
+static bool _discard;
+boolean_param("pv-shim", _discard);
+#else
 bool pv_shim;
 boolean_param("pv-shim", pv_shim);
 #endif

It would end up being less extra code if you did

#ifdef CONFIG_PV_SHIM_EXCLUSIVE
/* Tolerate "pv-shim" being passed to a CONFIG_PV_SHIM_EXCLUSIVE hypervisor. */ static bool __initdata pv_shim;
#else
bool pv_shim;
#endif
boolean_param("pv-shim", pv_shim);

But at the very least the __initdata wants adding. Preferably in the suggested form

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
Quoted 18 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 29.01.19 at 20:07, <[email protected]> wrote:
xen/arch/x86/pv/shim.c +0 -0
@@ -40,7 +40,11 @@
 #undef virt_to_mfn
 #define virt_to_mfn(va) _mfn(__virt_to_mfn(va))

xen/arch/x86/pv/shim.c line 50

Quoted 10 lines
xen/arch/x86/pv/shim.c +5 -1
 
-#ifndef CONFIG_PV_SHIM_EXCLUSIVE
+#ifdef CONFIG_PV_SHIM_EXCLUSIVE
+/* Tolerate "pv-shim" being passed to a CONFIG_PV_SHIM_EXCLUSIVE hypervisor. */
+static bool _discard;
+boolean_param("pv-shim", _discard);
+#else
 bool pv_shim;
 boolean_param("pv-shim", pv_shim);
 #endif

It would end up being less extra code if you did

Quoted 7 lines

#ifdef CONFIG_PV_SHIM_EXCLUSIVE
/* Tolerate "pv-shim" being passed to a CONFIG_PV_SHIM_EXCLUSIVE hypervisor. */ static bool __initdata pv_shim;
#else
bool pv_shim;
#endif
boolean_param("pv-shim", pv_shim);

Sadly not.  In the EXCLUSIVE case, pv_shim is defined to be 1, and then you've got an object named with just a number.  (I tried this approach first.)

I can't think of any cleaner solution.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
Quoted 28 lines
Quoted 1 line
Quoted 1 line · On 30.01.19 at 11:01, <[email protected]> wrote:
Quoted 18 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 29.01.19 at 20:07, <[email protected]> wrote:
xen/arch/x86/pv/shim.c +0 -0
@@ -40,7 +40,11 @@
 #undef virt_to_mfn
 #define virt_to_mfn(va) _mfn(__virt_to_mfn(va))

xen/arch/x86/pv/shim.c line 50

Quoted 10 lines
xen/arch/x86/pv/shim.c +5 -1
 
-#ifndef CONFIG_PV_SHIM_EXCLUSIVE
+#ifdef CONFIG_PV_SHIM_EXCLUSIVE
+/* Tolerate "pv-shim" being passed to a CONFIG_PV_SHIM_EXCLUSIVE hypervisor. */
+static bool _discard;
+boolean_param("pv-shim", _discard);
+#else
 bool pv_shim;
 boolean_param("pv-shim", pv_shim);
 #endif

It would end up being less extra code if you did

Quoted 7 lines

#ifdef CONFIG_PV_SHIM_EXCLUSIVE
/* Tolerate "pv-shim" being passed to a CONFIG_PV_SHIM_EXCLUSIVE hypervisor. */ static bool __initdata pv_shim;
#else
bool pv_shim;
#endif
boolean_param("pv-shim", pv_shim);

Quoted 3 lines

Sadly not. In the EXCLUSIVE case, pv_shim is defined to be 1, and then you've got an object named with just a number. (I tried this approach first.)

Oh, that's unfortunate in this particular case. In which case I don't have any better suggestion either. One that you and others perhaps wouldn't like would be

custom_param("pv-shim", NULL);

with parse_params() suitably adjusted to avoid the call in that case.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw
In reply to Andrew Cooper
Quoted 26 lines · Andrew Cooper
Quoted 18 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 29.01.19 at 20:07, <[email protected]> wrote:
xen/arch/x86/pv/shim.c +0 -0
@@ -40,7 +40,11 @@
 #undef virt_to_mfn
 #define virt_to_mfn(va) _mfn(__virt_to_mfn(va))

xen/arch/x86/pv/shim.c line 50

Quoted 10 lines
xen/arch/x86/pv/shim.c +5 -1
 
-#ifndef CONFIG_PV_SHIM_EXCLUSIVE
+#ifdef CONFIG_PV_SHIM_EXCLUSIVE
+/* Tolerate "pv-shim" being passed to a CONFIG_PV_SHIM_EXCLUSIVE hypervisor. */
+static bool _discard;
+boolean_param("pv-shim", _discard);
+#else
 bool pv_shim;
 boolean_param("pv-shim", pv_shim);
 #endif

It would end up being less extra code if you did

Quoted 7 lines

#ifdef CONFIG_PV_SHIM_EXCLUSIVE
/* Tolerate "pv-shim" being passed to a CONFIG_PV_SHIM_EXCLUSIVE hypervisor. */ static bool __initdata pv_shim;
#else
bool pv_shim;
#endif
boolean_param("pv-shim", pv_shim);

Quoted 5 lines

Sadly not.  In the EXCLUSIVE case, pv_shim is defined to be 1, and then you've got an object named with just a number.  (I tried this approach first.)

I can't think of any cleaner solution.

Actually, I could move this to the bottom of the file, and just undef pv_shim.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#5 lore raw
Quoted 28 lines
Quoted 1 line
Quoted 1 line · On 30.01.19 at 11:07, <[email protected]> wrote:
Quoted 26 lines · Andrew Cooper
Quoted 25 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 29.01.19 at 20:07, <[email protected]> wrote:
xen/arch/x86/pv/shim.c +0 -0
@@ -40,7 +40,11 @@
 #undef virt_to_mfn
 #define virt_to_mfn(va) _mfn(__virt_to_mfn(va))

xen/arch/x86/pv/shim.c line 50

Quoted 10 lines
xen/arch/x86/pv/shim.c +5 -1
 
-#ifndef CONFIG_PV_SHIM_EXCLUSIVE
+#ifdef CONFIG_PV_SHIM_EXCLUSIVE
+/* Tolerate "pv-shim" being passed to a CONFIG_PV_SHIM_EXCLUSIVE hypervisor. */
+static bool _discard;
+boolean_param("pv-shim", _discard);
+#else
 bool pv_shim;
 boolean_param("pv-shim", pv_shim);
 #endif

It would end up being less extra code if you did

#ifdef CONFIG_PV_SHIM_EXCLUSIVE
/* Tolerate "pv-shim" being passed to a CONFIG_PV_SHIM_EXCLUSIVE hypervisor. */ static bool __initdata pv_shim;
#else
bool pv_shim;
#endif
boolean_param("pv-shim", pv_shim);

Quoted 8 lines
Quoted 5 lines

Sadly not. In the EXCLUSIVE case, pv_shim is defined to be 1, and then you've got an object named with just a number. (I tried this approach first.)

I can't think of any cleaner solution.

Actually, I could move this to the bottom of the file, and just undef pv_shim.

Ah, yes. Fine with me (i.e. feel free to keep my ack then).

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel