Skip to contentSkip to conversation

x86/svm: Drop the suggestion of Long Mode Segment Limit support

PATCH In review Andrew Cooper 5 participants 6 messages Jul 23, 2018 – Jul 24, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/svm: Drop the suggestion of Long Mode Segment Limit support

Because of a bug in 2010, LMSL support didn't functioned in Xen.

c/s f2c608444 noticed but avoided fixing the issue for migration reasons. In addition to migration problems, changes to the segmentation logic for emulation would be needed before the feature could be enabled.

This feature is entirely unused by operating systems (probably owing to its semantics which only cover half the segment registers), and no one has commented on its absence from Xen. As supporting it would involve a large amount of effort, it seems better to remove the code entirely.

If someone finds a valid usecase, we can resurrecting the code and implementing the remaining parts, but I doubt anyone will.

---
CC: Jan Beulich <[email protected]>
CC: Boris Ostrovsky <[email protected]>
CC: Suravee Suthikulpanit <[email protected]>
CC: Brian Woods <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Sergey Dyasli <[email protected]>

---
 xen/arch/x86/hvm/hvm.c          |  3 ---
 xen/arch/x86/hvm/svm/svm.c      | 23 -----------------------
 xen/arch/x86/pv/emul-priv-op.c  |  2 +-
 xen/include/asm-x86/hvm/hvm.h   |  1 -
 xen/include/asm-x86/msr-index.h |  4 +---
 5 files changed, 2 insertions(+), 31 deletions(-)
