Re: [PATCH V2] mm: Define default value for FIRST_USER_ADDRESS

2021-04-19 Thread Geert Uytterhoeven
On Fri, Apr 16, 2021 at 7:17 AM Anshuman Khandual
 wrote:
> Currently most platforms define FIRST_USER_ADDRESS as 0UL duplication the
> same code all over. Instead just define a generic default value (i.e 0UL)
> for FIRST_USER_ADDRESS and let the platforms override when required. This
> makes it much cleaner with reduced code.
>
> The default FIRST_USER_ADDRESS here would be skipped in 
> when the given platform overrides its value via .

> Signed-off-by: Anshuman Khandual 

>  arch/m68k/include/asm/pgtable_mm.h   | 1 -

Acked-by: Geert Uytterhoeven 

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


[PATCH V2] mm: Define default value for FIRST_USER_ADDRESS

2021-04-15 Thread Anshuman Khandual
Currently most platforms define FIRST_USER_ADDRESS as 0UL duplication the
same code all over. Instead just define a generic default value (i.e 0UL)
for FIRST_USER_ADDRESS and let the platforms override when required. This
makes it much cleaner with reduced code.

The default FIRST_USER_ADDRESS here would be skipped in 
when the given platform overrides its value via .

Cc: Richard Henderson 
Cc: Vineet Gupta 
Cc: Catalin Marinas 
Cc: Will Deacon 
Cc: Guo Ren 
Cc: Brian Cain 
Cc: Geert Uytterhoeven 
Cc: Michal Simek 
Cc: Thomas Bogendoerfer 
Cc: Ley Foon Tan 
Cc: Jonas Bonn 
Cc: Stefan Kristiansson 
Cc: Stafford Horne 
Cc: "James E.J. Bottomley" 
Cc: Michael Ellerman 
Cc: Christophe Leroy 
Cc: Paul Walmsley 
Cc: Palmer Dabbelt 
Cc: Heiko Carstens 
Cc: Yoshinori Sato 
Cc: "David S. Miller" 
Cc: Jeff Dike 
Cc: Thomas Gleixner 
Cc: Chris Zankel 
Cc: Andrew Morton 
Cc: linux-a...@vger.kernel.org
Cc: linux...@kvack.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual 
---
This applies on v5.12-rc7 and has been boot tested on arm64 platform.
But has been cross compiled on multiple other platforms.

Changes in V2:

- Dropped ARCH_HAS_FIRST_USER_ADDRESS construct

Changes in V1:

https://patchwork.kernel.org/project/linux-mm/patch/1618368899-20311-1-git-send-email-anshuman.khand...@arm.com/

 arch/alpha/include/asm/pgtable.h | 1 -
 arch/arc/include/asm/pgtable.h   | 6 --
 arch/arm64/include/asm/pgtable.h | 2 --
 arch/csky/include/asm/pgtable.h  | 1 -
 arch/hexagon/include/asm/pgtable.h   | 3 ---
 arch/ia64/include/asm/pgtable.h  | 1 -
 arch/m68k/include/asm/pgtable_mm.h   | 1 -
 arch/microblaze/include/asm/pgtable.h| 2 --
 arch/mips/include/asm/pgtable-32.h   | 1 -
 arch/mips/include/asm/pgtable-64.h   | 1 -
 arch/nios2/include/asm/pgtable.h | 2 --
 arch/openrisc/include/asm/pgtable.h  | 1 -
 arch/parisc/include/asm/pgtable.h| 2 --
 arch/powerpc/include/asm/book3s/pgtable.h| 1 -
 arch/powerpc/include/asm/nohash/32/pgtable.h | 1 -
 arch/powerpc/include/asm/nohash/64/pgtable.h | 2 --
 arch/riscv/include/asm/pgtable.h | 2 --
 arch/s390/include/asm/pgtable.h  | 2 --
 arch/sh/include/asm/pgtable.h| 2 --
 arch/sparc/include/asm/pgtable_32.h  | 1 -
 arch/sparc/include/asm/pgtable_64.h  | 3 ---
 arch/um/include/asm/pgtable-2level.h | 1 -
 arch/um/include/asm/pgtable-3level.h | 1 -
 arch/x86/include/asm/pgtable_types.h | 2 --
 arch/xtensa/include/asm/pgtable.h| 1 -
 include/linux/pgtable.h  | 9 +
 26 files changed, 9 insertions(+), 43 deletions(-)

diff --git a/arch/alpha/include/asm/pgtable.h b/arch/alpha/include/asm/pgtable.h
index 8d856c62e22a..1a2fb0dc905b 100644
--- a/arch/alpha/include/asm/pgtable.h
+++ b/arch/alpha/include/asm/pgtable.h
@@ -46,7 +46,6 @@ struct vm_area_struct;
 #define PTRS_PER_PMD   (1UL << (PAGE_SHIFT-3))
 #define PTRS_PER_PGD   (1UL << (PAGE_SHIFT-3))
 #define USER_PTRS_PER_PGD  (TASK_SIZE / PGDIR_SIZE)
-#define FIRST_USER_ADDRESS 0UL
 
 /* Number of pointers that fit on a page:  this will go away. */
 #define PTRS_PER_PAGE  (1UL << (PAGE_SHIFT-3))
diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index 163641726a2b..a9fabfb70664 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -228,12 +228,6 @@
  */
 #defineUSER_PTRS_PER_PGD   (TASK_SIZE / PGDIR_SIZE)
 
-/*
- * No special requirements for lowest virtual address we permit any user space
- * mapping to be mapped at.
- */
-#define FIRST_USER_ADDRESS  0UL
-
 
 /
  * Bucket load of VM Helpers
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 47027796c2f9..f6ab8b64967e 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -26,8 +26,6 @@
 
 #define vmemmap((struct page *)VMEMMAP_START - 
(memstart_addr >> PAGE_SHIFT))
 
-#define FIRST_USER_ADDRESS 0UL
-
 #ifndef __ASSEMBLY__
 
 #include 
diff --git a/arch/csky/include/asm/pgtable.h b/arch/csky/include/asm/pgtable.h
index 0d60367b6bfa..151607ed5158 100644
--- a/arch/csky/include/asm/pgtable.h
+++ b/arch/csky/include/asm/pgtable.h
@@ -14,7 +14,6 @@
 #define PGDIR_MASK (~(PGDIR_SIZE-1))
 
 #define USER_PTRS_PER_PGD  (PAGE_OFFSET/PGDIR_SIZE)
-#define FIRST_USER_ADDRESS 0UL
 
 /*
  * C-SKY is two-level paging structure:
diff --git a/arch/hexagon/include/asm/pgtable.h 
b/arch/hexagon/include/asm/pgtable.h
index dbb22b80b8c4..e4979508cddf 100644
--- a/arch/hexagon/include/asm/pgtable.h
+++ b/arch/hexagon/include/asm/pgtable.h
@@ -155,9 +155,6 @@ extern unsigned long _dflt_cache_att;
 
 extern pgd_t swapper_pg_dir[PTRS_PER_PGD];  /* located in head.S */
 
-/* Seems to be zero