From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v3] xen/arm: Correctly support WARN_ON Date: Mon, 22 Sep 2014 16:39:08 +0100 Message-ID: <5420429C.7060609@linaro.org> References: <1410391997-15481-1-git-send-email-julien.grall@linaro.org> <1411399796.26552.6.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XW5hq-0005bm-A6 for xen-devel@lists.xenproject.org; Mon, 22 Sep 2014 15:39:14 +0000 Received: by mail-qc0-f169.google.com with SMTP id x3so259320qcv.14 for ; Mon, 22 Sep 2014 08:39:11 -0700 (PDT) In-Reply-To: <1411399796.26552.6.camel@kazak.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: xen-devel@lists.xenproject.org, tim@xen.org, stefano.stabellini@citrix.com List-Id: xen-devel@lists.xenproject.org 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