Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5997817rwl; Mon, 9 Jan 2023 02:50:55 -0800 (PST) X-Google-Smtp-Source: AMrXdXujGPHoHMqMFUrEoVgDoEK9z0hVf/xZOkoOWr0zSV4beLEZLaOLpDha/ijsA+gtG7dPcVs7 X-Received: by 2002:a05:6402:888:b0:494:912d:303b with SMTP id e8-20020a056402088800b00494912d303bmr11875323edy.17.1673261455016; Mon, 09 Jan 2023 02:50:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673261455; cv=none; d=google.com; s=arc-20160816; b=uWbhgMBPHeEQTAnJeEQVPOYA6iuU+opCFBSePJscQ3WIFK6hazEgim2/6D0J3VApK/ pbXgKUTto1e/uJedK0oOaHfO7NRohIKFq50TWqVgkg2TdV2OW++th1qSZGlEIBgLznRf Te05TptcSeaZCr2qUz1HIxwikOcs1w8xFCtQ+KQCozjU6M7c8j+dSb2dRGPTsPHpd5k3 Xe4BjSvRws4r+Su1F3yP4TBP7B4c87BUjo2nAeGWgwFk/WHQGUjM9Uqn2gJIb94FHMe6 FvsTREUzrnFNvqcMq1vyB4yvuXSyvFUZ3CjVZ/x/Bd8D/RKrGPG0O8poe3i+v+CKWD73 AB/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=4/SMdlpMDNt7+l5A2lA3ULsU42KJv57XlZPomlPzQCU=; b=jSDRMMg/L0ZqWG6cG+AzZ5E6DGyN5k5LbuDYrAgjyrqWnwiihh5tCS/hlAdnTRTQCc VHoNtFBBW/reEw46N8bpPz47AbtUA4YTj5wbMg2Zpspy1c8wIG9toNAXBxrqcDwsJ8+Q U7yHGMiWLRcS22Xw3ftGoXW54JXW7ECZ0Mv76tTs7Oi7Rlik3OtVE8nJ5pR5fvHZ8wS2 T+LWrz/AoQyQlomncaB572LplNPniQvvwnEg/7R6r+q0iq1ppvm3b41aqAwflxGz5q/r ktXv97Ozbauo5xm6VDzHfL1EEKeA+SeRy8IQI5bsCRP2J563iN0Il7+pfC7gzULZNx/k fMRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hjzFunT7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y10-20020a056402134a00b00458e689f41fsi8361260edw.415.2023.01.09.02.50.42; Mon, 09 Jan 2023 02:50:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hjzFunT7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233330AbjAIKjk (ORCPT + 53 others); Mon, 9 Jan 2023 05:39:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233339AbjAIKji (ORCPT ); Mon, 9 Jan 2023 05:39:38 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88C0517891; Mon, 9 Jan 2023 02:39:37 -0800 (PST) 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 37CC7B80D79; 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") Content-Type: text/plain; charset=US-ASCII 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-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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.