xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: xen-devel@lists.xenproject.org, tim@xen.org,
	stefano.stabellini@citrix.com
Subject: Re: [PATCH v3] xen/arm: Correctly support WARN_ON
Date: Mon, 22 Sep 2014 16:39:08 +0100	[thread overview]
Message-ID: <5420429C.7060609@linaro.org> (raw)
In-Reply-To: <1411399796.26552.6.camel@kazak.uk.xensource.com>

Hi Ian,

On 22/09/2014 16:29, Ian Campbell wrote:
> On Wed, 2014-09-10 at 16:33 -0700, Julien Grall wrote:
>> +#ifdef CONFIG_ARM_64
>> +static void do_trap_brk(struct cpu_user_regs *regs, union hsr hsr)
>> +{
>> +    /* HCR_EL2.TGE and MDCR_EL2.TDE are not set so we never receive
>> +     * software breakpoint exception for EL1 and EL0 here
>> +     */
>> +    /* It's not possible to use BUG_ON here, because we would recurse */
>> +    if ( unlikely(READ_SYSREG(HCR_EL2) & HCR_TGE) ||
>> +         unlikely(READ_SYSREG(MDCR_EL2) & HDCR_TDE) )
>> +        panic("Unable to handle brk exception from EL1/EL0");
>
> Either of those bits being set doesn't imply that *this* trap came from
> EL1/EL0.
>
> The correct check would be BUG_ON(!hyp_mode(regs)) which I think won't
> recurse because the resulting BRK will pass the check the second time,
> although if you want to if (!hyp_mode(regs)) panic(...) instead that's
> fine too.

In fact, I haven't though this way. The BUG_ON(!hyp_mode(regs)) will 
definitely works here.

I will send a new version with this change and the typoes fixed.

Regards,



-- 
Julien Grall

      reply	other threads:[~2014-09-22 15:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-10 23:33 [PATCH v3] xen/arm: Correctly support WARN_ON Julien Grall
2014-09-22 15:29 ` Ian Campbell
2014-09-22 15:39   ` Julien Grall [this message]

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=5420429C.7060609@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=Ian.Campbell@citrix.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /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;
as well as URLs for NNTP newsgroup(s).