From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932907AbdELMEA (ORCPT ); Fri, 12 May 2017 08:04:00 -0400 Received: from foss.arm.com ([217.140.101.70]:58974 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932880AbdELMD4 (ORCPT ); Fri, 12 May 2017 08:03:56 -0400 Subject: Re: [PATCHv3] arm64/cpufeature: don't use mutex in bringup path To: Mark Rutland , linux-arm-kernel@lists.infradead.org References: <1494584120-15208-1-git-send-email-mark.rutland@arm.com> Cc: linux-kernel@vger.kernel.org, bigeasy@linutronix.de, catalin.marinas@arm.com, marc.zyngier@arm.com, peterz@infradead.org, tglx@linutronix.de, will.deacon@arm.com, Christoffer Dall From: Suzuki K Poulose Message-ID: <9f4c7856-5216-0a21-c378-033ba4e972aa@arm.com> Date: Fri, 12 May 2017 13:03:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <1494584120-15208-1-git-send-email-mark.rutland@arm.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Cc: Catalin Marinas > Cc: Christoffer Dall > Cc: Marc Zyniger > Cc: Peter Zijlstra > Cc: Sebastian Sewior > Cc: Suzuki Poulose > Cc: Thomas Gleixner > Cc: Will Deacon Reviewed-by: Suzuki K Poulose