Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4002538rwl; Sun, 2 Apr 2023 20:41:48 -0700 (PDT) X-Google-Smtp-Source: AKy350bzi9NU/o0an0YK3x/54Ryd12ujNnm/+bXl8qpUafaP9MqDN5mQ5T5ag1huyh7xHb+lAzN3 X-Received: by 2002:a17:902:cec6:b0:1a1:80ea:4364 with SMTP id d6-20020a170902cec600b001a180ea4364mr47196358plg.31.1680493307976; Sun, 02 Apr 2023 20:41:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680493307; cv=none; d=google.com; s=arc-20160816; b=zfRVAdBoYnFsuHGpWTSlM+T3dT2c0qfxK7pf0OsVglm9wkvhXodTQ9NXpY6oOnHy7X C4nLdXcJ3kDfizRGkUZt/+97XEEcgJxFrxm1yYm653qjFjgCsrAILnNz2D0N4WOGFM5L NWhhZylyru55w8XxPgvqp1c+GCzIaB94IZ/QSJi31onUcG388BoY/EbsgLmrf4ge/zDq fsGD4j8Cr41AgP/PJ/YZSXXEf9CnGmsXZhDSxpLBRkKCiVLgpaCmS4Rodeos7BpFfffk EZylB59e3h5ZqIuLrIyn2ZkDJ12ZUgNa1uUr2jOEBtwv39gPP0JJk21kt9dZNwGtZzH5 TlEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=/qbAJTqJZzW2ckr2YmfnoFAUoiNFA5qy2O4CkU/KvLk=; b=OccYidusYYvy/NAhxDZsFYfuBkFjw38J7c31YWLkcvtVx10FxsqtcU/RWCSlaN6Hof vfav/R56Ew3WXqdyVfwSl3ssNXbMlvO4nfSyGQXZObmQRe3ZHMkQls7sdK3fywBQCRFB 69eOhGxMiEfegpPd87pQIKA7/lQsmxAY2UWR5q5QCy5ycc58FCClXefIQPoAhxdBcCac O26Fj2x+Oaa4VtS6eOCm6W2GtuR72HaG7RngqM8vzT/x8KnzKdOJuqEbwNk+rDNJ+SvK j75DmRrC8vtJU9vINAh3t0C7Emuo+n15bxdsktDC1vw0WO1KQ9rtlcjthLw3kOu1nctJ 5xBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KepNx+6U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f5-20020a17090274c500b0019aa0d010eesi7031689plt.308.2023.04.02.20.41.36; Sun, 02 Apr 2023 20:41:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KepNx+6U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230522AbjDCDip (ORCPT + 99 others); Sun, 2 Apr 2023 23:38:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230192AbjDCDin (ORCPT ); Sun, 2 Apr 2023 23:38:43 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 335FA8A55 for ; Sun, 2 Apr 2023 20:38:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 187FCCE0E9A for ; Mon, 3 Apr 2023 03:38:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BFABC433EF; Mon, 3 Apr 2023 03:38:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680493118; bh=YG0HLmOg1AwXo9vc4n8opH1/k+AHcpd/p8Qd4KDGf0o=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=KepNx+6UjLcJOYFZAdxE8VjgWXgUmYqt+zbhMdFzBgquOaNzDYmHXln2roIbWYwI4 V/jFlzW9omx+3uY6elGqx0QMPYC4UUqOnlTu6fEPF9f+IeN7Ei2ObIumSVzBmo1Np/ V56/XaNimp+IHbd+7BLZKVjCg7HWyEYoUY4XjTpK+E5dZ4HJsb1aD6DggaVH8tOstm UXAdbTxXUckN24qfMaJD9CCzrvwJEV0ttABIIp3ih/rG2C3jGm9V8XaMDST8adu9bX GdAa9Q3PLsqFNSwC/S0GhwukWdn/Np6Y6EsiKmwSqvTgdRaI94fAw74EbumZnyPlwg 18sKm5RPLPBXQ== Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id B76B1154047C; Sun, 2 Apr 2023 20:38:37 -0700 (PDT) Date: Sun, 2 Apr 2023 20:38:37 -0700 From: "Paul E. McKenney" To: Waiman Long Cc: Feng Tang , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: A couple of TSC questions Message-ID: Reply-To: paulmck@kernel.org References: <3daa086c-b4a0-47a9-8bfc-aac4139013c4@paulmck-laptop> <293db107-a572-592f-cc27-e59ab81a4e60@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 02, 2023 at 10:05:51PM -0400, Waiman Long wrote: > On 4/2/23 22:00, Paul E. McKenney wrote: > > On Sun, Apr 02, 2023 at 09:04:04PM -0400, Waiman Long wrote: > > > On 3/31/23 13:16, Paul E. McKenney wrote: > > > > On Tue, Mar 28, 2023 at 02:58:54PM -0700, Paul E. McKenney wrote: > > > > > On Mon, Mar 27, 2023 at 10:19:54AM +0800, Feng Tang wrote: > > > > > > On Fri, Mar 24, 2023 at 05:47:33PM -0700, Paul E. McKenney wrote: > > > > > > > On Wed, Mar 22, 2023 at 01:14:48PM +0800, Feng Tang wrote: > > > > [ . . . ] > > > > > > > > > > > > > Second, we are very occasionally running into console messages like this: > > > > > > > > > > > > > > > > > > Measured 2 cycles TSC warp between CPUs, turning off TSC clock. > > > > > > > > > > > > > > > > > > This comes from check_tsc_sync_source() and indicates that one CPU's > > > > > > > > > TSC read produced a later time than a later read from some other CPU. > > > > > > > > > I am beginning to suspect that these can be caused by unscheduled delays > > > > > > > > > in the TSC synchronization code, but figured I should ask you if you have > > > > > > > > > ever seen these. And of course, if so, what the usual causes might be. > > > > > > > > I haven't seen this error myself or got similar reports. Usually it > > > > > > > > should be easy to detect once happened, as falling back to HPET > > > > > > > > will trigger obvious performance degradation. > > > > > > > And that is exactly what happened. ;-) > > > > > > > > > > > > > > > Could you give more detail about when and how it happens, and the > > > > > > > > HW info like how many sockets the platform has. > > > > > > > We are in early days, so I am checking for other experiences. > > > > > > > > > > > > > > > CC Thomas, Waiman, as they discussed simliar case here: > > > > > > > > https://lore.kernel.org/lkml/87h76ew3sb.ffs@tglx/T/#md4d0a88fb708391654e78312ffa75b481690699f > > > > > > > Fun! ;-) > > > > > Waiman, do you recall what fraction of the benefit was provided by the > > > > > first patch, that is, the one that grouped the sync_lock, last_tsc, > > > > > max_warp, nr_warps, and random_warps global variables into a single > > > > > struct? > > > The purpose of the first patch is just to avoid false cacheline sharing > > > between the watchdog cpu and another cpu that happens to access a nearby > > > data in the same cacheline. > > > > > > Now I realize that I should have followed up with this patch series. The > > > problem reported in that patch series happen on one system only, I believe. > > Thus far I am seeing eight systems, but out of a large number. So this > > is very much preliminary. > > > > > > And what we are seeing is unlikely to be due to cache-latency-induced > > > > delays. We see a very precise warp, for example, one system always > > > > has 182 cycles of TSC warp, another 273 cycles, and a third 469 cycles. > > > > Another is at the insanely large value of about 2^64/10, and shows some > > > > variation, but that variation is only about 0.1%. > > > > > > > > But any given system only sees warp on about half of its reboots. > > > > Perhaps due to the automation sometimes power cycling? > > > > > > > > There are few enough affected systems that investigation will take > > > > some time. > > > Maybe the difference in wrap is due to NUMA distance of the running cpu from > > > the node where the data reside. It will be interesting to see if my patch > > > helps. > > Almost all of them are single-socket systems. > > > > If the problem sticks with a few systems, I should be able to test > > patches no problem. If it is randomly distributed across the fleet, a > > bit more prework analysis will be called for. But what is life without > > a challenge? ;-) > > If it is happening on a single socket system, maybe it is caused by false > cacheline sharing. It is hard to tell unless we find a way to reproduce it. But multiple times on a given system with exactly the same number of clock cycles of warp each time? It should be entertaining tracking this one down. ;-) I will take a few scans of the fleet over the coming week and see if there is any consistency. Here is hoping... Thanx, Paul