Skip to contentSkip to conversation

Make hvm_fep available to non-debug build

PATCH Superseded Wei Liu 3 participants 17 messages Jun 17, 2016 – Jun 20, 2016

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

v2 cover Make hvm_fep available to non-debug build

Wei Liu (2):
xen/kernel: document 'C' in print_tainted
xen: make available hvm_fep to non-debug build as well

 docs/misc/xen-command-line.markdown |  8 ++++++--
 xen/arch/x86/Kconfig                | 14 ++++++++++++++
 xen/arch/x86/hvm/hvm.c              | 28 ++++++++++++++++++++++++++--
 xen/common/kernel.c                 |  7 +++++--
 xen/include/asm-x86/hvm/hvm.h       |  2 +-
 xen/include/xen/lib.h               |  1 +
 6 files changed, 53 insertions(+), 7 deletions(-)
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
author
#1 lore raw

PATCH v2 1/2 xen/kernel: document 'C' in print_tainted

---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>

---
 xen/common/kernel.c | 1 +
 1 file changed, 1 insertion(+)
xen/common/kernel.c +1 -0
index 1a6823a..dae7e35 100644
@@ -174,6 +174,7 @@ int __init parse_bool(const char *s)
  *  'S' - SMP with CPUs not designed for SMP.
  *  'M' - Machine had a machine check experience.
  *  'B' - System has hit bad_page.
+ *  'C' - Console output is synchronous.
  *
  *      The string is overwritten by the next call to print_taint().
  */
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
author
#2 lore raw

PATCH v2 2/2 xen: make available hvm_fep to non-debug build as well

In reply to Wei Liu

Originally hvm_fep was guarded by NDEBUG, which means it was only available to debug builds.

However there is value to have it for non-debug builds as well. User can use that to run tests in setup that replicates production setup.

Make it clear with a sync_console style warning that this option can't be used in production setup. Update command line documentation accordingly. Finally mark Xen as tainted when this option is enabled.

Add a kconfig option under x86 to configure hvm_fep.

---
Cc: Andrew Cooper <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Doug Goldstein <[email protected]>

v2:
1. unsigned -> unsigned int
2. %d -> %u
3. Add spaces around "-"
4. Update warning message
5. Only taint hv when fep is used
6. Add kconfig option

---
 docs/misc/xen-command-line.markdown |  8 ++++++--
 xen/arch/x86/Kconfig                | 14 ++++++++++++++
 xen/arch/x86/hvm/hvm.c              | 28 ++++++++++++++++++++++++++--
 xen/common/kernel.c                 |  6 ++++--
 xen/include/asm-x86/hvm/hvm.h       |  2 +-
 xen/include/xen/lib.h               |  1 +
 6 files changed, 52 insertions(+), 7 deletions(-)
docs/misc/xen-command-line.markdown +6 -2
index fed732c..dc53e24 100644
@@ -878,8 +878,12 @@ Recognized in debug builds of the hypervisor only.
 Allow use of the Forced Emulation Prefix in HVM guests, to allow emulation of
 arbitrary instructions.
 
-This option is intended for development purposes, and is only available in
-debug builds of the hypervisor.
+This option is intended for development and testing purposes.
+
+*Warning*
+As this feature opens up the instruction emulator to HVM guest, don't
+use this in production system. No security support is provided when
+this flag is set.
 
 ### hvm\_port80
 > `= <boolean>`
xen/arch/x86/Kconfig +14 -0
index 73f79cc..5e3b04a 100644
@@ -59,6 +59,20 @@ config BIGMEM
 
 	  If unsure, say N.
 
+config HVM_FEP
+	bool "HVM Forced Emulation Prefix support"
+	default y
+	---help---
+
+	  Compiles in a feature that allows HVM guest to enter
+	  instruction emulator with forced emulation prefix.
+
+	  This feature can only be enabled during boot time with
+	  appropriate hypervisor command line option. Please read
+	  hypervisor command line documentation before trying to use
+	  this feature.
+
+	  If unsure, say Y.
 endmenu
 
 source "common/Kconfig"
xen/arch/x86/hvm/hvm.c +26 -2
index 78db903..373b78e 100644
@@ -37,6 +37,7 @@
 #include <xen/mem_access.h>
 #include <xen/rangeset.h>
 #include <xen/vm_event.h>
