]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
KVM: x86: Optimize local variable in start_sw_tscdeadline()
authorThorsten Blum <thorsten.blum@toblux.com>
Wed, 14 Aug 2024 20:33:46 +0000 (22:33 +0200)
committerSean Christopherson <seanjc@google.com>
Thu, 22 Aug 2024 18:25:24 +0000 (11:25 -0700)
Change the data type of the local variable this_tsc_khz to u32 because
virtual_tsc_khz is also declared as u32.

Since do_div() casts the divisor to u32 anyway, changing the data type
of this_tsc_khz to u32 also removes the following Coccinelle/coccicheck
warning reported by do_div.cocci:

  WARNING: do_div() does a 64-by-32 division, please consider using div64_ul instead

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Link: https://lore.kernel.org/r/20240814203345.2234-2-thorsten.blum@toblux.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/lapic.c

index 5bb481aefcbcdc4c393ea0de917dc4ffc576002f..d77cd3b87e850dc5e2a82bab08a1c98fb7c8f94c 100644 (file)
@@ -1944,7 +1944,7 @@ static void start_sw_tscdeadline(struct kvm_lapic *apic)
        u64 ns = 0;
        ktime_t expire;
        struct kvm_vcpu *vcpu = apic->vcpu;
-       unsigned long this_tsc_khz = vcpu->arch.virtual_tsc_khz;
+       u32 this_tsc_khz = vcpu->arch.virtual_tsc_khz;
        unsigned long flags;
        ktime_t now;