From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 53E98C5479D for ; Mon, 9 Jan 2023 10:40:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Id5ZpOUvD73kgKH7pl+nxJKbagx47rLI9BxI5jRiXqA=; b=XZ+RwCfesuSJA+ RvHlokGZkiZz3ivt6JZWGWcVjK5J5wVvpjMUpj6DxCjoD2ICn4MaaUqwA8idrHajKrGsMf4XueS6f NTWW/SZ5FI5uxOHt/vw6fNdFLk0AdDXxd55vb3NhJ0Ux7q02oVvXovdv6GpN1FuoMHLC5A7IcOKMB ViOg1pamA8csYUbK4XyAA7sKiHAKsFQPZIY5phq5BugWf6bgw0bt211JUU8iflSXHnw5DonC5qHqP s0o4TTiw86Xpz9VbfLpWR4M5/5BoLbtW6UANT4nC9MySOGPgWlRlJ13n8JjYHvwe6qeME8UOBt7tz 8ehvYdfR0/acJg06LLSA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pEpZC-000rSw-Ut; Mon, 09 Jan 2023 10:39:47 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pEpZ4-000rQn-IQ for linux-arm-kernel@lists.infradead.org; Mon, 09 Jan 2023 10:39:44 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 379ABB80D6E; Mon, 9 Jan 2023 10:39:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF686C433D2; Mon, 9 Jan 2023 10:39:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673260774; bh=p3m9nFnxIEV1XvVP6V4T6cIP+Jeo7SIAprckOCbbr3c=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=hjzFunT7A5CN0XQsMWeezjm5NYJ392xMJxI4hx6s0A0kqkG8IT9O7hnZIYPgfMuXB Aky20Kud7Oo5SfSo4SuiRrM8/1IWT5Cqk6JpBBEmVHUnZqlYzvM/e/WrlcBfwzP4ow pszHD17A4P+Y8V3Zpih1CVQSO3v5oGxWFYeD0Z4m106KMuhStSS5KxxAmyh5eUN2V4 2tMxjnUuPTynAwi7MEyHcHDJaGWYWEOl+ecDfLEOgKuUULB6XlxIwG0AlQxo8Eaezi bH9nWZa13w7XBcNRi7d5U4bTxq/3UPp4mfZIaZrESKbswSxGuWC8ySoKbKMzI17k9d Twkbh+mrf4wSA== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pEpYy-000F8K-Kw; Mon, 09 Jan 2023 10:39:32 +0000 Date: Mon, 09 Jan 2023 10:39:32 +0000 Message-ID: <86ilhgng9n.wl-maz@kernel.org> From: Marc Zyngier To: Yogesh Lal Cc: , , , , "linux-kernel@vger.kernel.org" , "linux-arm-msm@vger.kernel.org" Subject: Re: ERRATUM_858921 is broken on 5.15 kernel In-Reply-To: <9aafa9d9-70f8-67de-df43-e2fb282a4a67@quicinc.com> References: <86sfgpnjsg.wl-maz@kernel.org> <9aafa9d9-70f8-67de-df43-e2fb282a4a67@quicinc.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: quic_ylal@quicinc.com, mark.rutland@arm.com, daniel.lezcano@linaro.org, tglx@linutronix.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230109_023939_296726_7D3A13A6 X-CRM114-Status: GOOD ( 20.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 09 Jan 2023 06:52:20 +0000, Yogesh Lal wrote: > > tested it on affected h/w but looks like sched_clock is still pointing > to !arch_timer_counter_has_wa() function calls, > may be due to sched_clock_register will register once during non > errata impacted core booting. Ah, of course. We register the function itself instead of an indirection. Please try this on top of the previous patch. Thanks, M. diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index a7cf0a2c86d3..8232c86b9e7c 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -217,7 +217,12 @@ static notrace u64 arch_counter_get_cntvct(void) * to exist on arm64. arm doesn't use this before DT is probed so even * if we don't have the cp15 accessors we won't have a problem. */ -u64 (*arch_timer_read_counter)(void) __ro_after_init = arch_counter_get_cntvct; +static u64 (*__arch_timer_read_counter)(void) __ro_after_init = arch_counter_get_cntvct; + +u64 arch_timer_read_counter(void) +{ + return __arch_timer_read_counter(); +} EXPORT_SYMBOL_GPL(arch_timer_read_counter); static u64 arch_counter_read(struct clocksource *cs) @@ -595,7 +600,7 @@ void arch_timer_enable_workaround(const struct arch_timer_erratum_workaround *wa if (wa->read_cntvct_el0 || wa->read_cntpct_el0) { atomic_set(&timer_unstable_counter_workaround_in_use, 1); - arch_timer_read_counter = arch_counter_get_read_fn(); + __arch_timer_read_counter = arch_counter_get_read_fn(); } /* @@ -1103,10 +1108,10 @@ static void __init arch_counter_register(unsigned type) /* Register the CP15 based counter if we have one */ if (type & ARCH_TIMER_TYPE_CP15) { - arch_timer_read_counter = arch_counter_get_read_fn(); + __arch_timer_read_counter = arch_counter_get_read_fn(); clocksource_counter.vdso_clock_mode = vdso_default; } else { - arch_timer_read_counter = arch_counter_get_cntvct_mem; + __arch_timer_read_counter = arch_counter_get_cntvct_mem; } width = arch_counter_get_width(); diff --git a/include/clocksource/arm_arch_timer.h b/include/clocksource/arm_arch_timer.h index e3c3816d19ba..3ac297a756e8 100644 --- a/include/clocksource/arm_arch_timer.h +++ b/include/clocksource/arm_arch_timer.h @@ -89,7 +89,7 @@ struct arch_timer_mem { #ifdef CONFIG_ARM_ARCH_TIMER extern u32 arch_timer_get_rate(void); -extern u64 (*arch_timer_read_counter)(void); +extern u64 arch_timer_read_counter(void); extern struct arch_timer_kvm_info *arch_timer_get_kvm_info(void); extern bool arch_timer_evtstrm_available(void); -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel