From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757642AbdEKQIs (ORCPT ); Thu, 11 May 2017 12:08:48 -0400 Received: from foss.arm.com ([217.140.101.70]:50356 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752004AbdEKQIW (ORCPT ); Thu, 11 May 2017 12:08:22 -0400 Subject: Re: [PATCHv2] arm64/cpufeature: don't use mutex in bringup path To: Suzuki K Poulose , Mark Rutland References: <1494514878-26878-1-git-send-email-mark.rutland@arm.com> <498b2e16-538a-d5ea-7843-2ebbff2007df@arm.com> <20170511153719.GB19626@leverpostej> <232510f0-115e-b2c6-022f-03efd2606d56@arm.com> Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bigeasy@linutronix.de, catalin.marinas@arm.com, peterz@infradead.org, tglx@linutronix.de, will.deacon@arm.com From: Marc Zyngier Organization: ARM Ltd Message-ID: Date: Thu, 11 May 2017 17:08:19 +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: <232510f0-115e-b2c6-022f-03efd2606d56@arm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/05/17 16:54, Suzuki K Poulose wrote: > On 11/05/17 16:37, Mark Rutland wrote: >> On Thu, May 11, 2017 at 04:15:38PM +0100, Suzuki K Poulose wrote: >>> On 11/05/17 16:01, Mark Rutland wrote: >>>> +static inline bool cpus_have_const_cap(int num) >>>> +{ >>>> + if (static_branch_likely(&arm64_const_caps_ready)) >>>> + return __cpus_have_const_cap(num); >>>> + else >>>> + return cpus_have_cap(num); >>> >>> We use cpus_have_const_cap() from hyp code, via has_vhe() and we could potentially >>> try to access unmapped kernel data from hyp if we fallback to cpus_have_cap(). >>> However, it looks like we have already set arm64_const_caps_ready, so should not >>> hit it in practise. May be we could add a stricter version of the helper ? >>> >>> static inline cpus_have_const_cap_strict(int num) >>> { >>> BUG_ON(!static_branch_likely(&arm64_const_caps_ready); >>> return __cpus_have_const_cap(num); >>> } >> >> Just to check, is that the only user of cpus_have_const_cap() at hyp? > > Uh, no we have one more, via system_supports_fpsimd() in __actvate_traps. Indeed, and I'd definitely expect to see more of that trickling in (if only to deal with errata). I'm OK with the BUG_ON version, TBH. It's not pretty, but it will be perfectly visible if it fires. Thanks, M. -- Jazz is not dead. It just smells funny...