Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1332680lqe; Mon, 8 Apr 2024 06:14:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVtB/7xuBXSamldsfYPWoNqcD/AT1i5nd8AmJWeArCKJW7PZqUhQjdQZMjMc237sRQbTmIXbOkZxfQP5znGHmoJPxJPaL5jggk7Xb31tA== X-Google-Smtp-Source: AGHT+IERnv3TfSJMYVwIFw/841gDi1YbaWou1T3FJ0MBYCXHmvzRUtQ0FsAcNzGtuTHN91Q+6zIP X-Received: by 2002:a05:6102:3a14:b0:479:f805:fe87 with SMTP id b20-20020a0561023a1400b00479f805fe87mr3098634vsu.2.1712582051226; Mon, 08 Apr 2024 06:14:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712582051; cv=pass; d=google.com; s=arc-20160816; b=hJx3yXpSFLtuPoVxf1Na3KMq2GLNUd9ELVbbEQAYDlC3v56aEM/6pwqMXEZA9ZXUit 5JzkvokeW4TkWl+WQqXV7XLBicPLypEtEF6guyK8jZIUHZOp0p5m33f7Lc8awTDTh4zS TIkfYKqXLTPLH+dciuAODwX9NwA3F7tnv/giGhbENMjcgGkh6EE3c4oCEcGnOWcbsTd5 8PVKjXXqSYTDKyJxPfqSIh+E1YOVwfBqkrJx4mA0g9h/q4aYp4vOQuRztmG43hkPLkbi K3zTdbIhpw7FLlj2FOxo+i16xxH2tyP97fRJ7NT2YXyUN3dhCzlEOzf3Kmf+/H7U7jzj +dzw== 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=jeXPe8gQog6JIW9GW2kibBQc1KRF2vtnIvQehR82aJw=; fh=HIrP3i0WQwu8zLnKtb1acHgteo695uCSG6Yk5OndRkw=; b=yZdvEdISZhS2Ir/Ytc8RJ479tLC4hf7amQznuLW9RlkcUnQUW9i0HfyPzv67qQf1XY /GS6HVnf1RIp9FrLJRqyQPY/MGMxb5thAa3HIwDIfabkmQi/FtaZIwXdprZXtAo1aJt4 hE1oVGaEB5T7o6WnKo7LiQFY2cat2kOxPdcxkB7SnYR5WzExYlZyGwzct8SrJBO5EF0B O4hbIccn3TcnGXHkp6kW2vpCThT3xCOB/p5hkk61evPb/0AmpjQin4Mur6uou/i54TT9 ChbSGT/j7iy9PJWFsYNkba4tMeGJnYaeKombMbyHajfqEBZr8X9bkuJSK0RALssEtq1u DWHA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=25c1YJ+G; 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-135398-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135398-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ia17-20020a0561024b1100b00479d5f3fe20si1081053vsb.358.2024.04.08.06.14.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 06:14:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135398-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=25c1YJ+G; 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-135398-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135398-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 44F571C239A3 for ; Mon, 8 Apr 2024 13:12:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 711AA7C0B2; Mon, 8 Apr 2024 13:10:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="25c1YJ+G"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="h0qfD6k7" 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 B5C5D7E772; Mon, 8 Apr 2024 13:10:41 +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=1712581843; cv=none; b=QOeokV3zeBOLneSuDaJqGgQOf1O721mVggZvFpNdaIqzrMTzU4a3K5MNnuKTMg2yWujfiL/Tnrsr6vTunwgpBGrPFk2NnZtbi1YfTO2k8sgrtN9O3ZtcYPYxk9vsYDar2JUqF21tonQ97bLryziZDtcw/ey+R63uhNRjaAi8/9M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712581843; c=relaxed/simple; bh=kcdcasg4HaSBEhxHxzwPiNfUiM18+7rnpObeoF5pT7Y=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=EoneXsVS7vSzOnD0dK3Go5+XCsl2DTAZfH8BF920V0/tOP9I61ixafa6X7h65DaM5TtKX55IcJcyQ9lhK/zD3grnR2N2jtbVmzv43Vx5PjHq5tNV1ZA3PhbodGb0gCkxhCKe/WYMU4gUi86nxvJDFFLEMIxeLvHdUMsMOXjseWE= 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=25c1YJ+G; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=h0qfD6k7; 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, 08 Apr 2024 13:10:38 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1712581839; 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=jeXPe8gQog6JIW9GW2kibBQc1KRF2vtnIvQehR82aJw=; b=25c1YJ+GHLIHZnEC1ABJXEN571ly+P4vb12Ql/dcdowEjz3pBZ7XC4q2OeRGAWkNfvjosv V17sIQfdDtTe/H7PjNQqTQoSQAkrF1wuqxkRWPYVS0xVLn5XLepplEW38dvPkIpYk1Ktm9 g1QcsRkIJa/nGJsR+wZJToSJcgR89tnQTH6052j/6BOiiFq+39yXV4Krp86k+4O8nSzfUp aLBVpuPRJ/49InvqckICinek0UY6gxVyYJo1zFTIBPFBtdcgKqtF+gQ8OWbuxShlnYKOD0 rH+LMMOpHYTERDqKMHEWd2bjUMZzGNXywJV5QL7eW/iIv/18R4WyxBkTo62/gg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1712581839; 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=jeXPe8gQog6JIW9GW2kibBQc1KRF2vtnIvQehR82aJw=; b=h0qfD6k7v9aAPZNxC2TYoKfRhcYHxqMD3XbgQagHLC1pj5g9wp6CIlq+ZOd2q5QWaSJLq0 JCIgnoj3/ra0WkDQ== From: "tip-bot2 for Adrian Hunter" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] timekeeping: Move timekeeping helper functions Cc: Thomas Gleixner , Adrian Hunter , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240325064023.2997-10-adrian.hunter@intel.com> References: <20240325064023.2997-10-adrian.hunter@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <171258183894.10875.8545999016373889170.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: e98ab3d4159e6bab4e391f376a1e548dd4d32524 Gitweb: https://git.kernel.org/tip/e98ab3d4159e6bab4e391f376a1e548dd4d32524 Author: Adrian Hunter AuthorDate: Mon, 25 Mar 2024 08:40:13 +02:00 Committer: Thomas Gleixner CommitterDate: Mon, 08 Apr 2024 15:03:07 +02:00 timekeeping: Move timekeeping helper functions Move timekeeping helper functions to prepare for their reuse. Suggested-by: Thomas Gleixner Signed-off-by: Adrian Hunter Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20240325064023.2997-10-adrian.hunter@intel.com --- kernel/time/timekeeping.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index b58dffc..3375f0a 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -381,23 +381,31 @@ static inline u64 timekeeping_delta_to_ns(const struct tk_read_base *tkr, u64 de return nsec; } -static inline u64 timekeeping_get_ns(const struct tk_read_base *tkr) +static inline u64 timekeeping_cycles_to_ns(const struct tk_read_base *tkr, u64 cycles) { u64 delta; - delta = timekeeping_get_delta(tkr); + /* calculate the delta since the last update_wall_time */ + delta = clocksource_delta(cycles, tkr->cycle_last, tkr->mask); return timekeeping_delta_to_ns(tkr, delta); } -static inline u64 timekeeping_cycles_to_ns(const struct tk_read_base *tkr, u64 cycles) +static __always_inline u64 fast_tk_get_delta_ns(struct tk_read_base *tkr) { - u64 delta; + u64 delta, cycles = tk_clock_read(tkr); - /* calculate the delta since the last update_wall_time */ delta = clocksource_delta(cycles, tkr->cycle_last, tkr->mask); return timekeeping_delta_to_ns(tkr, delta); } +static inline u64 timekeeping_get_ns(const struct tk_read_base *tkr) +{ + u64 delta; + + delta = timekeeping_get_delta(tkr); + return timekeeping_delta_to_ns(tkr, delta); +} + /** * update_fast_timekeeper - Update the fast and NMI safe monotonic timekeeper. * @tkr: Timekeeping readout base from which we take the update @@ -431,14 +439,6 @@ static void update_fast_timekeeper(const struct tk_read_base *tkr, memcpy(base + 1, base, sizeof(*base)); } -static __always_inline u64 fast_tk_get_delta_ns(struct tk_read_base *tkr) -{ - u64 delta, cycles = tk_clock_read(tkr); - - delta = clocksource_delta(cycles, tkr->cycle_last, tkr->mask); - return timekeeping_delta_to_ns(tkr, delta); -} - static __always_inline u64 __ktime_get_fast_ns(struct tk_fast *tkf) { struct tk_read_base *tkr;