Commit a862fc22 authored by Marc Zyngier's avatar Marc Zyngier Committed by Will Deacon

clocksource/arm_arch_timer: Remove use of workaround static key

The use of a static key in a hotplug path has proved to be a real
nightmare, and makes it impossible to have scream-free lockdep
kernel.

Let's remove the static key altogether, and focus on something saner.
Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
Acked-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent 57f27666
...@@ -45,13 +45,9 @@ ...@@ -45,13 +45,9 @@
(__wa && __wa->h) ? __wa->h : arch_timer_##h; \ (__wa && __wa->h) ? __wa->h : arch_timer_##h; \
}) })
extern struct static_key_false arch_timer_read_ool_enabled;
#define needs_unstable_timer_counter_workaround() \
static_branch_unlikely(&arch_timer_read_ool_enabled)
#else #else
#define has_erratum_handler(h) false #define has_erratum_handler(h) false
#define erratum_handler(h) (arch_timer_##h) #define erratum_handler(h) (arch_timer_##h)
#define needs_unstable_timer_counter_workaround() false
#endif #endif
enum arch_timer_erratum_match_type { enum arch_timer_erratum_match_type {
......
...@@ -365,8 +365,6 @@ static u32 notrace sun50i_a64_read_cntv_tval_el0(void) ...@@ -365,8 +365,6 @@ static u32 notrace sun50i_a64_read_cntv_tval_el0(void)
DEFINE_PER_CPU(const struct arch_timer_erratum_workaround *, timer_unstable_counter_workaround); DEFINE_PER_CPU(const struct arch_timer_erratum_workaround *, timer_unstable_counter_workaround);
EXPORT_SYMBOL_GPL(timer_unstable_counter_workaround); EXPORT_SYMBOL_GPL(timer_unstable_counter_workaround);
DEFINE_STATIC_KEY_FALSE(arch_timer_read_ool_enabled);
EXPORT_SYMBOL_GPL(arch_timer_read_ool_enabled);
static void erratum_set_next_event_tval_generic(const int access, unsigned long evt, static void erratum_set_next_event_tval_generic(const int access, unsigned long evt,
struct clock_event_device *clk) struct clock_event_device *clk)
...@@ -537,12 +535,6 @@ void arch_timer_enable_workaround(const struct arch_timer_erratum_workaround *wa ...@@ -537,12 +535,6 @@ void arch_timer_enable_workaround(const struct arch_timer_erratum_workaround *wa
per_cpu(timer_unstable_counter_workaround, i) = wa; per_cpu(timer_unstable_counter_workaround, i) = wa;
} }
/*
* Use the locked version, as we're called from the CPU
* hotplug framework. Otherwise, we end-up in deadlock-land.
*/
static_branch_enable_cpuslocked(&arch_timer_read_ool_enabled);
/* /*
* Don't use the vdso fastpath if errata require using the * Don't use the vdso fastpath if errata require using the
* out-of-line counter accessor. We may change our mind pretty * out-of-line counter accessor. We may change our mind pretty
...@@ -558,7 +550,7 @@ void arch_timer_enable_workaround(const struct arch_timer_erratum_workaround *wa ...@@ -558,7 +550,7 @@ void arch_timer_enable_workaround(const struct arch_timer_erratum_workaround *wa
static void arch_timer_check_ool_workaround(enum arch_timer_erratum_match_type type, static void arch_timer_check_ool_workaround(enum arch_timer_erratum_match_type type,
void *arg) void *arg)
{ {
const struct arch_timer_erratum_workaround *wa; const struct arch_timer_erratum_workaround *wa, *__wa;
ate_match_fn_t match_fn = NULL; ate_match_fn_t match_fn = NULL;
bool local = false; bool local = false;
...@@ -582,16 +574,13 @@ static void arch_timer_check_ool_workaround(enum arch_timer_erratum_match_type t ...@@ -582,16 +574,13 @@ static void arch_timer_check_ool_workaround(enum arch_timer_erratum_match_type t
if (!wa) if (!wa)
return; return;
if (needs_unstable_timer_counter_workaround()) { __wa = __this_cpu_read(timer_unstable_counter_workaround);
const struct arch_timer_erratum_workaround *__wa; if (__wa && wa != __wa)
__wa = __this_cpu_read(timer_unstable_counter_workaround); pr_warn("Can't enable workaround for %s (clashes with %s\n)",
if (__wa && wa != __wa) wa->desc, __wa->desc);
pr_warn("Can't enable workaround for %s (clashes with %s\n)",
wa->desc, __wa->desc);
if (__wa) if (__wa)
return; return;
}
arch_timer_enable_workaround(wa, local); arch_timer_enable_workaround(wa, local);
pr_info("Enabling %s workaround for %s\n", pr_info("Enabling %s workaround for %s\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment