From patchwork Mon Feb 19 16:35:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 203173 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1397659dyc; Mon, 19 Feb 2024 08:35:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX6ga0AlriJjamt+V7otv1XwEhuLOi8QseJYLoDyP74CBrHodmiRn6YFDG+PpZPZCaa12fjQMoUc5kCysFfsRHnxhLysg== X-Google-Smtp-Source: AGHT+IHhW3VovWEbMe8Kgjup0yH8/Zb2jqml4+Be2VWmQd9pxleeCw0CkPEKjJKXvvBGkZfNh/oU X-Received: by 2002:a50:ed10:0:b0:564:6d2b:2617 with SMTP id j16-20020a50ed10000000b005646d2b2617mr2767535eds.2.1708360559165; Mon, 19 Feb 2024 08:35:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708360559; cv=pass; d=google.com; s=arc-20160816; b=ZeBi0vWWogoOoGtH4vuGRCEL6n4VVOzpd88d5//1bedNno0/nhwp2DVftvYLnV+rE3 aT+WqpMQr6AKDdseCuXsO5TofcOyehJ8TDhnUZ0kVLXH+s3O7tohqAXV3eHGd1kAwFop feqR11fQyEk68zP0JEJdCFFtDHVP+d2wfi7RXNYZ+p/Om6pKQltGC0WzdV0kzabBYIeD SUY+2SBmmAAcV3PzHDU40/T6B4hfZbx29Im0zjUVQM2XTjEzZ7+bKw5u7L9Pk/QkrczH Pwo2nrAC9xgaiz6QgRrOvxHAl9JFWfYq//RWO/KNb2RmA2sPHm5lEY8uSKkB4itwABd7 oAgA== 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 header.b=UQsJZDNp; 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71688-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id b24-20020a50ccd8000000b00561f83ccb85si2629785edj.9.2024.02.19.08.35.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 08:35:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71688-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; 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 header.b=UQsJZDNp; 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71688-ouuuleilei=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 am.mirrors.kernel.org (Postfix) with ESMTPS id C56EC1F2353C for ; Mon, 19 Feb 2024 16:35:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4347041C89; Mon, 19 Feb 2024 16:35:24 +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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785604700902844689 X-GMAIL-MSGID: 1791345881749985447 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; }