From nobody Tue Dec 16 20:00:39 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8883CC4167B for ; Sun, 29 Oct 2023 09:47:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229679AbjJ2Jqh (ORCPT ); Sun, 29 Oct 2023 05:46:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbjJ2Jqf (ORCPT ); Sun, 29 Oct 2023 05:46:35 -0400 Received: from 1.mo576.mail-out.ovh.net (1.mo576.mail-out.ovh.net [178.33.251.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75AABC9 for ; Sun, 29 Oct 2023 02:46:31 -0700 (PDT) Received: from director2.ghost.mail-out.ovh.net (unknown [10.108.20.147]) by mo576.mail-out.ovh.net (Postfix) with ESMTP id D82B028082 for ; Sun, 29 Oct 2023 09:39:40 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-wchvn (unknown [10.110.171.1]) by director2.ghost.mail-out.ovh.net (Postfix) with ESMTPS id A84961FD2D; Sun, 29 Oct 2023 09:39:38 +0000 (UTC) Received: from foxhound.fi ([37.59.142.102]) by ghost-submission-6684bf9d7b-wchvn with ESMTPSA id Vv44I1ooPmW0GAAAMIZvTQ (envelope-from ); Sun, 29 Oct 2023 09:39:38 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-102R004927f133c-9d22-4865-bed1-34b055a274b6, 2D5A9C8C3C9544CFCEEB4DEE313913C815DB1A20) smtp.auth=jose.pekkarinen@foxhound.fi X-OVh-ClientIp: 87.94.110.144 From: =?UTF-8?q?Jos=C3=A9=20Pekkarinen?= To: seanjc@google.com, pbonzini@redhat.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, skhan@linuxfoundation.org Cc: =?UTF-8?q?Jos=C3=A9=20Pekkarinen?= , x86@kernel.org, hpa@zytor.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org Subject: [PATCH] KVM: x86: replace do_div with div64_ul Date: Sun, 29 Oct 2023 11:39:28 +0200 Message-Id: <20231029093928.138570-1-jose.pekkarinen@foxhound.fi> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 2908199461897021094 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvkedrleekgddthecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecunecujfgurhephffvvefufffkofggtgfgsehtkeertdertdejnecuhfhrohhmpeflohhsrocurfgvkhhkrghrihhnvghnuceojhhoshgvrdhpvghkkhgrrhhinhgvnhesfhhogihhohhunhgurdhfiheqnecuggftrfgrthhtvghrnhepfedtleeuteeitedvtedtteeuieevudejfeffvdetfeekleehhfelleefteetjeejnecukfhppeduvdejrddtrddtrddupdekjedrleegrdduuddtrddugeegpdefjedrheelrddugedvrddutddvnecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpeeojhhoshgvrdhpvghkkhgrrhhinhgvnhesfhhogihhohhunhgurdhfiheqpdhnsggprhgtphhtthhopedupdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdfovfetjfhoshhtpehmohehjeeipdhmohguvgepshhmthhpohhuth Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Reported by coccinelle, there is a do_div call that does 64-by-32 divisions even in 64bit platforms, this patch will move it to div64_ul macro that will decide the correct division function for the platform underneath. The output the warning follows: arch/x86/kvm/lapic.c:1948:1-7: WARNING: do_div() does a 64-by-32 division, = please consider using div64_ul instead. Signed-off-by: Jos=C3=A9 Pekkarinen --- 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 3e977dbbf993..0b90c6ad5091 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -1945,7 +1945,7 @@ static void start_sw_tscdeadline(struct kvm_lapic *ap= ic) guest_tsc =3D kvm_read_l1_tsc(vcpu, rdtsc()); =20 ns =3D (tscdeadline - guest_tsc) * 1000000ULL; - do_div(ns, this_tsc_khz); + div64_ul(ns, this_tsc_khz); =20 if (likely(tscdeadline > guest_tsc) && likely(ns > apic->lapic_timer.timer_advance_ns)) { --=20 2.39.2