All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Yogesh Lal <quic_ylal@quicinc.com>
Cc: <mark.rutland@arm.com>, <daniel.lezcano@linaro.org>,
	<tglx@linutronix.de>, <linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>
Subject: Re: ERRATUM_858921 is broken on 5.15 kernel
Date: Mon, 09 Jan 2023 10:39:32 +0000	[thread overview]
Message-ID: <86ilhgng9n.wl-maz@kernel.org> (raw)
In-Reply-To: <9aafa9d9-70f8-67de-df43-e2fb282a4a67@quicinc.com>

On Mon, 09 Jan 2023 06:52:20 +0000,
Yogesh Lal <quic_ylal@quicinc.com> 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.

WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <maz@kernel.org>
To: Yogesh Lal <quic_ylal@quicinc.com>
Cc: <mark.rutland@arm.com>, <daniel.lezcano@linaro.org>,
	<tglx@linutronix.de>, <linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>
Subject: Re: ERRATUM_858921 is broken on 5.15 kernel
Date: Mon, 09 Jan 2023 10:39:32 +0000	[thread overview]
Message-ID: <86ilhgng9n.wl-maz@kernel.org> (raw)
In-Reply-To: <9aafa9d9-70f8-67de-df43-e2fb282a4a67@quicinc.com>

On Mon, 09 Jan 2023 06:52:20 +0000,
Yogesh Lal <quic_ylal@quicinc.com> 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

  reply	other threads:[~2023-01-09 10:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-05 13:33 ERRATUM_858921 is broken on 5.15 kernel Yogesh Lal
2023-01-05 13:33 ` Yogesh Lal
2023-01-05 14:12 ` Mark Rutland
2023-01-05 14:12   ` Mark Rutland
2023-01-06 16:38   ` Yogesh Lal
2023-01-06 16:38     ` Yogesh Lal
2023-01-05 14:22 ` Marc Zyngier
2023-01-05 14:22   ` Marc Zyngier
2023-01-09  6:52   ` Yogesh Lal
2023-01-09  6:52     ` Yogesh Lal
2023-01-09 10:39     ` Marc Zyngier [this message]
2023-01-09 10:39       ` Marc Zyngier
2023-01-12 12:47       ` Yogesh Lal
2023-01-12 12:47         ` Yogesh Lal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86ilhgng9n.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=quic_ylal@quicinc.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.