xen/arch/x86/hvm/hvm.c +0 -3
index c099c61..67b99af 100644
@@ -925,9 +925,6 @@ const char *hvm_efer_valid(const struct vcpu *v, uint64_t value,
     if ( (value & EFER_SVME) && (!p->extd.svm || !nestedhvm_enabled(d)) )
         return "SVME without nested virt";
 
-    if ( (value & EFER_LMSLE) && !cpu_has_lmsl )
-        return "LMSLE without support";
-
     if ( (value & EFER_FFXSE) && !p->extd.ffxsr )
         return "FFXSE without feature";
 
xen/arch/x86/hvm/svm/svm.c +0 -23
index 8acd0d0..37f782b 100644
@@ -67,9 +67,6 @@ void svm_asm_do_resume(void);
 
 u32 svm_feature_flags;
 
-/* Indicates whether guests may use EFER.LMSLE. */
-bool_t cpu_has_lmsl;
-
 static void svm_update_guest_efer(struct vcpu *);
 
 static struct hvm_function_table svm_function_table;
@@ -1676,26 +1673,6 @@ static int _svm_cpu_up(bool bsp)
     /* Initialize core's ASID handling. */
     svm_asid_init(c);
 
-    /*
-     * Check whether EFER.LMSLE can be written.
-     * Unfortunately there's no feature bit defined for this.
-     */
-    msr_content = read_efer();
-    if ( wrmsr_safe(MSR_EFER, msr_content | EFER_LMSLE) == 0 )
-        rdmsrl(MSR_EFER, msr_content);
-    if ( msr_content & EFER_LMSLE )
-    {
-        if ( 0 && /* FIXME: Migration! */ bsp )
-            cpu_has_lmsl = 1;
-        wrmsrl(MSR_EFER, msr_content ^ EFER_LMSLE);
-    }
-    else
-    {
-        if ( cpu_has_lmsl )
-            printk(XENLOG_WARNING "Inconsistent LMSLE support across CPUs!\n");
-        cpu_has_lmsl = 0;
-    }
-
     /* Initialize OSVW bits to be used by guests */
     svm_host_osvw_init();
 
xen/arch/x86/pv/emul-priv-op.c +1 -1
index ce2ec76..84f22ae 100644
@@ -874,7 +874,7 @@ static int read_msr(unsigned int reg, uint64_t *val,
          * vendor-dependent behaviour.
          */
         if ( is_pv_32bit_domain(currd) )
-            *val &= ~(EFER_LME | EFER_LMA | EFER_LMSLE |
+            *val &= ~(EFER_LME | EFER_LMA |
                       (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL
                        ? EFER_SCE : 0));
         return X86EMUL_OKAY;
xen/include/asm-x86/hvm/hvm.h +0 -1
index 1ee273b..4f720ad 100644
@@ -236,7 +236,6 @@ struct hvm_function_table {
 
 extern struct hvm_function_table hvm_funcs;
 extern bool_t hvm_enabled;
-extern bool_t cpu_has_lmsl;
 extern s8 hvm_port80_allowed;
 
 extern const struct hvm_function_table *start_svm(void);
xen/include/asm-x86/msr-index.h +1 -3
index 94bccf7..85efaab 100644
@@ -20,7 +20,6 @@
 #define _EFER_LMA		10 /* Long mode active (read-only) */
 #define _EFER_NX		11 /* No execute enable */
 #define _EFER_SVME		12 /* AMD: SVM enable */
-#define _EFER_LMSLE		13 /* AMD: Long-mode segment limit enable */
 #define _EFER_FFXSE		14 /* AMD: Fast FXSAVE/FXRSTOR enable */
 
 #define EFER_SCE		(1<<_EFER_SCE)
@@ -28,11 +27,10 @@
 #define EFER_LMA		(1<<_EFER_LMA)
 #define EFER_NX			(1<<_EFER_NX)
 #define EFER_SVME		(1<<_EFER_SVME)
-#define EFER_LMSLE		(1<<_EFER_LMSLE)
 #define EFER_FFXSE		(1<<_EFER_FFXSE)
 
 #define EFER_KNOWN_MASK		(EFER_SCE | EFER_LME | EFER_LMA | EFER_NX | \
-				 EFER_SVME | EFER_LMSLE | EFER_FFXSE)
+				 EFER_SVME | EFER_FFXSE)
 
 /* Speculation Controls. */
 #define MSR_SPEC_CTRL			0x00000048
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 36 lines · Andrew Cooper

Because of a bug in 2010, LMSL support didn't functioned in Xen.

c/s f2c608444 noticed but avoided fixing the issue for migration reasons. In addition to migration problems, changes to the segmentation logic for emulation would be needed before the feature could be enabled.

This feature is entirely unused by operating systems (probably owing to its semantics which only cover half the segment registers), and no one has commented on its absence from Xen. As supporting it would involve a large amount of effort, it seems better to remove the code entirely.

If someone finds a valid usecase, we can resurrecting the code and implementing the remaining parts, but I doubt anyone will.

---
CC: Jan Beulich <[email protected]>
CC: Boris Ostrovsky <[email protected]>
CC: Suravee Suthikulpanit <[email protected]>
CC: Brian Woods <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Sergey Dyasli <[email protected]>

---
 xen/arch/x86/hvm/hvm.c          |  3 ---
 xen/arch/x86/hvm/svm/svm.c      | 23 -----------------------
 xen/arch/x86/pv/emul-priv-op.c  |  2 +-
 xen/include/asm-x86/hvm/hvm.h   |  1 -
 xen/include/asm-x86/msr-index.h |  4 +---
 5 files changed, 2 insertions(+), 31 deletions(-)
xen/arch/x86/hvm/hvm.c +0 -0
index c099c61..67b99af 100644

xen/arch/x86/hvm/hvm.c const char *hvm_efer_valid(const struct vcpu *v, uint64_t value, · line 930

Quoted 6 lines
xen/arch/x86/hvm/hvm.c +0 -3
@@ -925,9 +925,6 @@ const char *hvm_efer_valid(const struct vcpu *v, uint64_t value,
     if ( (value & EFER_SVME) && (!p->extd.svm || !nestedhvm_enabled(d)) )
         return "SVME without nested virt";
 
-    if ( (value & EFER_LMSLE) && !cpu_has_lmsl )
-        return "LMSLE without support";
-

So we are silently dropping the bit? Should we still warn?

-boris

xen/arch/x86/hvm/hvm.c const char *hvm_efer_valid(const struct vcpu *v, uint64_t value, · line 930

Quoted 3 lines
xen/arch/x86/hvm/hvm.c +0 -0
     if ( (value & EFER_FFXSE) && !p->extd.ffxsr )
         return "FFXSE without feature";
 

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

Reviewed-by
#2 lore raw
Quoted 40 lines · Boris Ostrovsky
Quoted 39 lines · Andrew Cooper

Because of a bug in 2010, LMSL support didn't functioned in Xen.

c/s f2c608444 noticed but avoided fixing the issue for migration reasons. In addition to migration problems, changes to the segmentation logic for emulation would be needed before the feature could be enabled.

This feature is entirely unused by operating systems (probably owing to its semantics which only cover half the segment registers), and no one has commented on its absence from Xen. As supporting it would involve a large amount of effort, it seems better to remove the code entirely.

If someone finds a valid usecase, we can resurrecting the code and implementing the remaining parts, but I doubt anyone will.

---
CC: Jan Beulich <[email protected]>
CC: Boris Ostrovsky <[email protected]>
CC: Suravee Suthikulpanit <[email protected]>
CC: Brian Woods <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Sergey Dyasli <[email protected]>

---
 xen/arch/x86/hvm/hvm.c          |  3 ---
 xen/arch/x86/hvm/svm/svm.c      | 23 -----------------------
 xen/arch/x86/pv/emul-priv-op.c  |  2 +-
 xen/include/asm-x86/hvm/hvm.h   |  1 -
 xen/include/asm-x86/msr-index.h |  4 +---
 5 files changed, 2 insertions(+), 31 deletions(-)
xen/arch/x86/hvm/hvm.c +0 -0
index c099c61..67b99af 100644
@@ -925,9 +925,6 @@ const char *hvm_efer_valid(const struct vcpu *v, uint64_t value,
     if ( (value & EFER_SVME) && (!p->extd.svm || !nestedhvm_enabled(d)) )
         return "SVME without nested virt";
 
Quoted 4 lines

xen/arch/x86/hvm/hvm.c const char *hvm_efer_valid(const struct vcpu *v, uint64_t value, · line 930

Quoted 3 lines
xen/arch/x86/hvm/hvm.c +0 -3
-    if ( (value & EFER_LMSLE) && !cpu_has_lmsl )
-        return "LMSLE without support";
-

So we are silently dropping the bit? Should we still warn?

Nevermind.

Quoted 7 lines

-boris

Quoted 3 lines
xen/arch/x86/hvm/hvm.c +0 -0
     if ( (value & EFER_FFXSE) && !p->extd.ffxsr )
         return "FFXSE without feature";
 

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

Acked-by on v1 1/1
#3 lore raw
In reply to Andrew Cooper
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 23.07.18 at 16:42, <[email protected]> wrote:

Because of a bug in 2010, LMSL support didn't functioned in Xen.

c/s f2c608444 noticed but avoided fixing the issue for migration reasons. In addition to migration problems, changes to the segmentation logic for emulation would be needed before the feature could be enabled.

This feature is entirely unused by operating systems (probably owing to its semantics which only cover half the segment registers), and no one has commented on its absence from Xen. As supporting it would involve a large amount of effort, it seems better to remove the code entirely.

Quoted 4 lines

If someone finds a valid usecase, we can resurrecting the code and implementing the remaining parts, but I doubt anyone will.

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

Reviewed-by on v1 1/1
#4 lore raw
In reply to Andrew Cooper
Quoted 11 lines · Andrew Cooper

Because of a bug in 2010, LMSL support didn't functioned in Xen.

c/s f2c608444 noticed but avoided fixing the issue for migration reasons. In addition to migration problems, changes to the segmentation logic for emulation would be needed before the feature could be enabled.

This feature is entirely unused by operating systems (probably owing to its semantics which only cover half the segment registers), and no one has commented on its absence from Xen. As supporting it would involve a large amount of effort, it seems better to remove the code entirely.

Quoted 4 lines

If someone finds a valid usecase, we can resurrecting the code and implementing the remaining parts, but I doubt anyone will.

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

Reviewed-by on v1 1/1
#5 lore raw
In reply to Andrew Cooper
Quoted 6 lines · Andrew Cooper

Because of a bug in 2010, LMSL support didn't functioned in Xen.

c/s f2c608444 noticed but avoided fixing the issue for migration reasons. In addition to migration problems, changes to the segmentation logic for emulation would be needed before the feature could be enabled.

Quoted 6 lines

This feature is entirely unused by operating systems (probably owing to its semantics which only cover half the segment registers), and no one has commented on its absence from Xen. As supporting it would involve a large amount of effort, it seems better to remove the code entirely.

If someone finds a valid usecase, we can resurrecting the code and

^ resurrect

Quoted 1 line

implementing the remaining parts, but I doubt anyone will.

^implement

Quoted 2 lines

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