Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp973991lqa; Sun, 28 Apr 2024 12:14:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUZc8Q7RWHqRIc3UdqPGFdzEqEsNveFZTImBJucLukreqwbNQ4lU9epVHTaosmkXBGQAnSbpyOpbwa+d7KV4RG7nRLf3h9VPAwki6n6vw== X-Google-Smtp-Source: AGHT+IGZ4UgNzdVY5xY+woPTn4rtNz+pk8u9T9JlgK+dmRF6vhwzaqKc1mBbnThf3VFBEwtqZdPx X-Received: by 2002:a17:906:3717:b0:a58:eabd:72a8 with SMTP id d23-20020a170906371700b00a58eabd72a8mr2805566ejc.54.1714331676545; Sun, 28 Apr 2024 12:14:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714331676; cv=pass; d=google.com; s=arc-20160816; b=rWc0vo4i+NQAaQOuuwShozBVY5i7QMLufLaC3sr65dXJtI+eb/PKGcmKQr7ZdnbKnb jiPXzKpGHlzMaVMnYZN9soGUVIgldSX0Cqa4bomJPoYQckhUHGUo98gt1MBwJAm7C8Kb y/HgI8F0J1Zwh9psoey6V/V0cHCF6oTokNgqZFqXuZeuAY7aNZ/s4jbtJ3kJ/bcrps2m F6zl1acmzb7MZ10VAd3TGkTnvWnThRNAsxzXRIKgplTDnnS3mlI9keg16bQWnN0kTV4f Oacj/vgFFISoAmAI8y2w9oJ70jQ9DzMH8eSmgf/FeGhf09azpCeJYm/4Gad4k1FjJl/8 bqnA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:references:in-reply-to :user-agent:subject:cc:to:from:date:dkim-signature:dkim-filter; bh=xxrADio/aNUzLdnPx8MOcg3D2EVsDHPLMECIw5Ickt4=; fh=ZEX2aqZI+zTNlUzDjn29XD3kuf/gXoR/G7WkFpEdSwI=; b=TRkqgLi+DsQdy36PKXuJSkensVmkaz1/YOka87IxipTlBFFwlC49ablTRXNoHUqGo1 mUVF2UilBP04lgC0ugaZ6YYAXh02zaS3FBQIgOZAxzucf6BR/aXJm13ERyY1g+FQKqf5 Utjhlrpy3E8/XbVYYysFWpL7sV8muNBjdSZtdKnOcdTjWpRqGfIKh6E7Ia2LvCWgXG9F FJWGLkNrL1RA9Clcs2KJ+2ekaeSZPvugTqC338IHH8M9m5PZBCLeblM9BPfXy3xf0GPm xQ8J261DkC4QPTPZ5/585Zvohitj1ImDGtgG0COqX/85bpLi92m3dxxJWfEh6owMOUtx 8DMw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=temperror (no key for signature) header.i=@zytor.com header.s=2024041401 header.b="cEXU6/jd"; arc=pass (i=1 spf=pass spfdomain=zytor.com dkim=pass dkdomain=zytor.com dmarc=pass fromdomain=zytor.com); spf=pass (google.com: domain of linux-kernel+bounces-161550-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161550-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id t7-20020a170906178700b00a555ddde855si13168546eje.369.2024.04.28.12.14.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Apr 2024 12:14:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161550-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@zytor.com header.s=2024041401 header.b="cEXU6/jd"; arc=pass (i=1 spf=pass spfdomain=zytor.com dkim=pass dkdomain=zytor.com dmarc=pass fromdomain=zytor.com); spf=pass (google.com: domain of linux-kernel+bounces-161550-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161550-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 491391F216E3 for ; Sun, 28 Apr 2024 19:14:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0BF7574439; Sun, 28 Apr 2024 19:14:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b="cEXU6/jd" Received: from mail.zytor.com (terminus.zytor.com [198.137.202.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4CBCC64CC0 for ; Sun, 28 Apr 2024 19:14:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.136 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714331669; cv=none; b=A1JYqyRH/Fkxk5gmwZGTX+Fu2sAPLwvtyt2vl6Ozw9KLOuh2D7usP1lmJuPFQcRGNWTNdWBAmpC/KdaM9xpIVdtuUu97nsQxcM141W7dtLvvX7Nc+cYiojISJn0ygy6O7H7tdXNsSu2vbxLoclWW/la3FnDVEihiUkhQQnl9vvA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714331669; c=relaxed/simple; bh=9Nj/lKy8oIw619xnOAq8MNoRmoqsDX21M1ok9ISgCK4=; h=Date:From:To:CC:Subject:In-Reply-To:References:Message-ID: MIME-Version:Content-Type; b=bWIj84/N3J0ira/eAHwQkKXgCNYDVawqgVTM8m1YCh6rJSAC2VTSqLM2oKG8yPRUOpyCRn7Eq8RBBi2kzLh6hezZlMhrCZVCecl2E4L2YB8TWssrxcIHKeLUCSyYo6oTMmckf2mB/D5dDfg8rhmGV5w8p6xeUFKRKmHT3jolWV0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com; spf=pass smtp.mailfrom=zytor.com; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b=cEXU6/jd; arc=none smtp.client-ip=198.137.202.136 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zytor.com Received: from [IPv6:::1] ([172.56.209.56]) (authenticated bits=0) by mail.zytor.com (8.17.2/8.17.1) with ESMTPSA id 43SJDO2r3973779 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Sun, 28 Apr 2024 12:13:26 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 43SJDO2r3973779 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2024041401; t=1714331607; bh=xxrADio/aNUzLdnPx8MOcg3D2EVsDHPLMECIw5Ickt4=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=cEXU6/jdGzjGctbaX1uJmc9/c+IpwEhnvGaBTFhDGvl1Q4m04fu8GP0txGBmIfqrw VB2JQzW0ToMdyVtT5Z73kmc141v1oouP4YESItK04abET58pihX0Bc5zHtccBONBES /ZHIpWF8Y/Db/izvzzm/yFMy7/7G9aT9Tkg8w7KGlUMcSQqQnkUi19GuZTmyFixcV3 u7jHWg+b7UZtV4sDkOHz/f4DhwN0cFO0SajY7gVccjIPLy5caoMBXS70PaTz48XPhD PKgmZTU4eNSjQqdp/ot/CGGsdQsL5F33G++8a1xJrfOioO7Sggu2aLko8VIBT775YK UtsL5d1Jj0WVQ== Date: Sun, 28 Apr 2024 12:13:11 -0700 From: "H. Peter Anvin" To: Jules Irenge , mingo@redhat.com CC: tglx@linutronix.de, bp@alien8.de, x86@kernel.org, peterz@infradead.org, rdunlap@infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] x86/tsc: Use div64_ul instead of do_div() User-Agent: K-9 Mail for Android In-Reply-To: References: Message-ID: <7EE9AB38-3103-4091-A558-BF0DEAF61E1D@zytor.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On April 28, 2024 10:31:16 AM PDT, Jules Irenge = wrote: >do_div() truncates a u64 divisor to 32 bit=2E >This can lead to non-zero being truncated to zero for division=2E > >Fix coccinelle warning >WARNING: do_div() does a 64-by-32 division, please consider using div64_u= l instead > >Signed-off-by: Jules Irenge >--- > arch/x86/kernel/tsc=2Ec | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/arch/x86/kernel/tsc=2Ec b/arch/x86/kernel/tsc=2Ec >index 5a69a49acc96=2E=2E2da37f33dd17 100644 >--- a/arch/x86/kernel/tsc=2Ec >+++ b/arch/x86/kernel/tsc=2Ec >@@ -484,7 +484,7 @@ static unsigned long pit_calibrate_tsc(u32 latch, uns= igned long ms, int loopmin) >=20 > /* Calculate the PIT value */ > delta =3D t2 - t1; >- do_div(delta, ms); >+ div64_ul(delta, ms); > return delta; > } >=20 Are you sure this is not a false positive? This is a *much* more expensive= operation on 32 bits=2E