Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1243831rdb; Mon, 19 Feb 2024 08:36:13 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU2Wc7CE9HO6qCeWhgXQKBDV/5ck1PdrAvo+SzVrLdW3iyQpGzNdVufHHg0vSxIFCxQt4f+2SvJbgGwCZRE8Wnn+aCVIYJy6SHkgzlwOQ== X-Google-Smtp-Source: AGHT+IFhayZdb1R9H+e/4E9Bd6FaPCP26Nl2TF1j1Wa5spuRqskwQt/HX4B7XhLapPnYmIjlW5pg X-Received: by 2002:aa7:8698:0:b0:6e2:b25d:a999 with SMTP id d24-20020aa78698000000b006e2b25da999mr6720002pfo.34.1708360572902; Mon, 19 Feb 2024 08:36:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708360572; cv=pass; d=google.com; s=arc-20160816; b=vve7QA2KgDXEyevwrVY/utb3VzlkZKK04+Ma4w6Mqxm/6tLedRI3O6o5JE2bTSfUQK /63jKBK5H6/jGeL+SwuuMQkfdGtJ84HL6zyif//lbNCkfvl5bOlPqd3HeyYX6DPR16aT oZiquyf/1g3Fo7jAjw77fm1m4kCRYBKP3aI/c45XirLttAODzbqYZbo3x8BeYcNweFXX JpxSK5jPlptvOrtbwkwZ3wb8GSAq/tWerKtlh4H8WfME0QuZQVqF2ACnvYxyTvtmZr2D Zkt6ePb4IKWdwYMbwdJNXdFoWrrXPJf3VGWbKpVBVfEBawb0SEbga1aFxSjPy6/463dX FECA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=Pk7T2jpSR0byywKBG5od7jkk31qcfovIG9EFCImsOd0=; fh=B4vXv6JWaA8VKOxUe7McRUgOfBy3+ZAyf66jm8YfOLA=; b=JasceAokxquSZZsI4DP9ndrd6hD/PX01sSsfmCH98zJBtCM5v9Qa+wM5QUEbc45IPe cCL9E7xJjs/AcZpR4Qr8JV+8D1kY21qfe8YxwqIfvsrGTOQ8iNbd1EpzdbF/kob28+Q0 JdhfisCouFE+fc9YsGahsxNWo/hjb8Wc3AqdkXy38ufp8BCAUPjOJO01CmtDvTCTlNG4 1cK/YXR1tPIrEUbPaNFkbydVGNVQMcI1TI9X4yJgKYqQiWbodU6IfhJPl9I9UhzPcfSa 1vdhMWvJSb23ySxTq6NkKxARJaZm5hycU022ScDkrx+Uiary0J9n6QxmUC9EPbbqCgh8 kcgQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=V2zUSuX8; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-71688-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71688-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 71-20020a63004a000000b005cd8b5dfe9csi4817944pga.491.2024.02.19.08.36.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 08:36:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71688-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=@linutronix.de header.s=2020 header.b=V2zUSuX8; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-71688-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71688-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 B9E1B285268 for ; Mon, 19 Feb 2024 16:35:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 77B2240BEF; Mon, 19 Feb 2024 16:35:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="V2zUSuX8"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="UQsJZDNp" 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 40D683F9F8; Mon, 19 Feb 2024 16:35:19 +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=1708360521; cv=none; b=pHSonDjs3QjqWItgR7n+rBP7KB/1NtlNGBr9jk6DIeQBPFZxWTXtzr0scareYXclAEfGjXRqlI/w4QqlYzA7W7vLOauLL/Ls6hscRG9/GiSfRo8SOyy0X2hlBXmkH9E5iTFhltCJaNCo2k3KjXHPgRqRJbNx6OP51yXQDhpjX+4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708360521; c=relaxed/simple; bh=0/qGMTY0QzX5yGfg8KCT/DD2MfErUyzudLGCN7wutkA=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=Nm2NySnp6UaMEaZcdQoJ/cNjc3/prF6czQxqymdBqkJwt/4zV9bw0hVCEptSlzRWbSzbDXrL9p9bBgZDyPDn5w7s45dFFjeE1d1PoW9O6RT5obP7uhL1D410aV/XIWb5fSHE6l6t1PcOvGOgMTfCenFx+6HRMvvItAsrSHC9K1I= 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=V2zUSuX8; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=UQsJZDNp; 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 Date: Mon, 19 Feb 2024 16:35:17 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708360518; 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=Pk7T2jpSR0byywKBG5od7jkk31qcfovIG9EFCImsOd0=; b=V2zUSuX8g4477CHqws2anB3wJH76GLShjMu1UjcuiDdOgULWAqvutYwepKWjsmVoFuP5J8 20PH5USRSQ5zcMLXoHBpFRf7Cr1ChuCC7y+UXMKdFHzUiNbSV4e9g2gtI/hVu0cN/R0po5 u82VdFfGizQ3mqLrChcZikGGB3POnA9BDQkuthEd5ij0uBmIz7M3NvVHyyZvFAZ3KLIqXt jIy7xOSmG41Jn2K9Zg062jAkW28V0k9+Fj7jll574Wo1tPgMarvfxxhdb2wD9cnnsv+UmB vSODrbKZhzDD+9Obtp3Qqg9f32g8JGWeGeWQj2AO5fOYFbZuzs6ZCbsKvv4vag== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708360518; 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=Pk7T2jpSR0byywKBG5od7jkk31qcfovIG9EFCImsOd0=; b=UQsJZDNpYsRm30+4+Akfy08+Mbi674FcHEThCCgIX1U81WAY5sAeBy8J+qhLUTtm1vPniA Kze4/vIexvCKNRBg== From: "tip-bot2 for Peter Hilber" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] timekeeping: Fix cross-timestamp interpolation on counter wrap Cc: Peter Hilber , Thomas Gleixner , John Stultz , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231218073849.35294-2-peter.hilber@opensynergy.com> References: <20231218073849.35294-2-peter.hilber@opensynergy.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170836051741.398.13453271590417776552.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: 7bit The following commit has been merged into the timers/core branch of tip: Commit-ID: 84dccadd3e2a3f1a373826ad71e5ced5e76b0c00 Gitweb: https://git.kernel.org/tip/84dccadd3e2a3f1a373826ad71e5ced5e76b0c00 Author: Peter Hilber AuthorDate: Mon, 18 Dec 2023 08:38:39 +01:00 Committer: Thomas Gleixner CommitterDate: Mon, 19 Feb 2024 12:18:51 +01:00 timekeeping: Fix cross-timestamp interpolation on counter wrap cycle_between() decides whether get_device_system_crosststamp() will interpolate for older counter readings. cycle_between() yields wrong results for a counter wrap-around where after < before < test, and for the case after < test < before. Fix the comparison logic. Fixes: 2c756feb18d9 ("time: Add history to cross timestamp interface supporting slower devices") Signed-off-by: Peter Hilber Signed-off-by: Thomas Gleixner Acked-by: John Stultz Link: https://lore.kernel.org/r/20231218073849.35294-2-peter.hilber@opensynergy.com --- kernel/time/timekeeping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 266d028..8f35455 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1186,7 +1186,7 @@ static bool cycle_between(u64 before, u64 test, u64 after) { if (test > before && test < after) return true; - if (test < before && before > after) + if (before > after && (test > before || test < after)) return true; return false; }