public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Suzuki K Poulose <Suzuki.Poulose@arm.com>, marc.zyngier@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
Subject: Re: [PATCHv2] arm64/cpufeature: don't use mutex in bringup path
Date: Thu, 11 May 2017 16:37:20 +0100	[thread overview]
Message-ID: <20170511153719.GB19626@leverpostej> (raw)
In-Reply-To: <498b2e16-538a-d5ea-7843-2ebbff2007df@arm.com>

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?

If so, I can do something like the above, patching <asm/virt.h> to use
it for has_vhe().

We don't have a BUG handler at hyp, but that should trigger a hyp panic,
which I guess is good enough.

Marc, thoughts?

Thanks,
Mark.

  reply	other threads:[~2017-05-11 15:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-11 15:01 [PATCHv2] arm64/cpufeature: don't use mutex in bringup path Mark Rutland
2017-05-11 15:15 ` Suzuki K Poulose
2017-05-11 15:37   ` Mark Rutland [this message]
2017-05-11 15:42     ` Mark Rutland
2017-05-11 15:54     ` Suzuki K Poulose
2017-05-11 16:08       ` Marc Zyngier
2017-05-11 17:53         ` Mark Rutland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170511153719.GB19626@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=Suzuki.Poulose@arm.com \
    --cc=bigeasy@linutronix.de \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox