public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: svm: Fix erratum 383 check for 32-bit hosts
@ 2010-05-26  7:11 Jan Kiszka
  2010-05-26  7:45 ` Roedel, Joerg
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Kiszka @ 2010-05-26  7:11 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti; +Cc: kvm, Joerg Roedel

From: Jan Kiszka <jan.kiszka@siemens.com>

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

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 arch/x86/kvm/svm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 3c03c36..fd32791 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -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 */
-- 
1.6.0.2

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

* Re: [PATCH] KVM: svm: Fix erratum 383 check for 32-bit hosts
  2010-05-26  7:11 [PATCH] KVM: svm: Fix erratum 383 check for 32-bit hosts Jan Kiszka
@ 2010-05-26  7:45 ` Roedel, Joerg
  2010-05-26  7:56   ` Jan Kiszka
  0 siblings, 1 reply; 4+ messages in thread
From: Roedel, Joerg @ 2010-05-26  7:45 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Avi Kivity, Marcelo Tosatti, kvm

On Wed, May 26, 2010 at 03:11:17AM -0400, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> 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.

> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>

Acked-by: Joerg Roedel <joerg.roedel@amd.com>

> ---
>  arch/x86/kvm/svm.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 3c03c36..fd32791 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -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 */
> -- 
> 1.6.0.2
> 


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

* Re: [PATCH] KVM: svm: Fix erratum 383 check for 32-bit hosts
  2010-05-26  7:45 ` Roedel, Joerg
@ 2010-05-26  7:56   ` Jan Kiszka
  2010-05-26  8:00     ` Roedel, Joerg
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Kiszka @ 2010-05-26  7:56 UTC (permalink / raw)
  To: Roedel, Joerg; +Cc: Avi Kivity, Marcelo Tosatti, kvm

[-- Attachment #1: Type: text/plain, Size: 1167 bytes --]

Roedel, Joerg wrote:
> On Wed, May 26, 2010 at 03:11:17AM -0400, Jan Kiszka wrote:
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> 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

> 
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> 
> Acked-by: Joerg Roedel <joerg.roedel@amd.com>
> 
>> ---
>>  arch/x86/kvm/svm.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
>> index 3c03c36..fd32791 100644
>> --- a/arch/x86/kvm/svm.c
>> +++ b/arch/x86/kvm/svm.c
>> @@ -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 */
>> -- 
>> 1.6.0.2
>>
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

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

* Re: [PATCH] KVM: svm: Fix erratum 383 check for 32-bit hosts
  2010-05-26  7:56   ` Jan Kiszka
@ 2010-05-26  8:00     ` Roedel, Joerg
  0 siblings, 0 replies; 4+ messages in thread
From: Roedel, Joerg @ 2010-05-26  8:00 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Avi Kivity, Marcelo Tosatti, kvm

On Wed, May 26, 2010 at 03:56:43AM -0400, Jan Kiszka wrote:
> Roedel, Joerg wrote:
> > On Wed, May 26, 2010 at 03:11:17AM -0400, Jan Kiszka wrote:
> >> From: Jan Kiszka <jan.kiszka@siemens.com>
> >>
> >> 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



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

end of thread, other threads:[~2010-05-26  8:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-26  7:11 [PATCH] KVM: svm: Fix erratum 383 check for 32-bit hosts Jan Kiszka
2010-05-26  7:45 ` Roedel, Joerg
2010-05-26  7:56   ` Jan Kiszka
2010-05-26  8:00     ` Roedel, Joerg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox