From nobody Mon Feb 9 01:22:24 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 2DF92328627; Wed, 21 Jan 2026 10:37:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768991838; cv=none; b=f9GK4KEWTpbLe2sbUWB63srW6v1arAKboHm/5LLRid+xKBs2FbvfKDf62+KkiTtl/pxI5nuFKcnnZusDcWkFo1g9S0y4q6hD68rEZ33l893aFVexVAILXESo2VpgdDvxI/O1EBuJkbkI5GcqNMNqwsQ2mMFAv/148WXDGWSJdeI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768991838; c=relaxed/simple; bh=Hg+WPbjikTmQJ82KhCwopAAkEFEZFLZ4iJjZiyPJ+o0=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=eXySOGbkAqJxo9sf4EiP7qLaWx57GzByozjI61m4KO3UCLCTCwUQQ4qOv5X4jRDLbAOClmiG1YDr8LHIdIwWsDeyfqJGE/Jl9L4L0HFD78nHcFDxvDYrqUARD8LrwghKSiCE4HAocbVXTbsFdDNqqh5LEWKiVXEIyVdt8YxpsMo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=vZYNHQsl; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=FmB8qQFO; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="vZYNHQsl"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="FmB8qQFO" Date: Wed, 21 Jan 2026 10:37:05 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1768991830; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CFbv3innd7HXx9Lftsndv4Fl9YuV0CRxqdAvyD+Stn4=; b=vZYNHQslw8AhwEDuemOPLdGFop5zB98tU/DRyGWrJGc03+MYmiSwiFXZQRF3a/9eOwlGXY haegcOuRUBeqqvlLCtuNDxVL1IIY/WzE1fS9iBCn++6Xvnsrg7Pmb+viVK0d0XdDyW2FMb 6Pg2H3dwB7NiLf/dY6L6OdhU1yOKOBCXBpc8EUL8f02G/5ibHROD6jZ7lgs1JlJXxwKlLC yPE7sSdZRJsPv/KSbFucr11LO/s4mGHz7JElVPxiJ8JKybe4ZwaWqWsO81A/8fZ43EPFzq Frb/qwPgjsh9WQS4kqJuVmj5Dqu1s1LJIUuTpPBUREJo5GBFUD1OL0azBHoTWg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1768991830; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CFbv3innd7HXx9Lftsndv4Fl9YuV0CRxqdAvyD+Stn4=; b=FmB8qQFOXkqPezliC7PazAxhbIqoqq89jDdomOyo/VGDego9OTqbGuF0z5HuSRAM7zmiyE MmLUWygaNMbSvRBQ== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/urgent] clocksource: Reduce watchdog readout delay limit to prevent false positives Cc: Daniel J Blueman , Thomas Gleixner , "Paul E. McKenney" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <87bjjxc9dq.ffs@tglx> References: <87bjjxc9dq.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <176899182593.510.16384647073619939928.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the timers/urgent branch of tip: Commit-ID: c06343be0b4e03fe319910dd7a5d5b9929e1c0cb Gitweb: https://git.kernel.org/tip/c06343be0b4e03fe319910dd7a5d5b992= 9e1c0cb Author: Thomas Gleixner AuthorDate: Wed, 17 Dec 2025 18:21:05 +01:00 Committer: Thomas Gleixner CommitterDate: Wed, 21 Jan 2026 11:33:11 +01:00 clocksource: Reduce watchdog readout delay limit to prevent false positives The "valid" readout delay between the two reads of the watchdog is larger than the valid delta between the resulting watchdog and clocksource intervals, which results in false positive watchdog results. Assume TSC is the clocksource and HPET is the watchdog and both have a uncertainty margin of 250us (default). The watchdog readout does: 1) wdnow =3D read(HPET); 2) csnow =3D read(TSC); 3) wdend =3D read(HPET); The valid window for the delta between #1 and #3 is calculated by the uncertainty margins of the watchdog and the clocksource: m =3D 2 * watchdog.uncertainty_margin + cs.uncertainty margin; which results in 750us for the TSC/HPET case. The actual interval comparison uses a smaller margin: m =3D watchdog.uncertainty_margin + cs.uncertainty margin; which results in 500us for the TSC/HPET case. That means the following scenario will trigger the watchdog: Watchdog cycle N: 1) wdnow[N] =3D read(HPET); 2) csnow[N] =3D read(TSC); 3) wdend[N] =3D read(HPET); Assume the delay between #1 and #2 is 100us and the delay between #1 and Watchdog cycle N + 1: 4) wdnow[N + 1] =3D read(HPET); 5) csnow[N + 1] =3D read(TSC); 6) wdend[N + 1] =3D read(HPET); If the delay between #4 and #6 is within the 750us margin then any delay between #4 and #5 which is larger than 600us will fail the interval check and mark the TSC unstable because the intervals are calculated against the previous value: wd_int =3D wdnow[N + 1] - wdnow[N]; cs_int =3D csnow[N + 1] - csnow[N]; Putting the above delays in place this results in: cs_int =3D (wdnow[N + 1] + 610us) - (wdnow[N] + 100us); -> cs_int =3D wd_int + 510us; which is obviously larger than the allowed 500us margin and results in marking TSC unstable. Fix this by using the same margin as the interval comparison. If the delay between two watchdog reads is larger than that, then the readout was either disturbed by interconnect congestion, NMIs or SMIs. Fixes: 4ac1dd3245b9 ("clocksource: Set cs_watchdog_read() checks based on .= uncertainty_margin") Reported-by: Daniel J Blueman Signed-off-by: Thomas Gleixner Reviewed-by: Paul E. McKenney Tested-by: Paul E. McKenney Link: https://lore.kernel.org/lkml/20250602223251.496591-1-daniel@quora.org/ Link: https://patch.msgid.link/87bjjxc9dq.ffs@tglx --- kernel/time/clocksource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index a1890a0..df71949 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -252,7 +252,7 @@ enum wd_read_status { =20 static enum wd_read_status cs_watchdog_read(struct clocksource *cs, u64 *c= snow, u64 *wdnow) { - int64_t md =3D 2 * watchdog->uncertainty_margin; + int64_t md =3D watchdog->uncertainty_margin; unsigned int nretries, max_retries; int64_t wd_delay, wd_seq_delay; u64 wd_end, wd_end2;