From nobody Mon Feb 9 01:44:56 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (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 ECEDC5676F; Fri, 8 Mar 2024 13:16:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709903792; cv=none; b=O6na9JZaFLVvSmu/+VyF0aoHkPQUr/gDD7F/gf6Ue6TGHoXaI/Ih5pO2VpKRMfkOEtMJqQ0gwyrcYVU5iT3V/xUP7ve/A6OGeJ6W0LP6ux7GjT+SZM6h4axHeZrsJjwc2gsy4XvvVOkEydC/+v0b2/Y0QCDWjgY0tFcQGlsxaHg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709903792; c=relaxed/simple; bh=zboSVI3HgVZXbpDBNnsTotqgGm69H9hHwUY1hZ67rA8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=M855xKmvO3Mfx+0dyRrH2yT9VcUHMELrNIjFtWGZFMV7BvW2FTKAXF6YzOEmnPa6eSv0v8uwkBgUXKpVEOVslgzZwYrrlX8yOHULlXC3fi/IzGSUUBIGrhOWAR2/WBNfPbVk+rX9uxXhbDRBp7YY2h5bNjjsHJB0uwTYlLMJ3T0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=AJeLwDrF; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="AJeLwDrF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709903791; x=1741439791; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zboSVI3HgVZXbpDBNnsTotqgGm69H9hHwUY1hZ67rA8=; b=AJeLwDrFChumvLrBcVDDcwJ2IZDo/B+x7XSl9UYaAL++dgpQCa9IAqqT zFn9SMdcvy+vIHoGotWQlsBzpxvEvBtJcotG0CghSQ6aaJue7kqlKh6eV HRykUwuCB10l1H1RwN2aqdIEyiW/DMMyJBZsOo7YBVTslmfdpOycUTuug jZc9zgWMo5QTnuFnkONSAd75Xe7qCZJvgG8a3N9gdjBUMmn/JA/a1TlYN ZNlcRyOfGO6ac7iPng3bBSIxWCWgRVDakYchBloQ0rqQtktJiy6dyu6B/ HXFgLYm4z/1+tkPrwgizuWT4f9CQ/OVVZ8YHtd26t9ehUaji4F878gNCF w==; X-IronPort-AV: E=McAfee;i="6600,9927,11006"; a="15342636" X-IronPort-AV: E=Sophos;i="6.07,109,1708416000"; d="scan'208";a="15342636" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2024 05:16:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,109,1708416000"; d="scan'208";a="15161489" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.249.46.63]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2024 05:16:23 -0800 From: Adrian Hunter To: Thomas Gleixner Cc: Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Aneesh Kumar K.V" , "Naveen N. Rao" , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Andy Lutomirski , Vincenzo Frascino , John Stultz , Stephen Boyd , Peter Zijlstra , Randy Dunlap , Bjorn Helgaas , Arnd Bergmann , Anna-Maria Behnsen , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Subject: [PATCH 09/19] timekeeping: Move timekeeping helper functions Date: Fri, 8 Mar 2024 15:15:02 +0200 Message-Id: <20240308131512.44324-10-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240308131512.44324-1-adrian.hunter@intel.com> References: <20240308131512.44324-1-adrian.hunter@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Move timekeeping helper functions to prepare for their reuse. Suggested-by: Thomas Gleixner Signed-off-by: Adrian Hunter --- kernel/time/timekeeping.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index b58dffc58a8f..3375f0a6400f 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -381,6 +381,23 @@ static inline u64 timekeeping_delta_to_ns(const struct= tk_read_base *tkr, u64 de return nsec; } =20 +static inline u64 timekeeping_cycles_to_ns(const struct tk_read_base *tkr,= u64 cycles) +{ + u64 delta; + + /* calculate the delta since the last update_wall_time */ + delta =3D clocksource_delta(cycles, tkr->cycle_last, tkr->mask); + return timekeeping_delta_to_ns(tkr, delta); +} + +static __always_inline u64 fast_tk_get_delta_ns(struct tk_read_base *tkr) +{ + u64 delta, cycles =3D tk_clock_read(tkr); + + delta =3D 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; @@ -389,15 +406,6 @@ static inline u64 timekeeping_get_ns(const struct tk_r= ead_base *tkr) return timekeeping_delta_to_ns(tkr, delta); } =20 -static inline u64 timekeeping_cycles_to_ns(const struct tk_read_base *tkr,= u64 cycles) -{ - u64 delta; - - /* calculate the delta since the last update_wall_time */ - delta =3D clocksource_delta(cycles, tkr->cycle_last, tkr->mask); - return timekeeping_delta_to_ns(tkr, delta); -} - /** * update_fast_timekeeper - Update the fast and NMI safe monotonic timekee= per. * @tkr: Timekeeping readout base from which we take the update @@ -431,14 +439,6 @@ static void update_fast_timekeeper(const struct tk_rea= d_base *tkr, memcpy(base + 1, base, sizeof(*base)); } =20 -static __always_inline u64 fast_tk_get_delta_ns(struct tk_read_base *tkr) -{ - u64 delta, cycles =3D tk_clock_read(tkr); - - delta =3D 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; --=20 2.34.1