From: Sean Christopherson <seanjc@google.com>
To: Thorsten Blum <thorsten.blum@toblux.com>
Cc: pbonzini@redhat.com, tglx@linutronix.de, mingo@redhat.com,
bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org,
hpa@zytor.com, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: Optimize local variable in start_sw_tscdeadline()
Date: Wed, 14 Aug 2024 14:33:42 -0700 [thread overview]
Message-ID: <Zr0itgdmn6LGDFsQ@google.com> (raw)
In-Reply-To: <20240814203345.2234-2-thorsten.blum@toblux.com>
On Wed, Aug 14, 2024, Thorsten Blum wrote:
> Change the data type of the local variable this_tsc_khz to u32 because
> virtual_tsc_khz is also declared as u32.
Heh, thought this looked familiar[*]. I'll plan on applying this for 6.12.
[*] https://lore.kernel.org/all/ZT_WBanoip8zhxis@google.com
> 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
>
> Compile-tested only.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.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 a7172ba59ad2..40ff955c1859 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -1946,7 +1946,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;
>
> --
> 2.45.2
>
next prev parent reply other threads:[~2024-08-14 21:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-14 20:33 [PATCH] KVM: x86: Optimize local variable in start_sw_tscdeadline() Thorsten Blum
2024-08-14 21:33 ` Sean Christopherson [this message]
2024-08-23 23:47 ` Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zr0itgdmn6LGDFsQ@google.com \
--to=seanjc@google.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=tglx@linutronix.de \
--cc=thorsten.blum@toblux.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).