KVM: fix LAPIC timer period overflow
PATCH 1/1 KVM: fix LAPIC timer period overflow
Don't overflow when computing the 64-bit period from 32-bit registers.
Fixes sourceforge bug #2826486.
Signed-off-by Aurelien Jarno <[email protected]>
--- arch/x86/kvm/lapic.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kvm/lapic.c +1 -1
@@ -658,7 +658,7 @@ static void start_apic_timer(struct kvm_lapic *apic) {ktime_t now = apic->lapic_timer.timer.base->get_time (); - apic->lapic_timer.period =apic_get_reg (apic,APIC_TMICT ) * + apic->lapic_timer.period = (u64 )apic_get_reg (apic,APIC_TMICT ) *APIC_BUS_CYCLE_NS * apic->divide_count;atomic_set (&apic->lapic_timer.pending,0 );
Signature · 5 lines
1.6.4.3 -- Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net
Marcelo Tosatti
AppliedQuoted 14 lines · Aurelien Jarno
Don't overflow when computing the 64-bit period from 32-bit registers.
Fixes sourceforge bug #2826486.
Signed-off-by Aurelien Jarno <[email protected]>--- arch/x86/kvm/lapic.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)arch/x86/kvm/lapic.c +0
-0
arch/x86/kvm/lapic.c static void start_apic_timer(struct kvm_lapic *apic) · line 663
Quoted 7 lines
arch/x86/kvm/lapic.c +1
-1@@ -658,7 +658,7 @@ static void start_apic_timer(struct kvm_lapic *apic) {ktime_t now = apic->lapic_timer.timer.base->get_time (); - apic->lapic_timer.period =apic_get_reg (apic,APIC_TMICT ) * + apic->lapic_timer.period = (u64 )apic_get_reg (apic,APIC_TMICT ) *APIC_BUS_CYCLE_NS * apic->divide_count;atomic_set (&apic->lapic_timer.pending,0 );
Applied, thanks.