From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 20F9B1C3F09 for ; Wed, 14 Aug 2024 21:33:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723671229; cv=none; b=UjwRYmg8RrDnaz8qIXwY4bhNljKFb6tVG4VZI71QvP0iiSrRdxUN9VdByPHKRcsR58G3Pzu710sPH5r8gkEBqRKVdxZ20YMAaZRI9AAVyzSmCvWzDmDdlsfVLxOPnPbETcZF5ii/8hhtXK47+qV5/d0rhIthr4y7/VWCM5XuXAs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723671229; c=relaxed/simple; bh=0JjqrbPwC03gv1AyevCkxjS8lmm3CFD82pbAPxmZF5Y=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=dNK4livZxqfWUH9sXuhOsOzuFJ7TnQo1IpSPiUCMV8xsRIKzRPVsYPBn8+hdLZxFvPz83ko+ZmrzHfeROTLSlStIsJdoa6dCuVH98Ft6Kk6ahzfwM4Lv+P4gFfxABjWZL6/3ZyNoWbEAapivblJPQt4uOSASrw7haPd8ZLeVc0o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=O55Wkapa; arc=none smtp.client-ip=209.85.216.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="O55Wkapa" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-2d3c89669a3so84171a91.3 for ; Wed, 14 Aug 2024 14:33:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1723671224; x=1724276024; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=q0g5NjtodTEAg1xeSolkAqdDfvHP56di0gLWfcl3NRU=; b=O55Wkapa6cPUEJ4kcca96cElJ4Qc7n7ysvY4tA0gomrLbR61cDZqxbjAdFoIbJhlUH dpgeUphrBsshLYZVggrSNchn09fzdV1n7bF9aUAfEJsDfjO5r8sEdIaylYdHpi89tQfV o8CjcjzSTkh0EbQh8K2ZuK3rfzON+S2An/b/7sHKiSn4oZh2VtujQI6ec/xRemA6Hilw YiLYMzA8MUysEvfkYr+MizNQ+Qv0SbuRIB9NL45jaN9avnF6I3iPIDuGPw5+Tv1j4afQ lgd94CxHocYiiTQg7Dygqj4KCWixJM1T6K/4iR4SGb2JjsaUGp9IVdw3nNEKeZuP/9rR KuoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723671224; x=1724276024; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=q0g5NjtodTEAg1xeSolkAqdDfvHP56di0gLWfcl3NRU=; b=d80rCAtp2AJtUfVC9VKHUkbVMY6Vk14s4LCmo0apVTW9H8q6lEWopXyp6gMWj4mSAF 26kTv7dBQDWZoiJfbViI4mioZxPFqJkBjSqIIVok53dCjH9pgwx8NqrL662K1v+0X5g+ fdL9K1qASr7qFIYmtOcqy+p/hh4HXpVZ6UqfBRfoElDua7i79O51zPd7LZucAmnb2137 jzdiMEutTnTRrQQGAp8NuMcigyUCv8sl5mxDeTe265VjJtz5+3Xcubkc9QO1C176CpYs SH1oRsnS1su2IxKW81XfCHVrv+E5pS1rnuhDV9vNZPGOK7CziKVomGrYr6SrTY1ZlZy2 Ir9A== X-Forwarded-Encrypted: i=1; AJvYcCVZPrHPkZrDX7iXW88zRwasmTII8j0YwH0QChYlXQ0yWID5qcqk5e1XBzdLiHDBiKpPpnbGldHyUUApX7/zVkqWT638qs8BsfO18VOH X-Gm-Message-State: AOJu0Ywt7e8THv4S/9IVE/Xn2lWh1TkV2s/5HskFGYP/ZJFSYy9+sXiH 3iH5tOHV2FYQl9dMd9/G1ksyLZ0BuI7beUSCjeu4rJZlf2eK/bOvq9/SDKN0QO40OejBNR8swHD Otg== X-Google-Smtp-Source: AGHT+IHMmJW+eZKzGIU+eHnNK46MXf2jqEOHghKxbPm48duoRJ7tzrlc2lv3bqiOWbip9fnyFn+oZyDwdxI= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:90a:7c49:b0:2c9:348a:8ef0 with SMTP id 98e67ed59e1d1-2d3aab18fefmr18576a91.3.1723671224150; Wed, 14 Aug 2024 14:33:44 -0700 (PDT) Date: Wed, 14 Aug 2024 14:33:42 -0700 In-Reply-To: <20240814203345.2234-2-thorsten.blum@toblux.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240814203345.2234-2-thorsten.blum@toblux.com> Message-ID: Subject: Re: [PATCH] KVM: x86: Optimize local variable in start_sw_tscdeadline() From: Sean Christopherson To: Thorsten Blum 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 Content-Type: text/plain; charset="us-ascii" 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 > --- > 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 >