Skip to content

Commit a862fc2

Browse files
Marc Zyngierwildea01
authored andcommitted
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: Mark Rutland <[email protected]> Acked-by: Daniel Lezcano <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Signed-off-by: Will Deacon <[email protected]>
1 parent 57f2766 commit a862fc2

File tree

2 files changed

+7
-22
lines changed

2 files changed

+7
-22
lines changed

arch/arm64/include/asm/arch_timer.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,9 @@
4545
(__wa && __wa->h) ? __wa->h : arch_timer_##h; \
4646
})
4747

48-
extern struct static_key_false arch_timer_read_ool_enabled;
49-
#define needs_unstable_timer_counter_workaround() \
50-
static_branch_unlikely(&arch_timer_read_ool_enabled)
5148
#else
5249
#define has_erratum_handler(h) false
5350
#define erratum_handler(h) (arch_timer_##h)
54-
#define needs_unstable_timer_counter_workaround() false
5551
#endif
5652

5753
enum arch_timer_erratum_match_type {

drivers/clocksource/arm_arch_timer.c

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,6 @@ static u32 notrace sun50i_a64_read_cntv_tval_el0(void)
365365
DEFINE_PER_CPU(const struct arch_timer_erratum_workaround *, timer_unstable_counter_workaround);
366366
EXPORT_SYMBOL_GPL(timer_unstable_counter_workaround);
367367

368-
DEFINE_STATIC_KEY_FALSE(arch_timer_read_ool_enabled);
369-
EXPORT_SYMBOL_GPL(arch_timer_read_ool_enabled);
370368

371369
static void erratum_set_next_event_tval_generic(const int access, unsigned long evt,
372370
struct clock_event_device *clk)
@@ -537,12 +535,6 @@ void arch_timer_enable_workaround(const struct arch_timer_erratum_workaround *wa
537535
per_cpu(timer_unstable_counter_workaround, i) = wa;
538536
}
539537

540-
/*
541-
* Use the locked version, as we're called from the CPU
542-
* hotplug framework. Otherwise, we end-up in deadlock-land.
543-
*/
544-
static_branch_enable_cpuslocked(&arch_timer_read_ool_enabled);
545-
546538
/*
547539
* Don't use the vdso fastpath if errata require using the
548540
* 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
558550
static void arch_timer_check_ool_workaround(enum arch_timer_erratum_match_type type,
559551
void *arg)
560552
{
561-
const struct arch_timer_erratum_workaround *wa;
553+
const struct arch_timer_erratum_workaround *wa, *__wa;
562554
ate_match_fn_t match_fn = NULL;
563555
bool local = false;
564556

@@ -582,16 +574,13 @@ static void arch_timer_check_ool_workaround(enum arch_timer_erratum_match_type t
582574
if (!wa)
583575
return;
584576

585-
if (needs_unstable_timer_counter_workaround()) {
586-
const struct arch_timer_erratum_workaround *__wa;
587-
__wa = __this_cpu_read(timer_unstable_counter_workaround);
588-
if (__wa && wa != __wa)
589-
pr_warn("Can't enable workaround for %s (clashes with %s\n)",
590-
wa->desc, __wa->desc);
577+
__wa = __this_cpu_read(timer_unstable_counter_workaround);
578+
if (__wa && wa != __wa)
579+
pr_warn("Can't enable workaround for %s (clashes with %s\n)",
580+
wa->desc, __wa->desc);
591581

592-
if (__wa)
593-
return;
594-
}
582+
if (__wa)
583+
return;
595584

596585
arch_timer_enable_workaround(wa, local);
597586
pr_info("Enabling %s workaround for %s\n",

0 commit comments

Comments
 (0)