From: Michael Ellerman <mpe@ellerman.id.au>
To: David Laight <David.Laight@ACULAB.COM>
Cc: "linuxppc-dev@ozlabs.org" <linuxppc-dev@ozlabs.org>
Subject: Re: [PATCH] powerpc: Remove more traces of bootmem
Date: Wed, 19 Nov 2014 16:29:17 +1100 [thread overview]
Message-ID: <1416374957.32483.3.camel@concordia> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D1C9F2964@AcuExch.aculab.com>
On Tue, 2014-11-18 at 10:26 +0000, David Laight wrote:
> From: Michael Ellerman
> > Although we are now selecting NO_BOOTMEM, we still have some traces of
> > bootmem lying around. That is because even with NO_BOOTMEM there is
> > still a shim that converts bootmem calls into memblock calls, but
> > ultimately we want to remove all traces of bootmem.
> >
> > Most of the patch is conversions from alloc_bootmem() to
> > memblock_alloc(). In general a call such as:
> >
> > p = (struct foo *)alloc_bootmem(x);
> >
> > Becomes:
> >
> > p = __va(memblock_alloc(x, 0));
> >
> > We need __va() because memblock returns a physical address. We don't
> > need the cast because __va() returns a void *. The alignment value of
> > zero tells memblock to use the default alignment, which is
> > SMP_CACHE_BYTES, the same value alloc_bootmem() uses.
>
> It doesn't seem right to me to replicate __va(memblock_alloc(x, 0))
> that many times. I can imagine that the required code will change
> again at to future time, and then all the same places would need changing.
Yeah it's a bit ugly. Actually most of that code has never changed, which is
the problem, no one has bothered to update it.
> Wouldn't it be better to use:
> #define alloc_bootmem(x) __va(memblock_alloc(x, 0))
> possibly with a rename, or as a static inline.
Well that's essentially what the existing shim does. So we can't use that name.
My plan is to add a memblock_alloc_virt() which does the __va() for you. But I
didn't want the powerpc changes to get backed up behind that.
> If __va() is non-trivial you want a real function.
It can't be a function because we use it on void * as well as unsigned long,
phys_addr_t etc.
phys_to_virt() is the nicer version, though it only takes unsigned long.
cheers
next prev parent reply other threads:[~2014-11-19 5:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-18 6:52 [PATCH] powerpc: Remove more traces of bootmem Michael Ellerman
2014-11-18 10:26 ` David Laight
2014-11-19 5:29 ` Michael Ellerman [this message]
2014-11-19 7:57 ` Michael Ellerman
2014-11-18 10:28 ` 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=1416374957.32483.3.camel@concordia \
--to=mpe@ellerman.id.au \
--cc=David.Laight@ACULAB.COM \
--cc=linuxppc-dev@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