linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/mm: Only define MAX_PHYSMEM_BITS in SPARSEMEM configurations
@ 2019-03-17  1:17 Ben Hutchings
  2019-03-22 12:21 ` Michael Ellerman
       [not found] ` <44QjSh4zGhz9sV2__48832.6491251186$1553257542$gmane$org@ozlabs.org>
  0 siblings, 2 replies; 11+ messages in thread
From: Ben Hutchings @ 2019-03-17  1:17 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 1573 bytes --]

MAX_PHYSMEM_BITS only needs to be defined if CONFIG_SPARSEMEM is
enabled, and that was the case before commit 4ffe713b7587
("powerpc/mm: Increase the max addressable memory to 2PB").

On 32-bit systems, where CONFIG_SPARSEMEM is not enabled, we now
define it as 46.  That is larger than the real number of physical
address bits, and breaks calculations in zsmalloc:

    mm/zsmalloc.c:130:49: warning: right shift count is negative [-Wshift-count-negative]
      MAX(32, (ZS_MAX_PAGES_PER_ZSPAGE << PAGE_SHIFT >> OBJ_INDEX_BITS))
                                                     ^~
    ...
    mm/zsmalloc.c:253:21: error: variably modified 'size_class' at file scope
      struct size_class *size_class[ZS_SIZE_CLASSES];
                         ^~~~~~~~~~

Fixes: 4ffe713b7587 ("powerpc/mm: Increase the max addressable memory to 2PB")
Cc: stable@vger.kernel.org
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/powerpc/include/asm/mmu.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h
index 25607604a7a5..2bc8c3f04f8a 100644
--- a/arch/powerpc/include/asm/mmu.h
+++ b/arch/powerpc/include/asm/mmu.h
@@ -341,7 +341,7 @@ static inline u16 get_mm_addr_key(struct mm_struct *mm, unsigned long address)
 #if defined(CONFIG_SPARSEMEM_VMEMMAP) && defined(CONFIG_SPARSEMEM_EXTREME) &&	\
 	defined (CONFIG_PPC_64K_PAGES)
 #define MAX_PHYSMEM_BITS        51
-#else
+#elif defined(CONFIG_SPARSEMEM)
 #define MAX_PHYSMEM_BITS        46
 #endif
 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply related	[flat|nested] 11+ messages in thread
* Re: powerpc/mm: Only define MAX_PHYSMEM_BITS in SPARSEMEM configurations
@ 2019-03-25  8:54 Rui Salvaterra
  0 siblings, 0 replies; 11+ messages in thread
From: Rui Salvaterra @ 2019-03-25  8:54 UTC (permalink / raw)
  To: ben; +Cc: linuxppc-dev

Hi, Ben

> Presumably you have CONFIG_PPC_BOOK3S_64 enabled and CONFIG_SPARSEMEM disabled?
> Was this configuration actually usable?

I just noticed these build warnings too. FWIW, I've been using
CONFIG_FLATMEM on my Power Mac G5 for about three years, so I guess
the answer is "yes" (for this specific machine, at least).

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

end of thread, other threads:[~2019-04-02 12:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-17  1:17 [PATCH] powerpc/mm: Only define MAX_PHYSMEM_BITS in SPARSEMEM configurations Ben Hutchings
2019-03-22 12:21 ` Michael Ellerman
     [not found] ` <44QjSh4zGhz9sV2__48832.6491251186$1553257542$gmane$org@ozlabs.org>
2019-03-24 22:18   ` Andreas Schwab
2019-03-24 23:05     ` Ben Hutchings
2019-03-25  0:03       ` Andreas Schwab
2019-03-25  3:54         ` Ben Hutchings
2019-03-25 11:35           ` Michael Ellerman
2019-03-25 12:03             ` Christophe Leroy
2019-03-25 20:12             ` Andreas Schwab
2019-04-02 12:57             ` Aneesh Kumar K.V
2019-03-25  8:54 Rui Salvaterra

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