kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kvm: x86: fix apic_base enable check
@ 2014-01-15 12:39 Andrew Jones
  2014-01-15 12:40 ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Jones @ 2014-01-15 12:39 UTC (permalink / raw)
  To: jan.kiszka, pbonzini, mtosatti; +Cc: kvm

Commit e66d2ae7c67bd moved the assignment
vcpu->arch.apic_base = value above a condition with
(vcpu->arch.apic_base ^ value), causing that check
to always fail. Use old_value, vcpu->arch.apic_base's
old value, in the condition instead.

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 arch/x86/kvm/lapic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 1673940cf9c35..775702f649ca6 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -1355,7 +1355,7 @@ void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value)
 	vcpu->arch.apic_base = value;
 
 	/* update jump label if enable bit changes */
-	if ((vcpu->arch.apic_base ^ value) & MSR_IA32_APICBASE_ENABLE) {
+	if ((old_value ^ value) & MSR_IA32_APICBASE_ENABLE) {
 		if (value & MSR_IA32_APICBASE_ENABLE)
 			static_key_slow_dec_deferred(&apic_hw_disabled);
 		else
-- 
1.8.1.4


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

* Re: [PATCH] kvm: x86: fix apic_base enable check
  2014-01-15 12:39 [PATCH] kvm: x86: fix apic_base enable check Andrew Jones
@ 2014-01-15 12:40 ` Paolo Bonzini
  2014-01-16  7:38   ` Jan Kiszka
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2014-01-15 12:40 UTC (permalink / raw)
  To: Andrew Jones; +Cc: jan.kiszka, mtosatti, kvm

Il 15/01/2014 13:39, Andrew Jones ha scritto:
> Commit e66d2ae7c67bd moved the assignment
> vcpu->arch.apic_base = value above a condition with
> (vcpu->arch.apic_base ^ value), causing that check
> to always fail. Use old_value, vcpu->arch.apic_base's
> old value, in the condition instead.
> 
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
>  arch/x86/kvm/lapic.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index 1673940cf9c35..775702f649ca6 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -1355,7 +1355,7 @@ void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value)
>  	vcpu->arch.apic_base = value;
>  
>  	/* update jump label if enable bit changes */
> -	if ((vcpu->arch.apic_base ^ value) & MSR_IA32_APICBASE_ENABLE) {
> +	if ((old_value ^ value) & MSR_IA32_APICBASE_ENABLE) {
>  		if (value & MSR_IA32_APICBASE_ENABLE)
>  			static_key_slow_dec_deferred(&apic_hw_disabled);
>  		else
> 

Thanks Drew, applying this patch to master branch.

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

* Re: [PATCH] kvm: x86: fix apic_base enable check
  2014-01-15 12:40 ` Paolo Bonzini
@ 2014-01-16  7:38   ` Jan Kiszka
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2014-01-16  7:38 UTC (permalink / raw)
  To: Paolo Bonzini, Andrew Jones; +Cc: mtosatti, kvm

On 2014-01-15 13:40, Paolo Bonzini wrote:
> Il 15/01/2014 13:39, Andrew Jones ha scritto:
>> Commit e66d2ae7c67bd moved the assignment
>> vcpu->arch.apic_base = value above a condition with
>> (vcpu->arch.apic_base ^ value), causing that check
>> to always fail. Use old_value, vcpu->arch.apic_base's
>> old value, in the condition instead.
>>
>> Signed-off-by: Andrew Jones <drjones@redhat.com>
>> ---
>>  arch/x86/kvm/lapic.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
>> index 1673940cf9c35..775702f649ca6 100644
>> --- a/arch/x86/kvm/lapic.c
>> +++ b/arch/x86/kvm/lapic.c
>> @@ -1355,7 +1355,7 @@ void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value)
>>  	vcpu->arch.apic_base = value;
>>  
>>  	/* update jump label if enable bit changes */
>> -	if ((vcpu->arch.apic_base ^ value) & MSR_IA32_APICBASE_ENABLE) {
>> +	if ((old_value ^ value) & MSR_IA32_APICBASE_ENABLE) {
>>  		if (value & MSR_IA32_APICBASE_ENABLE)
>>  			static_key_slow_dec_deferred(&apic_hw_disabled);
>>  		else
>>
> 
> Thanks Drew, applying this patch to master branch.
> 

Thanks for catching this.

Paolo, please make sure this one makes it to stable as well.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux

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

end of thread, other threads:[~2014-01-16  7:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-15 12:39 [PATCH] kvm: x86: fix apic_base enable check Andrew Jones
2014-01-15 12:40 ` Paolo Bonzini
2014-01-16  7:38   ` Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).