+#include <xen/delay.h>
 #include <asm/shadow.h>
 #include <asm/hap.h>
 #include <asm/current.h>
@@ -95,9 +96,9 @@ unsigned long __section(".bss.page_aligned")
 static bool_t __initdata opt_hap_enabled = 1;
 boolean_param("hap", opt_hap_enabled);
 
-#ifndef opt_hvm_fep
+#if CONFIG_HVM_FEP
 /* Permit use of the Forced Emulation Prefix in HVM guests */
-bool_t opt_hvm_fep;
+bool_t __read_mostly opt_hvm_fep;
 boolean_param("hvm_fep", opt_hvm_fep);
 #endif
 
@@ -182,6 +183,28 @@ static int __init hvm_enable(void)
     if ( !opt_altp2m_enabled )
         hvm_funcs.altp2m_supported = 0;
 
+    if ( opt_hvm_fep )
+    {
+        unsigned int i, j;
+
+        printk("**********************************************\n");
+        printk("******* WARNING: HVM FORCED EMULATION PREFIX IS AVAILABLE\n");
+        printk("******* This option is *ONLY* intended to aid testing of Xen.\n");
+        printk("******* It has implications on the security of the system.\n");
+        printk("******* Please *DO NOT* use this in production.\n");
+        printk("**********************************************\n");
+        for ( i = 0; i < 3; i++ )
+        {
+            printk("%u... ", 3 - i);
+            for ( j = 0; j < 100; j++ )
+            {
+                process_pending_softirqs();
+                mdelay(10);
+            }
+        }
+        printk("\n");
+    }
+
     /*
      * Allow direct access to the PC debug ports 0x80 and 0xed (they are
      * often used for I/O delays, but the vmexits simply slow things down).
@@ -3905,6 +3928,7 @@ void hvm_ud_intercept(struct cpu_user_regs *regs)
         {
             regs->eip += sizeof(sig);
             regs->eflags &= ~X86_EFLAGS_RF;
+            add_taint(TAINT_HVM_FEP);
         }
     }
 
xen/common/kernel.c +4 -2
index dae7e35..5bf77aa 100644
@@ -175,6 +175,7 @@ int __init parse_bool(const char *s)
  *  'M' - Machine had a machine check experience.
  *  'B' - System has hit bad_page.
  *  'C' - Console output is synchronous.
+ *  'H' - HVM forced emulation prefix is permitted.
  *
  *      The string is overwritten by the next call to print_taint().
  */
