From: Scott Wood <scottwood@freescale.com>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@lists.ozlabs.org, Emil Medve <Emilian.Medve@Freescale.com>
Subject: Re: [PATCH v3] powerpc: Use PFN_PHYS() to avoid truncating the physical address
Date: Fri, 27 Mar 2015 13:07:31 -0500 [thread overview]
Message-ID: <1427479651.22867.151.camel@freescale.com> (raw)
In-Reply-To: <1427413505.23142.3.camel@ellerman.id.au>
On Fri, 2015-03-27 at 10:45 +1100, Michael Ellerman wrote:
> On Thu, 2015-03-26 at 10:31 -0500, Emil Medve wrote:
> > Hello Kumar,
> >
> >
> > On 03/26/2015 10:18 AM, Kumar Gala wrote:
> > > Why no commit message with what issue this change was trying to fix?
> >
> > A while back, when I attempted to remove bootmem (in favor of just plain
> > memblock as in powerpc land bootmem was just a wrapper to memblock
> > anyway) I run at some point into a problem with an intermediate address
> > value because of this '<< PAGE_SHIFT' on the wrong width variable. Using
> > PFN_PHYS() took care of it (it has a cast) so I decided to get this
> > defensive patch applied. Since, I dropped my bootmem/memblock patches in
> > favor to Anton's (Blanchard) work so my concrete issue example is
> > somewhat gone
>
> I'm not a big fan of it unless it's actually fixing an issue. It's a lot of
> churn and the end result is less readable IMHO.
It is fixing an issue -- the issue is that there are overflow errors in
the code. Some of the places Emil fixed are only for platforms that
don't have physical addresses larger than pointers, or have the needed
casts, or are known to be dealing with lowmem, but others aren't. E.g.
page_is_ram() and devmem_is_allowed() are buggy on 32-bit with 64-bit
physical.
flush_dcache_icache_page() is buggy on mpc86xx with more than 4 GiB RAM
-- though that would still be buggy even with this change, due to
__flush_dcache_icache_phys taking unsigned long. The entire concept of
that function doesn't work for sizeof(phys_addr_t) > sizeof(void *), so
in this case 86xx should be using the booke code instead.
Even in the places where overflow can't happen due to the above
circumstances (other than having the needed cast), it's setting a bad
example that can be copied to places where it will break, or the
circumstances of the code could change (e.g. currently 64-bit-only code
being used on 32-bit).
-Scott
next prev parent reply other threads:[~2015-03-27 18:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-25 13:49 [PATCH v3] powerpc: Use PFN_PHYS() to avoid truncating the physical address Emil Medve
2015-03-26 15:18 ` Kumar Gala
2015-03-26 15:31 ` Emil Medve
2015-03-26 23:45 ` Michael Ellerman
2015-03-27 18:07 ` Scott Wood [this message]
2015-03-30 1:40 ` Michael Ellerman
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=1427479651.22867.151.camel@freescale.com \
--to=scottwood@freescale.com \
--cc=Emilian.Medve@Freescale.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
/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).