Skip to contentSkip to conversation

KVM: svm: Fix erratum 383 check for 32-bit hosts

PATCH In review Jan Kiszka 2 participants 4 messages May 26, 2010

Subsystems (3)
lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 KVM: svm: Fix erratum 383 check for 32-bit hosts

From: Jan Kiszka <[email protected]>

This overflow should have left the check broken behind for 32-bit hosts.

---
 arch/x86/kvm/svm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kvm/svm.c +1 -1
index 3c03c36..fd32791 100644
@@ -1460,7 +1460,7 @@ static bool is_erratum_383(void)
 	/* Bit 62 may or may not be set for this mce */
 	value &= ~(1ULL << 62);
 
-	if (value != 0xb600000000010015)
+	if (value != 0xb600000000010015ULL)
 		return false;
 
 	/* Clear MCi_STATUS registers */
Signature · 1 line
1.6.0.2
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

This overflow should have left the check broken behind for 32-bit hosts.

The check itself should work but it gives a compile warning for me (at least in my small userspace test I did ;) Good catch, thanks.

Quoted 1 line
Quoted 20 lines
---
 arch/x86/kvm/svm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kvm/svm.c +1 -1
index 3c03c36..fd32791 100644
@@ -1460,7 +1460,7 @@ static bool is_erratum_383(void)
 	/* Bit 62 may or may not be set for this mce */
 	value &= ~(1ULL << 62);
 
-	if (value != 0xb600000000010015)
+	if (value != 0xb600000000010015ULL)
 		return false;
 
 	/* Clear MCi_STATUS registers */
Signature · 1 line
1.6.0.2
author
#2 lore raw
Quoted 7 lines · Joerg
Quoted 3 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

This overflow should have left the check broken behind for 32-bit hosts.

The check itself should work but it gives a compile warning for me (at least in my small userspace test I did ;) Good catch, thanks.

To my understanding, the test degraded to value != 0x00010015. That may not have the intended effect, no?

Jan

Quoted 26 lines
Quoted 2 lines
Quoted 20 lines
---
 arch/x86/kvm/svm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kvm/svm.c +1 -1
index 3c03c36..fd32791 100644
@@ -1460,7 +1460,7 @@ static bool is_erratum_383(void)
 	/* Bit 62 may or may not be set for this mce */
 	value &= ~(1ULL << 62);
 
-	if (value != 0xb600000000010015)
+	if (value != 0xb600000000010015ULL)
 		return false;
 
 	/* Clear MCi_STATUS registers */
Signature · 1 line
1.6.0.2
#3 lore raw
Quoted 11 lines · Jan Kiszka
Quoted 7 lines · Joerg
Quoted 3 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

This overflow should have left the check broken behind for 32-bit hosts.

The check itself should work but it gives a compile warning for me (at least in my small userspace test I did ;) Good catch, thanks.

To my understanding, the test degraded to value != 0x00010015. That may not have the intended effect, no?

I tested this with a small test program in userspace (compiled with gcc -m32) and the check actually works. But I get a compile warning because the constant is too large for type long. So I think the check should work in the 32 bit kernel too.

Joerg