Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2669366rdb; Mon, 5 Feb 2024 13:54:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IEdLImIjg221eSkR6wwlIuYHaiHt+bD3f5MZCollYPhuoswIog4sjXCOKwBTpoi8vRqhOtA X-Received: by 2002:a17:902:cf4a:b0:1d9:5038:f115 with SMTP id e10-20020a170902cf4a00b001d95038f115mr523149plg.4.1707170069589; Mon, 05 Feb 2024 13:54:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707170069; cv=pass; d=google.com; s=arc-20160816; b=Sxsbb8a32Y+WIITVVA0sRi2G8BCS0DmLhxjauqE0mkNqCAo9up0OWtnPVqFGMqtE4m kaKAN9ErNA5E1WpRd+jL1BeeFQvyglbx5PU97nQJaqxxePU5QdE5p+1avq45VHTc4r03 dPGEL+Fa7KoMb5yTL/l4sVqzFT2Bwx/Awk0T1+w7+ZipL5TYdu3iNpoUfw2fQiQf3+FP uWKa2yORoXaewbsRdqOmQPS219lklbR5My8x0Hz9anJd6zFaIElw5oxcdbOdAAELpJ3r w/+qUlQywldStt/jCsEyiUUPIiYoeUyQGGA/cmy4Kzmvi2J75OiHdwsmPil7Ng1qyB3Z MxMg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=KiudqDjOw+ydAMxvUgANEFhHHF3HmOut7ZnRJc828tQ=; fh=RVJEVIi+GHHoetpCIYam441vikp2IfqopiiUjkpl4B0=; b=u0k1vWBuQhAl3GHKpXiIUHepbYx89bjMkAv9jTuP0RO5kyiLsQGJqAHfo/YCGGsvH+ azPgbgCQIBRBhtfViUfyU8YFhNHc2fP1Lf9/kiI58BJissEg95gpr1uTHQ2CqdTMjnrJ IDIhsW5VYcl0cS2PHhP4cYZNx7hdagtIHsHvpgnNq4P4JjCC8MqRtk6YKvVxXfLZ3GI5 x/Mc5W0LoLHyGUxRGAszahyDSsNv5mX4UDZA2wbHzUN9qWXc3AtX/K+SJARR8vjWrfe5 Gsma+MFHEPmOiL60g9Vcb/AjYod9eSNWTgpNpXCb+xoTHk00fel1pJvUSCfqYnc/sBZD j3Fw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="NkkDVeH/"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-53885-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53885-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCVD1tNwRYDGkjmB2BKtwWzwllKnWwYgJElDUoqOH7cV7eqigaZoZK2Fnvpg33X+Ihc92ypKcrvUZPUEaPg7O9nZQLYtCIhb5hlOOMx9ow== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q17-20020a62ae11000000b006e04ea91792si433421pff.68.2024.02.05.13.54.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 13:54:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-53885-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="NkkDVeH/"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-53885-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53885-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 6A45828D97E for ; Mon, 5 Feb 2024 21:38:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 05A1B129A84; Mon, 5 Feb 2024 20:03:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NkkDVeH/" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 21D441292E3; Mon, 5 Feb 2024 20:03:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707163416; cv=none; b=jZdHohbj4ysbUxFVCDGpbrqDDgRVS9F4ToBaIsRTcSxpvGB6WnXySSkunPqeTmuHqOEhESVVt0hawq1Ra58zX0lykB1wY+iwPtdlMLkt4v4HfOA/fzUOCm20QezKWWUmiucqnBQmAoAsUVZOhw2+ZgpzfGqpNETH9W7vdkpXKY4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707163416; c=relaxed/simple; bh=4eZQWX6W/aYg6ERcF31vLpr9leduea34fMM6jYOWiz0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VV1TbiRRHAoJWm/2K3WWR+CNkOCnmcbZVQJYprvaBZftPM3CP8qd0Gge5ciWZJODMBHZUEk7bPg2/Gtbnhde6stGg1pS2Ti8Iukt2woDoOwjcLSRJxkdoSLWbwNCa365dOEROXb1yY9lCWHbVW/uH4cahPEkDm7WG/jlaC739cs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NkkDVeH/; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76E30C433C7; Mon, 5 Feb 2024 20:03:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707163415; bh=4eZQWX6W/aYg6ERcF31vLpr9leduea34fMM6jYOWiz0=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=NkkDVeH/dIz2ktshCpJBJNpZa2Zmcy8Ftdfmtxu/qnvvsw2YtCwimeSk7gGMT5XlV ASLc8mT1/uYmlIG053uc8ekPQXOOyQajn6sADUbL/3H/xcKhklAhf/8boApDBu2NuI awlbhSPajP05uUVHAWf3lOvcEIL7CQpHBIf56qA+o+fxueW6Uo6bhbKpsbNVvSInKI 36bQvBz6pdrr60lBHP78+/X6kmjJbOIBYRrTfTxr6AFwEJY37NZPKmD33I/uCLHGKq 6ishGzLNJQUQb1FoL4UNvsU6/zNgOZvxSCwyJvx11WKAhUJgJBJ+1hc5Xjj4OKEtBE GvdLi3pydaXMg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 69A21CE1C10; Mon, 5 Feb 2024 12:03:33 -0800 (PST) Date: Mon, 5 Feb 2024 12:03:33 -0800 From: "Paul E. McKenney" To: Boqun Feng Cc: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, Zhengxu Chen , Danielle Costantino , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Peter Zijlstra , Feng Tang , Waiman Long , John Stultz , x86@kernel.org Subject: Re: [PATCH 5/8] tsc: Check for sockets instead of CPUs to make code match comment Message-ID: <1781cc76-aeee-427b-bc9e-b3d2b8f184f3@paulmck-laptop> Reply-To: paulmck@kernel.org References: <20240129235646.3171983-1-boqun.feng@gmail.com> <20240129235646.3171983-6-boqun.feng@gmail.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=us-ascii Content-Disposition: inline In-Reply-To: <20240129235646.3171983-6-boqun.feng@gmail.com> On Mon, Jan 29, 2024 at 03:56:38PM -0800, Boqun Feng wrote: > From: "Paul E. McKenney" > > The unsynchronized_tsc() eventually checks num_possible_cpus(), and > if the system is non-Intel and the number of possible CPUs is greater > than one, assumes that TSCs are unsynchronized. This despite the > comment saying "assume multi socket systems are not synchronized", > that is, socket rather than CPU. This behavior was preserved by > commit 8fbbc4b45ce3 ("x86: merge tsc_init and clocksource code") and > by the previous relevant commit 7e69f2b1ead2 ("clocksource: Remove the > update callback"). > > The clocksource drivers were added by commit 5d0cf410e94b ("Time: i386 > Clocksource Drivers") back in 2006, and the comment still said "socket" > rather than "CPU". > > Therefore, bravely (and perhaps foolishly) make the code match the > comment. > > Note that it is possible to bypass both code and comment by booting > with tsc=reliable, but this also disables the clocksource watchdog, > which is undesirable when trust in the TSC is strictly limited. > > Reported-by: Zhengxu Chen > Reported-by: Danielle Costantino > Signed-off-by: Paul E. McKenney > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: Borislav Petkov > Cc: Dave Hansen > Cc: "H. Peter Anvin" > Cc: Peter Zijlstra > Cc: Feng Tang > Cc: Waiman Long > Cc: John Stultz > Cc: Hello, Boqun, Please drop this one, as I never got an ack from the maintainers, and quite possibly for good reason. ;-) Thanx, Paul > --- > arch/x86/kernel/tsc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c > index 15f97c0abc9d..d45084c6a15e 100644 > --- a/arch/x86/kernel/tsc.c > +++ b/arch/x86/kernel/tsc.c > @@ -1287,7 +1287,7 @@ int unsynchronized_tsc(void) > */ > if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) { > /* assume multi socket systems are not synchronized: */ > - if (num_possible_cpus() > 1) > + if (nr_online_nodes > 1) > return 1; > } > > -- > 2.43.0 >