linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@ozlabs.org>
To: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Cc: Balbir Singh <bsingharora@gmail.com>, linuxppc-dev@lists.ozlabs.org
Subject: Re: Fix BUG_ON() reporting in real mode on powerpc
Date: Wed, 17 Feb 2016 19:23:47 +1100	[thread overview]
Message-ID: <20160217082347.GA19495@fergus.ozlabs.ibm.com> (raw)
In-Reply-To: <56C42954.3000801@linux.vnet.ibm.com>

On Wed, Feb 17, 2016 at 01:33:32PM +0530, Anshuman Khandual wrote:
> On 02/17/2016 12:46 PM, Balbir Singh wrote:
> >> > It might be a little better to do this:
> >> > 
> >> > 		bugaddr = regs->nip;
> >> > 		if (REGION_ID(bugaddr) == 0 && !(regs->msr & MSR_IR))
> >> > 			bugaddr += PAGE_OFFSET;
> >> > 
> >> > It is possible to execute from addresses with the 0xc000... on top in
> >> > real mode, because the CPU ignores the top 4 address bits in real
> >> > mode.
> > Good catch! Thank you
> > 
> > Changelog:
> >      Don't add PAGE_OFFSET blindly, check if REGION_ID is 0
> 
> Cant we use USER_REGION_ID directly ?

If we use USER_REGION_ID then the reader needs to know that the user
region is region 0 to understand the code.  Thus I think it is clearer
to use REGION_ID(bugaddr) == 0.  Whether or not the address is a user
region address is not really relevant to the question of whether it's
a physical address being accessed directly in real mode vs. a kernel
virtual address, which is what we're trying to determine.

Paul.

  reply	other threads:[~2016-02-17  8:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-17  4:43 Fix BUG_ON() reporting in real mode on powerpc Balbir Singh
2016-02-17  4:56 ` Paul Mackerras
2016-02-17  7:16   ` Balbir Singh
2016-02-17  8:03     ` Anshuman Khandual
2016-02-17  8:23       ` Paul Mackerras [this message]
2016-02-17 15:16     ` Aneesh Kumar K.V
2016-02-18  0:25       ` Balbir Singh
2016-02-18  2:41         ` Aneesh Kumar K.V

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=20160217082347.GA19495@fergus.ozlabs.ibm.com \
    --to=paulus@ozlabs.org \
    --cc=bsingharora@gmail.com \
    --cc=khandual@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.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).