arm64: arch_timer: Improve errata handling
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest8 patches 4 repliesIn review
- v25 patches 3 repliesSuperseded
- v15 patches 0 repliesSuperseded
Patches in v3 No applies recorded yet
Reviews trailers per patch
1 of 8 patches has a Reviewed-by or Acked-by.
| Patch | Catalin Marinas |
|---|---|
| 1/8 | |
| 2/8 | |
| 3/8 | |
| 4/8 | |
| 5/8 | |
| 6/8 | |
| 7/8 | |
| 8/8 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v3 0/8] arm64: arch_timer: Improve errata handling
This is the third version of this series addressing a couple of embarrassing bugs in the prolific arm64 timer errata handling department. See below for the changes since v2.
Time is hard. Timers are harder. As a consequence, we have plenty of broken counter/timer implementations in the wild, and an infrastructure to deal with them.
However, what we have today suffers from a number of issues:
- if, on an heterogeneous system, affected CPUs are secondaries, we do record their broken state but don't correct anything
- we always play games with preemption in order to access per-CPU state, irrespective of the presence of broken CPUs
I hear someone saying "just use a static key to enable the errata and be done with it". Good call, except that we need to do that from a CPUHP callback, and that's deadlock central. We can't do it later, because this could affect the CPU before the workaround is enabled.
However, not everything is lost if we turn the logic on its head:
- always start with the mitigations enabled, even if we don't know of any affected CPU
- once all CPUs have been seen once, and that we still haven't enabled any workaround, disable the mitigations globally.
With that, a normal kernel boot with all CPUs will quickly switch to no mitigation on decent HW. If you're booting with CPUs disabled, this will only kick in once you have booted them all.
Patches on top of 7.2-rc4.
* From v2 [1]:
- Added a fix for the PMUv3 driver that really wants to know whether it is operating with the architected timer. This has been broken for some time (since 24ee7607b286b ("arm64/arch_timer: Provide noinstr sched_clock_read() functions"))
- Make arch_timer_read_counter a function, and not just a function pointer
- Added a command-line option to allow the user to promise that no erratum is required (Will)
- Dropped the internal CPU mask and iterate over the existing per-cpu variable (Will)
- Picked Catalin's Ack, with thanks
[1] https://lore.kernel.org/all/[email protected]/
Marc Zyngier (8):
clocksource/drivers/arm_arch_timer: Add
read_sched_clock_is_arch_counter() predicate
clocksource/drivers/arm_arch_timer: Add a static key indicating the
need for a runtime workaround
clocksource/drivers/arm_arch_timer: Convert counter accessors to a
static key alternative
clocksource/drivers/arm_arch_timer: Drop the
arch_counter_get_cnt{p,v}ct_stable() accessors
clocksource/drivers/arm_arch_timer: Turn arch_timer_read_counter into
a function
clocksource/drivers/arm_arch_timer: Add command-line control over the
counter errata management
clocksource/drivers/arm_arch_timer: Expose a direct accessor for the
virtual counter
arm64: Convert __delay_cycles() to arch_timer_read_vcounter()
.../admin-guide/kernel-parameters.txt | 13 ++ arch/arm64/lib/delay.c | 5 +- drivers/clocksource/arm_arch_timer.c | 156 ++++++++++++------ drivers/perf/arm_pmuv3.c | 2 +- include/clocksource/arm_arch_timer.h | 11 +- 5 files changed, 131 insertions(+), 56 deletions(-)
Signature · 1 line
2.47.3