Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1640419
| From | Suzuki K Poulose <Suzuki.Poulose@arm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCHv3] arm64/cpufeature: don't use mutex in bringup path |
| Date | 2017-05-12 14:10 +0200 |
| Message-ID | <tGhyp-4jd-13@gated-at.bofh.it> (permalink) |
| References | <tGfPX-2XQ-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 12/05/17 11:15, Mark Rutland wrote:
> Currently, cpus_set_cap() calls static_branch_enable_cpuslocked(), which
> must take the jump_label mutex.
>
> We call cpus_set_cap() in the secondary bringup path, from the idle
> thread where interrupts are disabled. Taking a mutex in this path "is a
> NONO" regardless of whether it's contended, and something we must avoid.
> Additionally, the secondary CPU doesn't hold the percpu rwsem (as this
> is held by the primary CPU), so this triggers a lockdep splat.
>
> This patch fixes both issues. The poking of static keys is deferred
> until enable_cpu_capabilities(), which runs in a suitable context on the
> boot CPU. To account for the static keys being set later,
> cpus_have_const_cap() is updated to use another static key to check
> whether the const cap keys have been initialised, falling back to the
> caps bitmap until this is the case.
>
> This means that users of cpus_have_const_cap() gain should only gain a
> single additional NOP in the fast path once the const caps are
> initialised, but should always see the current cap value.
>
> The hyp code should never dereference the caps array, since the caps are
> initialized before we run the module initcall to initialise hyp. A check
> is added to the hyp init code to docuemnt this requirement.
>
> This rework means that we can remove the *_cpuslocked() helpers added in
> commit d54bb72551b999dd ("arm64/cpufeature: Use
> static_branch_enable_cpuslocked()").
>
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Christoffer Dall <christoffer.dall@linaro.org>
> Cc: Marc Zyniger <marc.zyngier@arm.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Sebastian Sewior <bigeasy@linutronix.de>
> Cc: Suzuki Poulose <suzuki.poulose@arm.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Will Deacon <will.deacon@arm.com>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCHv3] arm64/cpufeature: don't use mutex in bringup path Mark Rutland <mark.rutland@arm.com> - 2017-05-12 12:20 +0200
Re: [PATCHv3] arm64/cpufeature: don't use mutex in bringup path Marc Zyngier <marc.zyngier@arm.com> - 2017-05-12 12:40 +0200
Re: [PATCHv3] arm64/cpufeature: don't use mutex in bringup path Suzuki K Poulose <Suzuki.Poulose@arm.com> - 2017-05-12 14:10 +0200
Re: [PATCHv3] arm64/cpufeature: don't use mutex in bringup path Will Deacon <will.deacon@arm.com> - 2017-05-12 19:10 +0200
Re: [PATCHv3] arm64/cpufeature: don't use mutex in bringup path Mark Rutland <mark.rutland@arm.com> - 2017-05-12 19:40 +0200
csiph-web