linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] powerpc: fix off by one in max_zone_pfn initialization for ZONE_DMA
@ 2019-06-25 14:17 Andrea Arcangeli
  2019-06-25 15:03 ` Christoph Hellwig
  2019-07-18 13:56 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Andrea Arcangeli @ 2019-06-25 14:17 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Laurent Vivier, linuxppc-dev

25078dc1f74be16b858e914f52cc8f4d03c2271a first introduced an off by
one error in the ZONE_DMA initialization of PPC_BOOK3E_64=y and since
9739ab7eda459f0669ec9807e0d9be5020bab88c the off by one applies to
PPC32=y too. This simply corrects the off by one and should resolve
crashes like below:

[   65.179101] page 0x7fff outside node 0 zone DMA [ 0x0 - 0x7fff ]

Unfortunately in various MM places "max" means a non inclusive end of
range. free_area_init_nodes max_zone_pfn parameter is one case and
MAX_ORDER is another one (unrelated) that comes by memory.

Reported-by: Zorro Lang <zlang@redhat.com>
Fixes: 25078dc1f74b ("powerpc: use mm zones more sensibly")
Fixes: 9739ab7eda45 ("powerpc: enable a 30-bit ZONE_DMA for 32-bit pmac")
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
---
 arch/powerpc/mm/mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 2540d3b2588c..2eda1ec36f55 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -249,7 +249,7 @@ void __init paging_init(void)
 
 #ifdef CONFIG_ZONE_DMA
 	max_zone_pfns[ZONE_DMA]	= min(max_low_pfn,
-			((1UL << ARCH_ZONE_DMA_BITS) - 1) >> PAGE_SHIFT);
+				      1UL << (ARCH_ZONE_DMA_BITS - PAGE_SHIFT));
 #endif
 	max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
 #ifdef CONFIG_HIGHMEM

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] powerpc: fix off by one in max_zone_pfn initialization for ZONE_DMA
  2019-06-25 14:17 [PATCH 1/1] powerpc: fix off by one in max_zone_pfn initialization for ZONE_DMA Andrea Arcangeli
@ 2019-06-25 15:03 ` Christoph Hellwig
  2019-07-18 13:56 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2019-06-25 15:03 UTC (permalink / raw)
  To: Andrea Arcangeli; +Cc: Laurent Vivier, linuxppc-dev, Christoph Hellwig

Thanks.  This looks good and seems to match what I couple of other
random architectures I checked do:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] powerpc: fix off by one in max_zone_pfn initialization for ZONE_DMA
  2019-06-25 14:17 [PATCH 1/1] powerpc: fix off by one in max_zone_pfn initialization for ZONE_DMA Andrea Arcangeli
  2019-06-25 15:03 ` Christoph Hellwig
@ 2019-07-18 13:56 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2019-07-18 13:56 UTC (permalink / raw)
  To: Andrea Arcangeli, Christoph Hellwig; +Cc: Laurent Vivier, linuxppc-dev

On Tue, 2019-06-25 at 14:17:27 UTC, Andrea Arcangeli wrote:
> 25078dc1f74be16b858e914f52cc8f4d03c2271a first introduced an off by
> one error in the ZONE_DMA initialization of PPC_BOOK3E_64=y and since
> 9739ab7eda459f0669ec9807e0d9be5020bab88c the off by one applies to
> PPC32=y too. This simply corrects the off by one and should resolve
> crashes like below:
> 
> [   65.179101] page 0x7fff outside node 0 zone DMA [ 0x0 - 0x7fff ]
> 
> Unfortunately in various MM places "max" means a non inclusive end of
> range. free_area_init_nodes max_zone_pfn parameter is one case and
> MAX_ORDER is another one (unrelated) that comes by memory.
> 
> Reported-by: Zorro Lang <zlang@redhat.com>
> Fixes: 25078dc1f74b ("powerpc: use mm zones more sensibly")
> Fixes: 9739ab7eda45 ("powerpc: enable a 30-bit ZONE_DMA for 32-bit pmac")
> Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/03800e0526ee25ed7c843ca1e57b69ac2a5af642

cheers

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-18 13:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-25 14:17 [PATCH 1/1] powerpc: fix off by one in max_zone_pfn initialization for ZONE_DMA Andrea Arcangeli
2019-06-25 15:03 ` Christoph Hellwig
2019-07-18 13:56 ` Michael Ellerman

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).