From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 ACD083ADB91 for ; Wed, 10 Jun 2026 10:21:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781086918; cv=none; b=L393eHQbmPgQBxDlVTvMMdjB5u4zRzootoRYkMpZ1SCGIYk3Otwx9WlO1W9DdIBBkQECCyw8tdFMTPGGdiYeAWYH6FQday88PPtJL17CG0Ob3NOMrqE6szRDEEWze6H1AuLlQ3Gm4mr0npHt4taUkVT9CLzy3s2eyCtc9mrYAx4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781086918; c=relaxed/simple; bh=9pp28k+eNQp433Z1KAgspF0DcmPZsq9r3Ta+8Xix5js=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=c3wnyvAsS7dLIPpHSNA7lF+oE5btGsM4AkPIHh5akaKzRIKQM9VHMwXTGE1OnDS3galMWji1iGGiolIY+3Aye7pq3O+DMzrIjJ63oElQX6yexHxSgJXcqLb1v34UCGtprDEEtjzx9CEBvGEBslZ+DyDqbh/AIinWpGm/3434fgo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=jlFbw3U0; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=HdazXGQg; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=jlFbw3U0; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=HdazXGQg; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="jlFbw3U0"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="HdazXGQg"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="jlFbw3U0"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="HdazXGQg" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id CF8186A932; Wed, 10 Jun 2026 10:21:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1781086914; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=EM9ZgA33JNbFGAdbgsnV2wowMye61MPDM/8arDfcXnk=; b=jlFbw3U0izz2S2P1yZKWvaHnBr5/5oAyhsSE+eHbK43PjB7zdCY3CaTFquVn7/D8MvoVIG TlBG1oNslJuuolN/654ElYw3XWu1bS/tunAw01xkP0JBzLHAToy2Kpyx+l8iwfQ+fIzzDP oEKlNn0MvHU7d8PBuf+65g3Q6ThvBnA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1781086914; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=EM9ZgA33JNbFGAdbgsnV2wowMye61MPDM/8arDfcXnk=; b=HdazXGQgTznYus/wud9cJzRLpySiRvhlKxREqjtLb3C9nqE79MuMKl5cl+4+ZEjjGWWbxh Hvs9mkrpUZsqGyAw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=jlFbw3U0; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=HdazXGQg DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1781086914; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=EM9ZgA33JNbFGAdbgsnV2wowMye61MPDM/8arDfcXnk=; b=jlFbw3U0izz2S2P1yZKWvaHnBr5/5oAyhsSE+eHbK43PjB7zdCY3CaTFquVn7/D8MvoVIG TlBG1oNslJuuolN/654ElYw3XWu1bS/tunAw01xkP0JBzLHAToy2Kpyx+l8iwfQ+fIzzDP oEKlNn0MvHU7d8PBuf+65g3Q6ThvBnA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1781086914; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=EM9ZgA33JNbFGAdbgsnV2wowMye61MPDM/8arDfcXnk=; b=HdazXGQgTznYus/wud9cJzRLpySiRvhlKxREqjtLb3C9nqE79MuMKl5cl+4+ZEjjGWWbxh Hvs9mkrpUZsqGyAw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C32CF779A7; Wed, 10 Jun 2026 10:21:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id zFqkL8I6KWoibgAAD6G6ig (envelope-from ); Wed, 10 Jun 2026 10:21:54 +0000 Received: by incl.suse.cz (Postfix, from userid 1000) id 7022610A9E4; Wed, 10 Jun 2026 12:21:54 +0200 (CEST) Date: Wed, 10 Jun 2026 12:21:54 +0200 From: Jiri Wiesner To: Dimitri Sivanich Cc: Thomas Gleixner , Linux Kernel Mailing List , Steve Wahl , Justin Ernst , Kyle Meyer , Russ Anderson , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Peter Zijlstra (Intel)" , Ilpo =?iso-8859-1?Q?J=E4rvinen?= , Marco Elver , "Guilherme G. Piccoli" , Nikunj A Dadhania , "Xin Li (Intel)" , Dimitri Sivanich Subject: Re: [PATCH v4 0/2] x86/tsc: Exempt recent UV systems from clocksource watchdog checks to avoid false positives. Message-ID: References: <87lddcv9vd.ffs@tglx> 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: X-Rspamd-Action: no action X-Rspamd-Queue-Id: CF8186A932 X-Spam-Flag: NO X-Spam-Score: -4.01 X-Spam-Level: X-Spamd-Result: default: False [-4.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_NOT_FQDN(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCPT_COUNT_TWELVE(0.00)[19]; MISSING_XM_UA(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:dkim]; RCVD_COUNT_THREE(0.00)[3]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCVD_TLS_LAST(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org On Tue, Jun 09, 2026 at 02:34:10PM -0500, Dimitri Sivanich wrote: > On Tue, Jun 09, 2026 at 11:59:26AM +0200, Jiri Wiesner wrote: > > On Thu, May 21, 2026 at 09:08:34PM -0500, Dimitri Sivanich wrote: > > > On Thu, May 21, 2026 at 09:30:14PM +0200, Thomas Gleixner wrote: > > > > On Thu, May 21 2026 at 08:17, Dimitri Sivanich wrote: > > > > > HPE UV hardware and firmware is designed to ensure a reliable and > > > > > synchronized TSC mechanism. Comparing the TSC against secondary > > > > > clocksources can result in false positives due to variable access > > > > > latency caused by system traffic. > > > > I do not think that the access latency of the reference clocksource, sgi_rtc in this case, is the cause of the false positives. I think sgi_rtc really experiences time skew. More details below. > > FYI, there was a firmware regression that impacted sgi_rtc on our Sapphire > Rapids based UV systems, that would've caused the results that you saw. > That has since been fixed. It may not seem so but I was actually trying to help make the argument for why this little patchset disabling the clocksource watchdog on UV systems should be merged. I think still think the view that the false positives are caused by the access latency of sgi_rtc contradicts the way the new clocksource watchdog implementation works. Details are below. > > > I tested a 7.1-rc4 kernel on a 2048 thread 16 socket system and, while > > > under test, the TSC did get marked as unstable after a series of "sgi_rtc > > > read timed out" warnings. > > > > The new clocksource watchdog implementation makes sure to act on time skew only if the time between two reference clocksource readouts does not exceed 50 us. The threshold for evaluating time skew (based on SHIFT_500PPM) is 244 us for a 500 ms interval plus the measured reference clocksource readout latency. If the comparison to the reference clocksource fails on CPU 0 the time skew between the clocksource being checked and the reference clocksource must be at least 244 us. The clocksource watchdog cannot distiguish which of the clocksources is skewed, and it must make the assumption that the clocksource being checked is skewed. The code executes: scoped_guard(irq) { wd_ts0 = watchdog->read(watchdog); cs_ts = cs->read(cs); wd_ts1 = watchdog->read(watchdog); } which I imagine works in this way: * send a request to sgi_rtc * read sgi_rtc timestamp (wd_ts0) * return timestamp from sgi_rtc * read TSC timestamp on the CPU * send a request to sgi_rtc * read sgi_rtc timestamp (wd_ts1) * return timestamp from sgi_rtc The code calculates wd_seq by subtracting wd_ts0 from wd_ts1. wd_seq includes the time needed to (assuming the sgi_rtc timestamp read takes zero time): * return timestamp from sgi_rtc * read TSC timestamp on the CPU * send a request to sgi_rtc The code guarantees that wd_seq is less than 50 us, which means the latency between reading wd_ts0 and reading cs_ts must also be less than 50 us. In other words, when a clocksource fails to pass the frequency check there is provable time skew. Either the TSC got skewed, which produced most of the measured time skew, or sgi_rtc got skewed (maybe both got skewed to a considerable degree but that seems is unlikely). The case described below provides an example of an sgi_rtc clocksource experiencing time skew. If the below example was caused by a firmware bug that has since been resolved, there needs to be another bug causing the time skew of sgi_rtc, based on the reported false positive of the new clocksource watchdog implementation on a UV system. Otherwise, we will have to blame the TSC and the clocksource watchdog should not be disabled on UV systems. > > In the past, I worked on a bug where a customer with an HPE UV machine reported degraded performance and switches to the HPET. This kernel had the old clocksource watchdog implementation. I created a debugging kernel with the HPET as a second watchdog (not affecting the decisions by the watchdog) and got this result: > > > clocksource: timekeeping watchdog on CPU118: Marking clocksource 'tsc' as unstable because the skew is too large: > > > clocksource: 'sgi_rtc' wd_nsec: 511302794 wd_now: 1cb50e4c4b wd_last: 1ca7097111 mask: ffffffffffffff > > > clocksource: 'hpet' wd2_nsec: 512005960 wd2_now: 65892719 wd2_last: 64c5d684 mask: ffffffff > > > clocksource: 'tsc' cs_nsec: 512006458 cs_now: 86b5982cb1 cs_last: 867581bbab mask: ffffffffffffffff > > > clocksource: 'tsc' skewed 703664 ns (0 ms) over watchdog 'sgi_rtc' interval of 511302794 ns (511 ms) > > > clocksource: 'tsc' is current clocksource. > > > tsc: Marking TSC unstable due to clocksource watchdog > > > clocksource: Checking clocksource tsc synchronization from CPU 610 to CPUs 0-609,611-767. > > > clocksource: Switched to clocksource sgi_rtc The machine has 8 CPU sockets with Intel(R) Xeon(R) Platinum 8468H (family: 0x6, model: 0x8f, stepping: 0x8), cpu ucode 0x2b000620: [ 0.000000] DMI: HPE Compute Scale-up Server 3200/Compute Scale-up Server 3200, BIOS Bundle:1.60.88-20250613_054523 SFW:009.040.012.000.25060304 [ 0.675393] UV: Found UV500 hub [ 0.679294] UV: UVsystab: Revision:500 The test was carried out on 22nd May, 2025. > > The intervals measured by the TSC and the HPET match very well; the sgi_rtc is off. I find it hard to believe that both the TSC and the HPET would be skewed - both reporting a longer interval - while sgi_rtc was correct. I think sgi_rtc was skewed. > > > > There are several solution to work around the hardware limitation of sgi_rtc: > > 1. Disable the clocksource watchdog > > 2. Decrease the rating of sgi_rtc Solution 1 is actionable but I think we should be sure it is made for the right reasons. -- Jiri Wiesner SUSE Labs