@@ -182,11 +183,12 @@ char *print_tainted(char *str)
 {
     if ( tainted )
     {
-        snprintf(str, TAINT_STRING_MAX_LEN, "Tainted: %c%c%c%c",
+        snprintf(str, TAINT_STRING_MAX_LEN, "Tainted: %c%c%c%c%c",
                  tainted & TAINT_UNSAFE_SMP ? 'S' : ' ',
                  tainted & TAINT_MACHINE_CHECK ? 'M' : ' ',
                  tainted & TAINT_BAD_PAGE ? 'B' : ' ',
-                 tainted & TAINT_SYNC_CONSOLE ? 'C' : ' ');
+                 tainted & TAINT_SYNC_CONSOLE ? 'C' : ' ',
+                 tainted & TAINT_HVM_FEP ? 'H' : ' ');
     }
     else
     {
xen/include/asm-x86/hvm/hvm.h +1 -1
index f486ee9..d2e0ae5 100644
@@ -27,7 +27,7 @@
 #include <public/hvm/save.h>
 #include <xen/mm.h>
 
-#ifndef NDEBUG
+#if CONFIG_HVM_FEP
 /* Permit use of the Forced Emulation Prefix in HVM guests */
 extern bool_t opt_hvm_fep;
 #else
xen/include/xen/lib.h +1 -0
index 1c652bb..b1b0fb2 100644
@@ -142,6 +142,7 @@ uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);
 #define TAINT_BAD_PAGE                  (1<<2)
 #define TAINT_SYNC_CONSOLE              (1<<3)
 #define TAINT_ERROR_INJECT              (1<<4)
+#define TAINT_HVM_FEP                   (1<<5)
 extern int tainted;
 #define TAINT_STRING_MAX_LEN            20
 extern char *print_tainted(char *str);
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#3 lore raw

Re: [PATCH v2 2/2] xen: make available hvm_fep to non-debug build as well

xen/arch/x86/Kconfig config BIGMEM · line 63

Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 13:05, <[email protected]> wrote:
xen/arch/x86/Kconfig +2 -0
@@ -59,6 +59,20 @@ config BIGMEM
 
 	  If unsure, say N.
 
+config HVM_FEP
+	bool "HVM Forced Emulation Prefix support"

And no "if EXPERT"?

xen/arch/x86/Kconfig unsigned long __section(".bss.page_aligned") · line 99

Quoted 6 lines
xen/arch/x86/Kconfig +1 -1
@@ -95,9 +96,9 @@ unsigned long __section(".bss.page_aligned")
 static bool_t __initdata opt_hap_enabled = 1;
 boolean_param("hap", opt_hap_enabled);
 
-#ifndef opt_hvm_fep
+#if CONFIG_HVM_FEP

#ifdef please. And I think this would better be left alone anyway (and then the comment only applies to the other instance).

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#4 lore raw

Re: [PATCH v2 2/2] xen: make available hvm_fep to non-debug build as well

Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 13:05, <[email protected]> wrote:
xen/arch/x86/Kconfig +0 -0
@@ -59,6 +59,20 @@ config BIGMEM
 
Quoted 7 lines

xen/arch/x86/Kconfig config BIGMEM · line 63

Quoted 4 lines
xen/arch/x86/Kconfig +2 -0
 	  If unsure, say N.
 
+config HVM_FEP
+	bool "HVM Forced Emulation Prefix support"

And no "if EXPERT"?

Done.

Quoted 10 lines

xen/arch/x86/Kconfig unsigned long __section(".bss.page_aligned") · line 99

Quoted 6 lines
xen/arch/x86/Kconfig +1 -1
@@ -95,9 +96,9 @@ unsigned long __section(".bss.page_aligned")
 static bool_t __initdata opt_hap_enabled = 1;
 boolean_param("hap", opt_hap_enabled);
 
-#ifndef opt_hvm_fep
+#if CONFIG_HVM_FEP

#ifdef please. And I think this would better be left alone anyway (and then the comment only applies to the other instance).

Change this instance back to what is was and fix the other.

Wei.

Quoted 2 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#12 lore raw

Re: [PATCH v2 2/2] xen: make available hvm_fep to non-debug build as well

In reply to Wei Liu
Quoted 39 lines · Wei Liu

Originally hvm_fep was guarded by NDEBUG, which means it was only available to debug builds.

However there is value to have it for non-debug builds as well. User can use that to run tests in setup that replicates production setup.

Make it clear with a sync_console style warning that this option can't be used in production setup. Update command line documentation accordingly. Finally mark Xen as tainted when this option is enabled.

Add a kconfig option under x86 to configure hvm_fep.

---
Cc: Andrew Cooper <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Doug Goldstein <[email protected]>

v2:
1. unsigned -> unsigned int
2. %d -> %u
3. Add spaces around "-"
4. Update warning message
5. Only taint hv when fep is used
6. Add kconfig option

---
 docs/misc/xen-command-line.markdown |  8 ++++++--
 xen/arch/x86/Kconfig                | 14 ++++++++++++++
 xen/arch/x86/hvm/hvm.c              | 28 ++++++++++++++++++++++++++--
 xen/common/kernel.c                 |  6 ++++--
 xen/include/asm-x86/hvm/hvm.h       |  2 +-
 xen/include/xen/lib.h               |  1 +
 6 files changed, 52 insertions(+), 7 deletions(-)
docs/misc/xen-command-line.markdown +0 -0
index fed732c..dc53e24 100644

docs/misc/xen-command-line.markdown Recognized in debug builds of the hypervisor only. · line 884

Quoted 9 lines
docs/misc/xen-command-line.markdown +4 -2
@@ -878,8 +878,12 @@ Recognized in debug builds of the hypervisor only.
 Allow use of the Forced Emulation Prefix in HVM guests, to allow emulation of
 arbitrary instructions.
 
-This option is intended for development purposes, and is only available in
-debug builds of the hypervisor.
+This option is intended for development and testing purposes.
+
+*Warning*
+As this feature opens up the instruction emulator to HVM guest, don't

"to arbitrary instruction from an HVM guest,". It is an important distinction, because all guest can enter the emulator in other ways as part of normal operation.

Quoted 10 lines
docs/misc/xen-command-line.markdown +2 -0
+use this in production system. No security support is provided when
+this flag is set.
 
 ### hvm\_port80
 > `= <boolean>`
xen/arch/x86/Kconfig +0 -0
index 73f79cc..5e3b04a 100644

xen/arch/x86/Kconfig config BIGMEM · line 68

Quoted 10 lines
xen/arch/x86/Kconfig +7 -0
@@ -59,6 +59,20 @@ config BIGMEM
 
 	  If unsure, say N.
 
+config HVM_FEP
+	bool "HVM Forced Emulation Prefix support"
+	default y
+	---help---
+
+	  Compiles in a feature that allows HVM guest to enter
+	  instruction emulator with forced emulation prefix.

"allows HVM guests to arbitrarily exercise the instruction emulator." There are other ways in which guests can enter the instruction emulator, but they are specifically limited in nature.

I would also have a separate paragraph stating:

"This is strictly for testing purposes, and not appropriate for use in production."

Quoted 47 lines
xen/arch/x86/Kconfig +7 -0
+
+	  This feature can only be enabled during boot time with
+	  appropriate hypervisor command line option. Please read
+	  hypervisor command line documentation before trying to use
+	  this feature.
+
+	  If unsure, say Y.
 endmenu
 
 source "common/Kconfig"
xen/arch/x86/hvm/hvm.c +12 -2
index 78db903..373b78e 100644
@@ -37,6 +37,7 @@
 #include <xen/mem_access.h>
 #include <xen/rangeset.h>
 #include <xen/vm_event.h>
+#include <xen/delay.h>
 #include <asm/shadow.h>
 #include <asm/hap.h>
 #include <asm/current.h>
@@ -95,9 +96,9 @@ unsigned long __section(".bss.page_aligned")
 static bool_t __initdata opt_hap_enabled = 1;
 boolean_param("hap", opt_hap_enabled);
 
-#ifndef opt_hvm_fep
+#if CONFIG_HVM_FEP
 /* Permit use of the Forced Emulation Prefix in HVM guests */
-bool_t opt_hvm_fep;
+bool_t __read_mostly opt_hvm_fep;
 boolean_param("hvm_fep", opt_hvm_fep);
 #endif
 
@@ -182,6 +183,28 @@ static int __init hvm_enable(void)
     if ( !opt_altp2m_enabled )
         hvm_funcs.altp2m_supported = 0;
 
+    if ( opt_hvm_fep )
+    {
+        unsigned int i, j;
+
+        printk("**********************************************\n");
+        printk("******* WARNING: HVM FORCED EMULATION PREFIX IS AVAILABLE\n");
+        printk("******* This option is *ONLY* intended to aid testing of Xen.\n");
+        printk("******* It has implications on the security of the system.\n");
+        printk("******* Please *DO NOT* use this in production.\n");

xen/arch/x86/hvm/hvm.c static int __init hvm_enable(void) · line 204

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +10 -0
+        printk("**********************************************\n");
+        for ( i = 0; i < 3; i++ )
+        {
+            printk("%u... ", 3 - i);
+            for ( j = 0; j < 100; j++ )
+            {
+                process_pending_softirqs();
+                mdelay(10);
+            }
+        }

I would drop this 3s wait, and I plan to drop it from sync_console as well. It isn't of any practical use, even if you are watching the serial console on boot, and just leads to an unnecessary delay. Worse, the two delays are cumulative.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#5 lore raw

Re: [PATCH v2 2/2] xen: make available hvm_fep to non-debug build as well

In reply to Jan Beulich
Quoted 10 lines · Jan Beulich

xen/arch/x86/Kconfig config BIGMEM · line 63

Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 13:05, <[email protected]> wrote:
xen/arch/x86/Kconfig +2 -0
@@ -59,6 +59,20 @@ config BIGMEM
 
 	  If unsure, say N.
 
+config HVM_FEP
+	bool "HVM Forced Emulation Prefix support"

And no "if EXPERT"?

Is that wise? Does that mean we get a default on option which can't be selected in menuconfig?

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#6 lore raw

Re: [PATCH v2 2/2] xen: make available hvm_fep to non-debug build as well

Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 15:51, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 13:05, <[email protected]> wrote:
xen/arch/x86/Kconfig +0 -0
@@ -59,6 +59,20 @@ config BIGMEM
 
Quoted 8 lines
Quoted 5 lines

xen/arch/x86/Kconfig config BIGMEM · line 63

Quoted 4 lines
xen/arch/x86/Kconfig +2 -0
 	  If unsure, say N.
 
+config HVM_FEP
+	bool "HVM Forced Emulation Prefix support"

And no "if EXPERT"?

Is that wise? Does that mean we get a default on option which can't be selected in menuconfig?

Oh, that's true. The default should be off in any event.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#7 lore raw

Re: [PATCH v2 2/2] xen: make available hvm_fep to non-debug build as well

Quoted 9 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 15:51, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 13:05, <[email protected]> wrote:
xen/arch/x86/Kconfig +0 -0
@@ -59,6 +59,20 @@ config BIGMEM
 
 	  If unsure, say N.
 
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

xen/arch/x86/Kconfig config BIGMEM · line 63

Quoted 2 lines
xen/arch/x86/Kconfig +2 -0
+config HVM_FEP
+	bool "HVM Forced Emulation Prefix support"

And no "if EXPERT"?

Is that wise? Does that mean we get a default on option which can't be selected in menuconfig?

Oh, that's true. The default should be off in any event.

So it depends on config EXPERT, defaults to off.

Fine by me in any event, just need a final decision and I will make the change.

Wei.

Quoted 2 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#8 lore raw

Re: [PATCH v2 2/2] xen: make available hvm_fep to non-debug build as well

Quoted 18 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 16:32, <[email protected]> wrote:
Quoted 16 lines · Jan Beulich
Quoted 15 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 15:51, <[email protected]> wrote:
Quoted 10 lines · Jan Beulich

xen/arch/x86/Kconfig config BIGMEM · line 63

Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 13:05, <[email protected]> wrote:
xen/arch/x86/Kconfig +2 -0
@@ -59,6 +59,20 @@ config BIGMEM
 
 	  If unsure, say N.
 
+config HVM_FEP
+	bool "HVM Forced Emulation Prefix support"

And no "if EXPERT"?

Is that wise? Does that mean we get a default on option which can't be selected in menuconfig?

Quoted 7 lines
Quoted 2 lines

Oh, that's true. The default should be off in any event.

So it depends on config EXPERT, defaults to off.

Fine by me in any event, just need a final decision and I will make the change.

One more adjustment: I guess it should default to DEBUG, to retain current behavior.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#9 lore raw

Re: [PATCH v2 2/2] xen: make available hvm_fep to non-debug build as well

Quoted 21 lines · Jan Beulich
Quoted 21 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 16:32, <[email protected]> wrote:
Quoted 18 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 15:51, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 13:05, <[email protected]> wrote:
xen/arch/x86/Kconfig +0 -0
@@ -59,6 +59,20 @@ config BIGMEM
 
Quoted 8 lines
Quoted 5 lines

xen/arch/x86/Kconfig config BIGMEM · line 63

Quoted 4 lines
xen/arch/x86/Kconfig +2 -0
 	  If unsure, say N.
 
+config HVM_FEP
+	bool "HVM Forced Emulation Prefix support"

And no "if EXPERT"?

Is that wise? Does that mean we get a default on option which can't be selected in menuconfig?

Oh, that's true. The default should be off in any event.

Quoted 8 lines
Quoted 4 lines

So it depends on config EXPERT, defaults to off.

Fine by me in any event, just need a final decision and I will make the change.

One more adjustment: I guess it should default to DEBUG, to retain current behavior.

I think I wrote this series to make this feature available to non-debug builds. I don't really get the rationale behind this request. Did you change your mind during the last few days?

Wei.

Quoted 2 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#13 lore raw

Re: [PATCH v2 2/2] xen: make available hvm_fep to non-debug build as well

In reply to Andrew Cooper
Quoted 22 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 15:50, <[email protected]> wrote:
Quoted 20 lines · Wei Liu
xen/arch/x86/hvm/hvm.c +16 -0
@@ -182,6 +183,28 @@ static int __init hvm_enable(void)
     if ( !opt_altp2m_enabled )
         hvm_funcs.altp2m_supported = 0;
 
+    if ( opt_hvm_fep )
+    {
+        unsigned int i, j;
+
+        printk("**********************************************\n");
+        printk("******* WARNING: HVM FORCED EMULATION PREFIX IS AVAILABLE\n");
+        printk("******* This option is *ONLY* intended to aid testing of Xen.\n");
+        printk("******* It has implications on the security of the system.\n");
+        printk("******* Please *DO NOT* use this in production.\n");
+        printk("**********************************************\n");
+        for ( i = 0; i < 3; i++ )
+        {
+            printk("%u... ", 3 - i);
+            for ( j = 0; j < 100; j++ )
+            {
+                process_pending_softirqs();
Quoted 8 lines

xen/arch/x86/hvm/hvm.c static int __init hvm_enable(void) · line 204

Quoted 3 lines
xen/arch/x86/hvm/hvm.c +3 -0
+                mdelay(10);
+            }
+        }

I would drop this 3s wait, and I plan to drop it from sync_console as well. It isn't of any practical use, even if you are watching the serial console on boot, and just leads to an unnecessary delay. Worse, the two delays are cumulative.

I think the delay serves a purpose (for the messages to not scroll by unnoticed), but I do appreciate that having two such delays is not really desirable. Considering that I would also like these messages to go into .init.rodata (also those for the sync_console warning), perhaps worth a little bit of abstraction?

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#10 lore raw

Re: [PATCH v2 2/2] xen: make available hvm_fep to non-debug build as well

In reply to Wei Liu
Quoted 28 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 16:44, <[email protected]> wrote:
Quoted 26 lines · Jan Beulich
Quoted 25 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 16:32, <[email protected]> wrote:
Quoted 9 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 15:51, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 13:05, <[email protected]> wrote:
xen/arch/x86/Kconfig +0 -0
@@ -59,6 +59,20 @@ config BIGMEM
 
 	  If unsure, say N.
 
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

xen/arch/x86/Kconfig config BIGMEM · line 63

Quoted 2 lines
xen/arch/x86/Kconfig +2 -0
+config HVM_FEP
+	bool "HVM Forced Emulation Prefix support"

And no "if EXPERT"?

Is that wise? Does that mean we get a default on option which can't be selected in menuconfig?

Oh, that's true. The default should be off in any event.

So it depends on config EXPERT, defaults to off.

Fine by me in any event, just need a final decision and I will make the change.

Quoted 7 lines
Quoted 3 lines

One more adjustment: I guess it should default to DEBUG, to retain current behavior.

I think I wrote this series to make this feature available to non-debug builds. I don't really get the rationale behind this request. Did you change your mind during the last few days?

Making it available doesn't mean enable it by default for everyone. People wanting it in non-debug builds should be able to get it, but unaware people shouldn't be caught by surprise. (And btw., defaulting it to DEBUG is a relaxation over defaulting it to off.)

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#11 lore raw

Re: [PATCH v2 2/2] xen: make available hvm_fep to non-debug build as well

Quoted 32 lines · Jan Beulich
Quoted 32 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 16:44, <[email protected]> wrote:
Quoted 29 lines · Jan Beulich
Quoted 18 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 16:32, <[email protected]> wrote:
Quoted 16 lines · Jan Beulich
Quoted 15 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 15:51, <[email protected]> wrote:
Quoted 10 lines · Jan Beulich

xen/arch/x86/Kconfig config BIGMEM · line 63

Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 13:05, <[email protected]> wrote:
xen/arch/x86/Kconfig +2 -0
@@ -59,6 +59,20 @@ config BIGMEM
 
 	  If unsure, say N.
 
+config HVM_FEP
+	bool "HVM Forced Emulation Prefix support"

And no "if EXPERT"?

Is that wise? Does that mean we get a default on option which can't be selected in menuconfig?

Quoted 7 lines
Quoted 2 lines

Oh, that's true. The default should be off in any event.

So it depends on config EXPERT, defaults to off.

Fine by me in any event, just need a final decision and I will make the change.

One more adjustment: I guess it should default to DEBUG, to retain current behavior.

Quoted 9 lines
Quoted 3 lines

I think I wrote this series to make this feature available to non-debug builds. I don't really get the rationale behind this request. Did you change your mind during the last few days?

Making it available doesn't mean enable it by default for everyone. People wanting it in non-debug builds should be able to get it, but unaware people shouldn't be caught by surprise. (And btw., defaulting it to DEBUG is a relaxation over defaulting it to off.)

I see. I misread as "it should depend on DEBUG". Sorry about that.

I will make the change as requested.

Wei.

Quoted 2 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#14 lore raw

Re: [PATCH v2 2/2] xen: make available hvm_fep to non-debug build as well

In reply to Jan Beulich
Quoted 31 lines · Jan Beulich
Quoted 22 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 15:50, <[email protected]> wrote:
Quoted 20 lines · Wei Liu
xen/arch/x86/hvm/hvm.c +16 -0
@@ -182,6 +183,28 @@ static int __init hvm_enable(void)
     if ( !opt_altp2m_enabled )
         hvm_funcs.altp2m_supported = 0;
 
+    if ( opt_hvm_fep )
+    {
+        unsigned int i, j;
+
+        printk("**********************************************\n");
+        printk("******* WARNING: HVM FORCED EMULATION PREFIX IS AVAILABLE\n");
+        printk("******* This option is *ONLY* intended to aid testing of Xen.\n");
+        printk("******* It has implications on the security of the system.\n");
+        printk("******* Please *DO NOT* use this in production.\n");
+        printk("**********************************************\n");
+        for ( i = 0; i < 3; i++ )
+        {
+            printk("%u... ", 3 - i);
+            for ( j = 0; j < 100; j++ )
+            {
+                process_pending_softirqs();
Quoted 8 lines

xen/arch/x86/hvm/hvm.c static int __init hvm_enable(void) · line 204

Quoted 3 lines
xen/arch/x86/hvm/hvm.c +3 -0
+                mdelay(10);
+            }
+        }

I would drop this 3s wait, and I plan to drop it from sync_console as well. It isn't of any practical use, even if you are watching the serial console on boot, and just leads to an unnecessary delay. Worse, the two delays are cumulative.

Quoted 6 lines

I think the delay serves a purpose (for the messages to not scroll by unnoticed), but I do appreciate that having two such delays is not really desirable. Considering that I would also like these messages to go into .init.rodata (also those for the sync_console warning), perhaps worth a little bit of abstraction?

What is the plan here?

Should I keep or remove the delay? Do you want me to refactor things?

Wei.

Quoted 2 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#15 lore raw

Re: [PATCH v2 2/2] xen: make available hvm_fep to non-debug build as well

Quoted 36 lines
Quoted 1 line
Quoted 1 line · On 20.06.16 at 11:09, <[email protected]> wrote:
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 15:50, <[email protected]> wrote:
Quoted 4 lines · Wei Liu
xen/arch/x86/hvm/hvm.c +0 -0
@@ -182,6 +183,28 @@ static int __init hvm_enable(void)
     if ( !opt_altp2m_enabled )
         hvm_funcs.altp2m_supported = 0;
 
Quoted 6 lines
Quoted 6 lines

xen/arch/x86/hvm/hvm.c static int __init hvm_enable(void)

Quoted 6 lines
xen/arch/x86/hvm/hvm.c +6 -0
+    if ( opt_hvm_fep )
+    {
+        unsigned int i, j;
+
+        printk("**********************************************\n");
+        printk("******* WARNING: HVM FORCED EMULATION PREFIX IS 

AVAILABLE\n");

Quoted 1 line
Quoted 1 line

Review static int __init hvm_enable(void) · line 192

Quoted 1 line
(quoted diff) +1 -0
+        printk("******* This option is *ONLY* intended to aid testing of 

Xen.\n");

Quoted 1 line
Quoted 1 line

Review static int __init hvm_enable(void) · line 193

Quoted 1 line
(quoted diff) +1 -0
+        printk("******* It has implications on the security of the 

system.\n");

Quoted 17 lines
Quoted 16 lines

xen/arch/x86/hvm/hvm.c static int __init hvm_enable(void) · line 204

Quoted 11 lines
xen/arch/x86/hvm/hvm.c +11 -0
+        printk("******* Please *DO NOT* use this in production.\n");
+        printk("**********************************************\n");
+        for ( i = 0; i < 3; i++ )
+        {
+            printk("%u... ", 3 - i);
+            for ( j = 0; j < 100; j++ )
+            {
+                process_pending_softirqs();
+                mdelay(10);
+            }
+        }

I would drop this 3s wait, and I plan to drop it from sync_console as well. It isn't of any practical use, even if you are watching the serial console on boot, and just leads to an unnecessary delay. Worse, the two delays are cumulative.

Quoted 7 lines
Quoted 5 lines

I think the delay serves a purpose (for the messages to not scroll by unnoticed), but I do appreciate that having two such delays is not really desirable. Considering that I would also like these messages to go into .init.rodata (also those for the sync_console warning), perhaps worth a little bit of abstraction?

What is the plan here?

I didn't see a response from Andrew yet; I continue to think some delay ought to be there.

Quoted 1 line

Should I keep or remove the delay? Do you want me to refactor things?

If you're up to some refactoring, that'd be appreciated.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#16 lore raw

Re: [PATCH v2 2/2] xen: make available hvm_fep to non-debug build as well

Quoted 42 lines · Jan Beulich
Quoted 42 lines
Quoted 1 line
Quoted 1 line · On 20.06.16 at 11:09, <[email protected]> wrote:
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 17.06.16 at 15:50, <[email protected]> wrote:
Quoted 4 lines · Wei Liu
xen/arch/x86/hvm/hvm.c +0 -0
@@ -182,6 +183,28 @@ static int __init hvm_enable(void)
     if ( !opt_altp2m_enabled )
         hvm_funcs.altp2m_supported = 0;
 
Quoted 6 lines
Quoted 6 lines

xen/arch/x86/hvm/hvm.c static int __init hvm_enable(void)

Quoted 6 lines
xen/arch/x86/hvm/hvm.c +6 -0
+    if ( opt_hvm_fep )
+    {
+        unsigned int i, j;
+
+        printk("**********************************************\n");
+        printk("******* WARNING: HVM FORCED EMULATION PREFIX IS 

AVAILABLE\n");

Quoted 1 line
Quoted 1 line

Review static int __init hvm_enable(void) · line 192

Quoted 1 line
(quoted diff) +1 -0
+        printk("******* This option is *ONLY* intended to aid testing of 

Xen.\n");

Quoted 1 line
Quoted 1 line

Review static int __init hvm_enable(void) · line 193

Quoted 1 line
(quoted diff) +1 -0
+        printk("******* It has implications on the security of the 

system.\n");

Quoted 22 lines
Quoted 12 lines

xen/arch/x86/hvm/hvm.c static int __init hvm_enable(void) · line 204

Quoted 11 lines
xen/arch/x86/hvm/hvm.c +11 -0
+        printk("******* Please *DO NOT* use this in production.\n");
+        printk("**********************************************\n");
+        for ( i = 0; i < 3; i++ )
+        {
+            printk("%u... ", 3 - i);
+            for ( j = 0; j < 100; j++ )
+            {
+                process_pending_softirqs();
+                mdelay(10);
+            }
+        }
Quoted 4 lines

I would drop this 3s wait, and I plan to drop it from sync_console as well. It isn't of any practical use, even if you are watching the serial console on boot, and just leads to an unnecessary delay. Worse, the two delays are cumulative.

I think the delay serves a purpose (for the messages to not scroll by unnoticed), but I do appreciate that having two such delays is not really desirable. Considering that I would also like these messages to go into .init.rodata (also those for the sync_console warning), perhaps worth a little bit of abstraction?

Quoted 5 lines
Quoted 1 line

What is the plan here?

I didn't see a response from Andrew yet; I continue to think some delay ought to be there.

OK. I will give Andrew a chance to reply.

Quoted 4 lines
Quoted 1 line

Should I keep or remove the delay? Do you want me to refactor things?

If you're up to some refactoring, that'd be appreciated.

Sure. I think I can factor out a "warning" infrastructure (just an array to keep track of all warning texts, a function to add text to the array and a function to print out all the added warnings).

Wei.

Quoted 2 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel