From: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>
To: christophe leroy <christophe.leroy@c-s.fr>
Cc: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
"Michael Ellerman" <mpe@ellerman.id.au>,
linux-mm@kvack.org, "Joel Stanley" <joel@jms.id.au>,
"Benjamin Herrenschmidt" <benh@kernel.crashing.org>,
"Paul Mackerras" <paulus@samba.org>,
"Balbir Singh" <bsingharora@gmail.com>,
"Guenter Roeck" <linux@roeck-us.net>
Subject: Re: [PATCH 1/6] powerpc/mm/32: Use pfn_valid to check if pointer is in RAM
Date: Wed, 21 Feb 2018 14:51:19 +0100 [thread overview]
Message-ID: <20180221135119.d3qgvdck5yruomi7@latitude> (raw)
In-Reply-To: <0d14cb2c-dd00-d258-cb15-302b2a9d684f@c-s.fr>
[-- Attachment #1: Type: text/plain, Size: 1598 bytes --]
Hello Christophe,
On Tue, Feb 20, 2018 at 06:45:09PM +0100, christophe leroy wrote:
[...]
> > - if (slab_is_available() && (p < virt_to_phys(high_memory)) &&
> > + if (slab_is_available() && pfn_valid(__phys_to_pfn(p)) &&
>
> I'm not sure this is equivalent:
>
> high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
> #define ARCH_PFN_OFFSET ((unsigned long)(MEMORY_START >> PAGE_SHIFT))
> #define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && (pfn) < max_mapnr)
> set_max_mapnr(max_pfn);
>
> So in the current implementation it checks against max_low_pfn while your
> patch checks against max_pfn
>
> max_low_pfn = max_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT;
> #ifdef CONFIG_HIGHMEM
> max_low_pfn = lowmem_end_addr >> PAGE_SHIFT;
> #endif
Good point, I haven't considered CONFIG_HIGHMEM before.
As far as I understand it, in the non-CONFIG_HIGHMEM case:
- max_low_pfn is set to the same value as max_pfn, so the ioremap
check should detect the same PFNs as RAM.
and with CONFIG_HIGHMEM:
- max_low_pfn is set to lowmem_end_addr >> PAGE_SHIFT
- but max_pfn isn't
So, I think you're right.
While looking through arch/powerpc/mm, I noticed that there's a
page_is_ram function, which simply uses the memblocks directly, on
PPC32. It seems like a good candidate for the RAM check in
__ioremap_caller, except that there's this code, which apparently
trashes memblock 0 completely on non-CONFIG_NEED_MULTIPLE_NODES:
https://elixir.bootlin.com/linux/v4.16-rc2/source/arch/powerpc/mm/mem.c#L223
Thanks,
Jonathan Neuschäfer
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2018-02-21 13:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-20 16:14 [PATCH 0/6] DISCONTIGMEM support for PPC32 Jonathan Neuschäfer
2018-02-20 16:14 ` [PATCH 1/6] powerpc/mm/32: Use pfn_valid to check if pointer is in RAM Jonathan Neuschäfer
2018-02-20 17:45 ` christophe leroy
2018-02-21 13:51 ` Jonathan Neuschäfer [this message]
2018-02-21 14:44 ` Jonathan Neuschäfer
2018-02-20 16:14 ` [PATCH 2/6] powerpc: numa: Fix overshift on PPC32 Jonathan Neuschäfer
2018-02-20 16:14 ` [PATCH 3/6] powerpc: numa: Use the right #ifdef guards around functions Jonathan Neuschäfer
2018-02-20 16:14 ` [PATCH 4/6] powerpc: numa: Restrict fake NUMA enulation to CONFIG_NUMA systems Jonathan Neuschäfer
2018-02-20 16:14 ` [PATCH 5/6] powerpc: Implement DISCONTIGMEM and allow selection on PPC32 Jonathan Neuschäfer
2018-02-20 23:46 ` kbuild test robot
2018-02-21 16:08 ` Jonathan Neuschäfer
2018-02-21 17:53 ` christophe leroy
2018-02-20 16:14 ` [PATCH 6/6] powerpc: wii: Don't rely on reserved memory hack if DISCONTIGMEM is set Jonathan Neuschäfer
2018-02-21 7:06 ` [PATCH 0/6] DISCONTIGMEM support for PPC32 Christophe LEROY
2018-02-21 14:42 ` Jonathan Neuschäfer
2018-02-21 15:02 ` Christophe LEROY
2018-02-21 16:52 ` Jonathan Neuschäfer
2018-02-21 23:31 ` Jonathan Neuschäfer
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=20180221135119.d3qgvdck5yruomi7@latitude \
--to=j.neuschaefer@gmx.net \
--cc=benh@kernel.crashing.org \
--cc=bsingharora@gmail.com \
--cc=christophe.leroy@c-s.fr \
--cc=joel@jms.id.au \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@roeck-us.net \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.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).