linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 resend 00/15] init_mm: cleanup ARCH's text/data/brk setup code
@ 2021-06-08  8:34 Kefeng Wang
  2021-06-08  8:34 ` [PATCH v3 resend 01/15] mm: add setup_initial_init_mm() helper Kefeng Wang
                   ` (14 more replies)
  0 siblings, 15 replies; 22+ messages in thread
From: Kefeng Wang @ 2021-06-08  8:34 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel; +Cc: linux-mm, Kefeng Wang

Add setup_initial_init_mm() helper, then use it
to cleanup the text, data and brk setup code.

v3:
- resend all and fix x86 warning
- make helper declaration in mm.h, implemention in init-mm.c, suggested
  by Mike
- collect ACKs

v2:
- change argument from "char *" to "void *" setup_initial_init_mm()
  suggested by Geert Uytterhoeven
- use NULL instead of (void *)0 on h8300 and m68k

Kefeng Wang (15):
  mm: add setup_initial_init_mm() helper
  arc: convert to setup_initial_init_mm()
  arm: convert to setup_initial_init_mm()
  arm64: convert to setup_initial_init_mm()
  csky: convert to setup_initial_init_mm()
  h8300: convert to setup_initial_init_mm()
  m68k: convert to setup_initial_init_mm()
  nds32: convert to setup_initial_init_mm()
  nios2: convert to setup_initial_init_mm()
  openrisc: convert to setup_initial_init_mm()
  powerpc: convert to setup_initial_init_mm()
  riscv: convert to setup_initial_init_mm()
  s390: convert to setup_initial_init_mm()
  sh: convert to setup_initial_init_mm()
  x86: convert to setup_initial_init_mm()

 arch/arc/mm/init.c                 | 5 +----
 arch/arm/kernel/setup.c            | 5 +----
 arch/arm64/kernel/setup.c          | 5 +----
 arch/csky/kernel/setup.c           | 5 +----
 arch/h8300/kernel/setup.c          | 5 +----
 arch/m68k/kernel/setup_mm.c        | 5 +----
 arch/m68k/kernel/setup_no.c        | 5 +----
 arch/nds32/kernel/setup.c          | 5 +----
 arch/nios2/kernel/setup.c          | 5 +----
 arch/openrisc/kernel/setup.c       | 5 +----
 arch/powerpc/kernel/setup-common.c | 5 +----
 arch/riscv/kernel/setup.c          | 5 +----
 arch/s390/kernel/setup.c           | 5 +----
 arch/sh/kernel/setup.c             | 5 +----
 arch/x86/kernel/setup.c            | 5 +----
 include/linux/mm.h                 | 3 +++
 mm/init-mm.c                       | 9 +++++++++
 17 files changed, 27 insertions(+), 60 deletions(-)

-- 
2.26.2


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

* [PATCH v3 resend 01/15] mm: add setup_initial_init_mm() helper
  2021-06-08  8:34 [PATCH v3 resend 00/15] init_mm: cleanup ARCH's text/data/brk setup code Kefeng Wang
@ 2021-06-08  8:34 ` Kefeng Wang
  2021-06-08 14:53   ` Souptick Joarder
  2021-06-08  8:34 ` [PATCH v3 resend 02/15] arc: convert to setup_initial_init_mm() Kefeng Wang
                   ` (13 subsequent siblings)
  14 siblings, 1 reply; 22+ messages in thread
From: Kefeng Wang @ 2021-06-08  8:34 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: linux-mm, Kefeng Wang, linux-snps-arc, linux-arm-kernel,
	linux-csky, uclinux-h8-devel, linux-m68k, openrisc, linuxppc-dev,
	linux-riscv, linux-sh, linux-s390, x86

Add setup_initial_init_mm() helper to setup kernel text,
data and brk.

Cc: linux-snps-arc@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-csky@vger.kernel.org
Cc: uclinux-h8-devel@lists.sourceforge.jp
Cc: linux-m68k@lists.linux-m68k.org
Cc: openrisc@lists.librecores.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-riscv@lists.infradead.org
Cc: linux-sh@vger.kernel.org
Cc: linux-s390@vger.kernel.org
Cc: x86@kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 include/linux/mm.h | 3 +++
 mm/init-mm.c       | 9 +++++++++
 2 files changed, 12 insertions(+)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index c274f75efcf9..02aa057540b7 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -244,6 +244,9 @@ int __add_to_page_cache_locked(struct page *page, struct address_space *mapping,
 
 #define lru_to_page(head) (list_entry((head)->prev, struct page, lru))
 
+void setup_initial_init_mm(void *start_code, void *end_code,
+			   void *end_data, void *brk);
+
 /*
  * Linux kernel virtual memory manager primitives.
  * The idea being to have a "virtual" mm in the same way
diff --git a/mm/init-mm.c b/mm/init-mm.c
index 153162669f80..b4a6f38fb51d 100644
--- a/mm/init-mm.c
+++ b/mm/init-mm.c
@@ -40,3 +40,12 @@ struct mm_struct init_mm = {
 	.cpu_bitmap	= CPU_BITS_NONE,
 	INIT_MM_CONTEXT(init_mm)
 };
+
+void setup_initial_init_mm(void *start_code, void *end_code,
+			   void *end_data, void *brk)
+{
+	init_mm.start_code = (unsigned long)start_code;
+	init_mm.end_code = (unsigned long)end_code;
+	init_mm.end_data = (unsigned long)end_data;
+	init_mm.brk = (unsigned long)brk;
+}
-- 
2.26.2


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

* [PATCH v3 resend 02/15] arc: convert to setup_initial_init_mm()
  2021-06-08  8:34 [PATCH v3 resend 00/15] init_mm: cleanup ARCH's text/data/brk setup code Kefeng Wang
  2021-06-08  8:34 ` [PATCH v3 resend 01/15] mm: add setup_initial_init_mm() helper Kefeng Wang
@ 2021-06-08  8:34 ` Kefeng Wang
  2021-06-08  8:34 ` [PATCH v3 resend 03/15] arm: " Kefeng Wang
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Kefeng Wang @ 2021-06-08  8:34 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: linux-mm, Kefeng Wang, Vineet Gupta, linux-snps-arc

Use setup_initial_init_mm() helper to simplify code.

Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: linux-snps-arc@lists.infradead.org
Acked-by: Vineet Gupta <vgupta@synopsys.com>   #arch/arc
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/arc/mm/init.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
index e2ed355438c9..33b8fab89022 100644
--- a/arch/arc/mm/init.c
+++ b/arch/arc/mm/init.c
@@ -94,10 +94,7 @@ void __init setup_arch_memory(void)
 {
 	unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0 };
 
-	init_mm.start_code = (unsigned long)_text;
-	init_mm.end_code = (unsigned long)_etext;
-	init_mm.end_data = (unsigned long)_edata;
-	init_mm.brk = (unsigned long)_end;
+	setup_initial_init_mm(_text, _etext, _edata, _end);
 
 	/* first page of system - kernel .vector starts here */
 	min_low_pfn = virt_to_pfn(CONFIG_LINUX_RAM_BASE);
-- 
2.26.2


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

* [PATCH v3 resend 03/15] arm: convert to setup_initial_init_mm()
  2021-06-08  8:34 [PATCH v3 resend 00/15] init_mm: cleanup ARCH's text/data/brk setup code Kefeng Wang
  2021-06-08  8:34 ` [PATCH v3 resend 01/15] mm: add setup_initial_init_mm() helper Kefeng Wang
  2021-06-08  8:34 ` [PATCH v3 resend 02/15] arc: convert to setup_initial_init_mm() Kefeng Wang
@ 2021-06-08  8:34 ` Kefeng Wang
  2021-06-08  8:34 ` [PATCH v3 resend 04/15] arm64: " Kefeng Wang
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Kefeng Wang @ 2021-06-08  8:34 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: linux-mm, Kefeng Wang, Russell King, linux-arm-kernel, Russell King

Use setup_initial_init_mm() helper to simplify code.

Cc: Russell King <linux@armlinux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org
Acked-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/arm/kernel/setup.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 1a5edf562e85..81de1bf07ba6 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -1114,10 +1114,7 @@ void __init setup_arch(char **cmdline_p)
 	if (mdesc->reboot_mode != REBOOT_HARD)
 		reboot_mode = mdesc->reboot_mode;
 
-	init_mm.start_code = (unsigned long) _text;
-	init_mm.end_code   = (unsigned long) _etext;
-	init_mm.end_data   = (unsigned long) _edata;
-	init_mm.brk	   = (unsigned long) _end;
+	setup_initial_init_mm(_text, _etext, _edata, _end);
 
 	/* populate cmd_line too for later use, preserving boot_command_line */
 	strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE);
-- 
2.26.2


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

* [PATCH v3 resend 04/15] arm64: convert to setup_initial_init_mm()
  2021-06-08  8:34 [PATCH v3 resend 00/15] init_mm: cleanup ARCH's text/data/brk setup code Kefeng Wang
                   ` (2 preceding siblings ...)
  2021-06-08  8:34 ` [PATCH v3 resend 03/15] arm: " Kefeng Wang
@ 2021-06-08  8:34 ` Kefeng Wang
  2021-06-08  8:34 ` [PATCH v3 resend 05/15] csky: " Kefeng Wang
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Kefeng Wang @ 2021-06-08  8:34 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: linux-mm, Kefeng Wang, Catalin Marinas, Will Deacon, linux-arm-kernel

Use setup_initial_init_mm() helper to simplify code.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/arm64/kernel/setup.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 61845c0821d9..bfc98f893a1b 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -298,10 +298,7 @@ u64 cpu_logical_map(unsigned int cpu)
 
 void __init __no_sanitize_address setup_arch(char **cmdline_p)
 {
-	init_mm.start_code = (unsigned long) _stext;
-	init_mm.end_code   = (unsigned long) _etext;
-	init_mm.end_data   = (unsigned long) _edata;
-	init_mm.brk	   = (unsigned long) _end;
+	setup_initial_init_mm(_stext, _etext, _edata, _end);
 
 	*cmdline_p = boot_command_line;
 
-- 
2.26.2


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

* [PATCH v3 resend 05/15] csky: convert to setup_initial_init_mm()
  2021-06-08  8:34 [PATCH v3 resend 00/15] init_mm: cleanup ARCH's text/data/brk setup code Kefeng Wang
                   ` (3 preceding siblings ...)
  2021-06-08  8:34 ` [PATCH v3 resend 04/15] arm64: " Kefeng Wang
@ 2021-06-08  8:34 ` Kefeng Wang
  2021-06-08  8:34 ` [PATCH v3 resend 06/15] h8300: " Kefeng Wang
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Kefeng Wang @ 2021-06-08  8:34 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel; +Cc: linux-mm, Kefeng Wang, Guo Ren, linux-csky

Use setup_initial_init_mm() helper to simplify code.

Acked-by: Guo Ren <guoren@kernel.org>
Cc: Guo Ren <guoren@kernel.org>
Cc: linux-csky@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/csky/kernel/setup.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/csky/kernel/setup.c b/arch/csky/kernel/setup.c
index e93bc6f74432..c64e7be2045b 100644
--- a/arch/csky/kernel/setup.c
+++ b/arch/csky/kernel/setup.c
@@ -78,10 +78,7 @@ void __init setup_arch(char **cmdline_p)
 	pr_info("Phys. mem: %ldMB\n",
 		(unsigned long) memblock_phys_mem_size()/1024/1024);
 
-	init_mm.start_code = (unsigned long) _stext;
-	init_mm.end_code = (unsigned long) _etext;
-	init_mm.end_data = (unsigned long) _edata;
-	init_mm.brk = (unsigned long) _end;
+	setup_initial_init_mm(_stext, _etext, _edata, _end);
 
 	parse_early_param();
 
-- 
2.26.2


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

* [PATCH v3 resend 06/15] h8300: convert to setup_initial_init_mm()
  2021-06-08  8:34 [PATCH v3 resend 00/15] init_mm: cleanup ARCH's text/data/brk setup code Kefeng Wang
                   ` (4 preceding siblings ...)
  2021-06-08  8:34 ` [PATCH v3 resend 05/15] csky: " Kefeng Wang
@ 2021-06-08  8:34 ` Kefeng Wang
  2021-06-08  8:34 ` [PATCH v3 resend 07/15] m68k: " Kefeng Wang
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Kefeng Wang @ 2021-06-08  8:34 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: linux-mm, Kefeng Wang, Yoshinori Sato, uclinux-h8-devel

Use setup_initial_init_mm() helper to simplify code.

Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: uclinux-h8-devel@lists.sourceforge.jp
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/h8300/kernel/setup.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/h8300/kernel/setup.c b/arch/h8300/kernel/setup.c
index 0281f92eea3d..f757056305df 100644
--- a/arch/h8300/kernel/setup.c
+++ b/arch/h8300/kernel/setup.c
@@ -97,10 +97,7 @@ void __init setup_arch(char **cmdline_p)
 {
 	unflatten_and_copy_device_tree();
 
-	init_mm.start_code = (unsigned long) _stext;
-	init_mm.end_code = (unsigned long) _etext;
-	init_mm.end_data = (unsigned long) _edata;
-	init_mm.brk = (unsigned long) 0;
+	setup_initial_init_mm(_stext, _etext, _edata, NULL);
 
 	pr_notice("\r\n\nuClinux " CPU "\n");
 	pr_notice("Flat model support (C) 1998,1999 Kenneth Albanowski, D. Jeff Dionne\n");
-- 
2.26.2


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

* [PATCH v3 resend 07/15] m68k: convert to setup_initial_init_mm()
  2021-06-08  8:34 [PATCH v3 resend 00/15] init_mm: cleanup ARCH's text/data/brk setup code Kefeng Wang
                   ` (5 preceding siblings ...)
  2021-06-08  8:34 ` [PATCH v3 resend 06/15] h8300: " Kefeng Wang
@ 2021-06-08  8:34 ` Kefeng Wang
  2021-06-08  8:34 ` [PATCH v3 resend 08/15] nds32: " Kefeng Wang
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Kefeng Wang @ 2021-06-08  8:34 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: linux-mm, Kefeng Wang, Greg Ungerer, Geert Uytterhoeven, linux-m68k

Use setup_initial_init_mm() helper to simplify code.

Acked-by: Greg Ungerer <gerg@linux-m68k.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Greg Ungerer <gerg@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/m68k/kernel/setup_mm.c | 5 +----
 arch/m68k/kernel/setup_no.c | 5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index 017bac3aab80..4b51bfd38e5f 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -258,10 +258,7 @@ void __init setup_arch(char **cmdline_p)
 		}
 	}
 
-	init_mm.start_code = PAGE_OFFSET;
-	init_mm.end_code = (unsigned long)_etext;
-	init_mm.end_data = (unsigned long)_edata;
-	init_mm.brk = (unsigned long)_end;
+	setup_initial_init_mm((void *)PAGE_OFFSET, _etext, _edata, _end);
 
 #if defined(CONFIG_BOOTPARAM)
 	strncpy(m68k_command_line, CONFIG_BOOTPARAM_STRING, CL_SIZE);
diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c
index d1b7988efc91..5e4104f07a44 100644
--- a/arch/m68k/kernel/setup_no.c
+++ b/arch/m68k/kernel/setup_no.c
@@ -87,10 +87,7 @@ void __init setup_arch(char **cmdline_p)
 	memory_start = PAGE_ALIGN(_ramstart);
 	memory_end = _ramend;
 
-	init_mm.start_code = (unsigned long) &_stext;
-	init_mm.end_code = (unsigned long) &_etext;
-	init_mm.end_data = (unsigned long) &_edata;
-	init_mm.brk = (unsigned long) 0;
+	setup_initial_init_mm(_stext, _etext, _edata, NULL);
 
 	config_BSP(&command_line[0], sizeof(command_line));
 
-- 
2.26.2


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

* [PATCH v3 resend 08/15] nds32: convert to setup_initial_init_mm()
  2021-06-08  8:34 [PATCH v3 resend 00/15] init_mm: cleanup ARCH's text/data/brk setup code Kefeng Wang
                   ` (6 preceding siblings ...)
  2021-06-08  8:34 ` [PATCH v3 resend 07/15] m68k: " Kefeng Wang
@ 2021-06-08  8:34 ` Kefeng Wang
  2021-06-08  8:34 ` [PATCH v3 resend 09/15] nios2: " Kefeng Wang
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Kefeng Wang @ 2021-06-08  8:34 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel; +Cc: linux-mm, Kefeng Wang, Nick Hu, Greentime Hu

Use setup_initial_init_mm() helper to simplify code.

Cc: Nick Hu <nickhu@andestech.com>
Cc: Greentime Hu <green.hu@gmail.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/nds32/kernel/setup.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/nds32/kernel/setup.c b/arch/nds32/kernel/setup.c
index af82e996f412..41725eaf8bac 100644
--- a/arch/nds32/kernel/setup.c
+++ b/arch/nds32/kernel/setup.c
@@ -294,10 +294,7 @@ void __init setup_arch(char **cmdline_p)
 
 	setup_cpuinfo();
 
-	init_mm.start_code = (unsigned long)&_stext;
-	init_mm.end_code = (unsigned long)&_etext;
-	init_mm.end_data = (unsigned long)&_edata;
-	init_mm.brk = (unsigned long)&_end;
+	setup_initial_init_mm(_stext, _etext, _edata, _end);
 
 	/* setup bootmem allocator */
 	setup_memory();
-- 
2.26.2


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

* [PATCH v3 resend 09/15] nios2: convert to setup_initial_init_mm()
  2021-06-08  8:34 [PATCH v3 resend 00/15] init_mm: cleanup ARCH's text/data/brk setup code Kefeng Wang
                   ` (7 preceding siblings ...)
  2021-06-08  8:34 ` [PATCH v3 resend 08/15] nds32: " Kefeng Wang
@ 2021-06-08  8:34 ` Kefeng Wang
  2021-06-08  8:34 ` [PATCH v3 resend 10/15] openrisc: " Kefeng Wang
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Kefeng Wang @ 2021-06-08  8:34 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel; +Cc: linux-mm, Kefeng Wang, Ley Foon Tan

Use setup_initial_init_mm() helper to simplify code.

Cc: Ley Foon Tan <ley.foon.tan@intel.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/nios2/kernel/setup.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/nios2/kernel/setup.c b/arch/nios2/kernel/setup.c
index d2f21957e99c..cf8d687a2644 100644
--- a/arch/nios2/kernel/setup.c
+++ b/arch/nios2/kernel/setup.c
@@ -156,10 +156,7 @@ void __init setup_arch(char **cmdline_p)
 	memory_start = memblock_start_of_DRAM();
 	memory_end = memblock_end_of_DRAM();
 
-	init_mm.start_code = (unsigned long) _stext;
-	init_mm.end_code = (unsigned long) _etext;
-	init_mm.end_data = (unsigned long) _edata;
-	init_mm.brk = (unsigned long) _end;
+	setup_initial_init_mm(_stext, _etext, _edata, _end);
 	init_task.thread.kregs = &fake_regs;
 
 	/* Keep a copy of command line */
-- 
2.26.2


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

* [PATCH v3 resend 10/15] openrisc: convert to setup_initial_init_mm()
  2021-06-08  8:34 [PATCH v3 resend 00/15] init_mm: cleanup ARCH's text/data/brk setup code Kefeng Wang
                   ` (8 preceding siblings ...)
  2021-06-08  8:34 ` [PATCH v3 resend 09/15] nios2: " Kefeng Wang
@ 2021-06-08  8:34 ` Kefeng Wang
  2021-06-08  8:34 ` [PATCH v3 resend 11/15] powerpc: " Kefeng Wang
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Kefeng Wang @ 2021-06-08  8:34 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: linux-mm, Kefeng Wang, Stafford Horne, Jonas Bonn,
	Stefan Kristiansson, openrisc

Use setup_initial_init_mm() helper to simplify code.

Acked-by: Stafford Horne <shorne@gmail.com>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Cc: Stafford Horne <shorne@gmail.com>
Cc: openrisc@lists.librecores.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/openrisc/kernel/setup.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
index c6f9e7b9f7cb..8ae2da6ac097 100644
--- a/arch/openrisc/kernel/setup.c
+++ b/arch/openrisc/kernel/setup.c
@@ -293,10 +293,7 @@ void __init setup_arch(char **cmdline_p)
 #endif
 
 	/* process 1's initial memory region is the kernel code/data */
-	init_mm.start_code = (unsigned long)_stext;
-	init_mm.end_code = (unsigned long)_etext;
-	init_mm.end_data = (unsigned long)_edata;
-	init_mm.brk = (unsigned long)_end;
+	setup_initial_init_mm(_stext, _etext, _edata, _end);
 
 #ifdef CONFIG_BLK_DEV_INITRD
 	if (initrd_start == initrd_end) {
-- 
2.26.2


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

* [PATCH v3 resend 11/15] powerpc: convert to setup_initial_init_mm()
  2021-06-08  8:34 [PATCH v3 resend 00/15] init_mm: cleanup ARCH's text/data/brk setup code Kefeng Wang
                   ` (9 preceding siblings ...)
  2021-06-08  8:34 ` [PATCH v3 resend 10/15] openrisc: " Kefeng Wang
@ 2021-06-08  8:34 ` Kefeng Wang
  2021-06-08 14:36   ` Souptick Joarder
  2021-06-08  8:34 ` [PATCH v3 resend 12/15] riscv: " Kefeng Wang
                   ` (3 subsequent siblings)
  14 siblings, 1 reply; 22+ messages in thread
From: Kefeng Wang @ 2021-06-08  8:34 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: linux-mm, Kefeng Wang, Michael Ellerman, Benjamin Herrenschmidt,
	linuxppc-dev

Use setup_initial_init_mm() helper to simplify code.

Note klimit is (unsigned long) _end, with new helper,
will use _end directly.

Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/powerpc/kernel/setup-common.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 74a98fff2c2f..96697c6e1e16 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -927,10 +927,7 @@ void __init setup_arch(char **cmdline_p)
 
 	klp_init_thread_info(&init_task);
 
-	init_mm.start_code = (unsigned long)_stext;
-	init_mm.end_code = (unsigned long) _etext;
-	init_mm.end_data = (unsigned long) _edata;
-	init_mm.brk = klimit;
+	setup_initial_init_mm(_stext, _etext, _edata, _end);
 
 	mm_iommu_init(&init_mm);
 	irqstack_early_init();
-- 
2.26.2


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

* [PATCH v3 resend 12/15] riscv: convert to setup_initial_init_mm()
  2021-06-08  8:34 [PATCH v3 resend 00/15] init_mm: cleanup ARCH's text/data/brk setup code Kefeng Wang
                   ` (10 preceding siblings ...)
  2021-06-08  8:34 ` [PATCH v3 resend 11/15] powerpc: " Kefeng Wang
@ 2021-06-08  8:34 ` Kefeng Wang
  2021-06-08  8:34 ` [PATCH v3 resend 13/15] s390: " Kefeng Wang
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Kefeng Wang @ 2021-06-08  8:34 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: linux-mm, Kefeng Wang, Paul Walmsley, Palmer Dabbelt, linux-riscv

Use setup_initial_init_mm() helper to simplify code.

Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: linux-riscv@lists.infradead.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/riscv/kernel/setup.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index 9a1b7a0603b2..8e318f207ac6 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -264,10 +264,7 @@ static void __init parse_dtb(void)
 void __init setup_arch(char **cmdline_p)
 {
 	parse_dtb();
-	init_mm.start_code = (unsigned long) _stext;
-	init_mm.end_code   = (unsigned long) _etext;
-	init_mm.end_data   = (unsigned long) _edata;
-	init_mm.brk        = (unsigned long) _end;
+	setup_initial_init_mm(_stext, _etext, _edata, _end);
 
 	*cmdline_p = boot_command_line;
 
-- 
2.26.2


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

* [PATCH v3 resend 13/15] s390: convert to setup_initial_init_mm()
  2021-06-08  8:34 [PATCH v3 resend 00/15] init_mm: cleanup ARCH's text/data/brk setup code Kefeng Wang
                   ` (11 preceding siblings ...)
  2021-06-08  8:34 ` [PATCH v3 resend 12/15] riscv: " Kefeng Wang
@ 2021-06-08  8:34 ` Kefeng Wang
  2021-06-08  8:34 ` [PATCH v3 resend 14/15] sh: " Kefeng Wang
  2021-06-08  8:34 ` [PATCH v3 resend 15/15] x86: " Kefeng Wang
  14 siblings, 0 replies; 22+ messages in thread
From: Kefeng Wang @ 2021-06-08  8:34 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: linux-mm, Kefeng Wang, Heiko Carstens, Vasily Gorbik,
	Christian Borntraeger, linux-s390

Use setup_initial_init_mm() helper to simplify code.

Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: linux-s390@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/s390/kernel/setup.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 5aab59ad5688..e1793ed43510 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -1119,10 +1119,7 @@ void __init setup_arch(char **cmdline_p)
 
         ROOT_DEV = Root_RAM0;
 
-	init_mm.start_code = (unsigned long) _text;
-	init_mm.end_code = (unsigned long) _etext;
-	init_mm.end_data = (unsigned long) _edata;
-	init_mm.brk = (unsigned long) _end;
+	setup_initial_init_mm(_text, _etext, _edata, _end);
 
 	if (IS_ENABLED(CONFIG_EXPOLINE_AUTO))
 		nospec_auto_detect();
-- 
2.26.2


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

* [PATCH v3 resend 14/15] sh: convert to setup_initial_init_mm()
  2021-06-08  8:34 [PATCH v3 resend 00/15] init_mm: cleanup ARCH's text/data/brk setup code Kefeng Wang
                   ` (12 preceding siblings ...)
  2021-06-08  8:34 ` [PATCH v3 resend 13/15] s390: " Kefeng Wang
@ 2021-06-08  8:34 ` Kefeng Wang
  2021-06-08  8:34 ` [PATCH v3 resend 15/15] x86: " Kefeng Wang
  14 siblings, 0 replies; 22+ messages in thread
From: Kefeng Wang @ 2021-06-08  8:34 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: linux-mm, Kefeng Wang, Yoshinori Sato, Rich Felker, linux-sh

Use setup_initial_init_mm() helper to simplify code.

Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: linux-sh@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/sh/kernel/setup.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index 4144be650d41..1fcb6659822a 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -294,10 +294,7 @@ void __init setup_arch(char **cmdline_p)
 
 	if (!MOUNT_ROOT_RDONLY)
 		root_mountflags &= ~MS_RDONLY;
-	init_mm.start_code = (unsigned long) _text;
-	init_mm.end_code = (unsigned long) _etext;
-	init_mm.end_data = (unsigned long) _edata;
-	init_mm.brk = (unsigned long) _end;
+	setup_initial_init_mm(_text, _etext, _edata, _end);
 
 	code_resource.start = virt_to_phys(_text);
 	code_resource.end = virt_to_phys(_etext)-1;
-- 
2.26.2


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

* [PATCH v3 resend 15/15] x86: convert to setup_initial_init_mm()
  2021-06-08  8:34 [PATCH v3 resend 00/15] init_mm: cleanup ARCH's text/data/brk setup code Kefeng Wang
                   ` (13 preceding siblings ...)
  2021-06-08  8:34 ` [PATCH v3 resend 14/15] sh: " Kefeng Wang
@ 2021-06-08  8:34 ` Kefeng Wang
  14 siblings, 0 replies; 22+ messages in thread
From: Kefeng Wang @ 2021-06-08  8:34 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: linux-mm, Kefeng Wang, Thomas Gleixner, Ingo Molnar, x86

Use setup_initial_init_mm() helper to simplify code.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: x86@kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/x86/kernel/setup.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 1e720626069a..7ca94d062c79 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -870,10 +870,7 @@ void __init setup_arch(char **cmdline_p)
 
 	if (!boot_params.hdr.root_flags)
 		root_mountflags &= ~MS_RDONLY;
-	init_mm.start_code = (unsigned long) _text;
-	init_mm.end_code = (unsigned long) _etext;
-	init_mm.end_data = (unsigned long) _edata;
-	init_mm.brk = _brk_end;
+	setup_initial_init_mm(_text, _etext, _edata, (void *)_brk_end);
 
 	code_resource.start = __pa_symbol(_text);
 	code_resource.end = __pa_symbol(_etext)-1;
-- 
2.26.2


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

* Re: [PATCH v3 resend 11/15] powerpc: convert to setup_initial_init_mm()
  2021-06-08  8:34 ` [PATCH v3 resend 11/15] powerpc: " Kefeng Wang
@ 2021-06-08 14:36   ` Souptick Joarder
  2021-06-08 14:54     ` Christophe Leroy
  0 siblings, 1 reply; 22+ messages in thread
From: Souptick Joarder @ 2021-06-08 14:36 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: Andrew Morton, linux-kernel, Linux-MM, Michael Ellerman,
	Benjamin Herrenschmidt, linuxppc-dev

On Tue, Jun 8, 2021 at 1:56 PM Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
>
> Use setup_initial_init_mm() helper to simplify code.
>
> Note klimit is (unsigned long) _end, with new helper,
> will use _end directly.

With this change klimit left with no user in this file and can be
moved to some appropriate header.
But in a separate series.

>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: linuxppc-dev@lists.ozlabs.org
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  arch/powerpc/kernel/setup-common.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
> index 74a98fff2c2f..96697c6e1e16 100644
> --- a/arch/powerpc/kernel/setup-common.c
> +++ b/arch/powerpc/kernel/setup-common.c
> @@ -927,10 +927,7 @@ void __init setup_arch(char **cmdline_p)
>
>         klp_init_thread_info(&init_task);
>
> -       init_mm.start_code = (unsigned long)_stext;
> -       init_mm.end_code = (unsigned long) _etext;
> -       init_mm.end_data = (unsigned long) _edata;
> -       init_mm.brk = klimit;
> +       setup_initial_init_mm(_stext, _etext, _edata, _end);
>
>         mm_iommu_init(&init_mm);
>         irqstack_early_init();
> --
> 2.26.2
>
>

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

* Re: [PATCH v3 resend 01/15] mm: add setup_initial_init_mm() helper
  2021-06-08  8:34 ` [PATCH v3 resend 01/15] mm: add setup_initial_init_mm() helper Kefeng Wang
@ 2021-06-08 14:53   ` Souptick Joarder
  2021-06-08 14:57     ` Christophe Leroy
  0 siblings, 1 reply; 22+ messages in thread
From: Souptick Joarder @ 2021-06-08 14:53 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: Andrew Morton, linux-kernel, Linux-MM, linux-snps-arc,
	linux-arm-kernel, linux-csky, uclinux-h8-devel, linux-m68k,
	openrisc, linuxppc-dev, linux-riscv, linux-sh, linux-s390,
	X86 ML

On Tue, Jun 8, 2021 at 1:56 PM Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
>
> Add setup_initial_init_mm() helper to setup kernel text,
> data and brk.
>
> Cc: linux-snps-arc@lists.infradead.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-csky@vger.kernel.org
> Cc: uclinux-h8-devel@lists.sourceforge.jp
> Cc: linux-m68k@lists.linux-m68k.org
> Cc: openrisc@lists.librecores.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: linux-riscv@lists.infradead.org
> Cc: linux-sh@vger.kernel.org
> Cc: linux-s390@vger.kernel.org
> Cc: x86@kernel.org
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  include/linux/mm.h | 3 +++
>  mm/init-mm.c       | 9 +++++++++
>  2 files changed, 12 insertions(+)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index c274f75efcf9..02aa057540b7 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -244,6 +244,9 @@ int __add_to_page_cache_locked(struct page *page, struct address_space *mapping,
>
>  #define lru_to_page(head) (list_entry((head)->prev, struct page, lru))
>
> +void setup_initial_init_mm(void *start_code, void *end_code,
> +                          void *end_data, void *brk);
> +

Gentle query -> is there any limitation to add inline functions in
setup_arch() functions ?

>  /*
>   * Linux kernel virtual memory manager primitives.
>   * The idea being to have a "virtual" mm in the same way
> diff --git a/mm/init-mm.c b/mm/init-mm.c
> index 153162669f80..b4a6f38fb51d 100644
> --- a/mm/init-mm.c
> +++ b/mm/init-mm.c
> @@ -40,3 +40,12 @@ struct mm_struct init_mm = {
>         .cpu_bitmap     = CPU_BITS_NONE,
>         INIT_MM_CONTEXT(init_mm)
>  };
> +
> +void setup_initial_init_mm(void *start_code, void *end_code,
> +                          void *end_data, void *brk)
> +{
> +       init_mm.start_code = (unsigned long)start_code;
> +       init_mm.end_code = (unsigned long)end_code;
> +       init_mm.end_data = (unsigned long)end_data;
> +       init_mm.brk = (unsigned long)brk;
> +}
> --
> 2.26.2
>
>

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

* Re: [PATCH v3 resend 11/15] powerpc: convert to setup_initial_init_mm()
  2021-06-08 14:36   ` Souptick Joarder
@ 2021-06-08 14:54     ` Christophe Leroy
  2021-06-08 15:11       ` Souptick Joarder
  0 siblings, 1 reply; 22+ messages in thread
From: Christophe Leroy @ 2021-06-08 14:54 UTC (permalink / raw)
  To: Souptick Joarder, Kefeng Wang
  Cc: linux-kernel, Linux-MM, Andrew Morton, linuxppc-dev



Le 08/06/2021 à 16:36, Souptick Joarder a écrit :
> On Tue, Jun 8, 2021 at 1:56 PM Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
>>
>> Use setup_initial_init_mm() helper to simplify code.
>>
>> Note klimit is (unsigned long) _end, with new helper,
>> will use _end directly.
> 
> With this change klimit left with no user in this file and can be
> moved to some appropriate header.
> But in a separate series.

I have a patch to remove klimit, see 
https://patchwork.ozlabs.org/project/linuxppc-dev/patch/9fa9ba6807c17f93f35a582c199c646c4a8bfd9c.1622800638.git.christophe.leroy@csgroup.eu/

Christophe


> 
>>
>> Cc: Michael Ellerman <mpe@ellerman.id.au>
>> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> Cc: linuxppc-dev@lists.ozlabs.org
>> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
>> ---
>>   arch/powerpc/kernel/setup-common.c | 5 +----
>>   1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
>> index 74a98fff2c2f..96697c6e1e16 100644
>> --- a/arch/powerpc/kernel/setup-common.c
>> +++ b/arch/powerpc/kernel/setup-common.c
>> @@ -927,10 +927,7 @@ void __init setup_arch(char **cmdline_p)
>>
>>          klp_init_thread_info(&init_task);
>>
>> -       init_mm.start_code = (unsigned long)_stext;
>> -       init_mm.end_code = (unsigned long) _etext;
>> -       init_mm.end_data = (unsigned long) _edata;
>> -       init_mm.brk = klimit;
>> +       setup_initial_init_mm(_stext, _etext, _edata, _end);
>>
>>          mm_iommu_init(&init_mm);
>>          irqstack_early_init();
>> --
>> 2.26.2
>>
>>

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

* Re: [PATCH v3 resend 01/15] mm: add setup_initial_init_mm() helper
  2021-06-08 14:53   ` Souptick Joarder
@ 2021-06-08 14:57     ` Christophe Leroy
  2021-06-08 15:14       ` Souptick Joarder
  0 siblings, 1 reply; 22+ messages in thread
From: Christophe Leroy @ 2021-06-08 14:57 UTC (permalink / raw)
  To: Souptick Joarder, Kefeng Wang
  Cc: uclinux-h8-devel, linux-s390, linux-sh, X86 ML, linux-kernel,
	linux-csky, Linux-MM, linux-m68k, openrisc, Andrew Morton,
	linux-snps-arc, linuxppc-dev, linux-riscv, linux-arm-kernel



Le 08/06/2021 à 16:53, Souptick Joarder a écrit :
> On Tue, Jun 8, 2021 at 1:56 PM Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
>>
>> Add setup_initial_init_mm() helper to setup kernel text,
>> data and brk.
>>
>> Cc: linux-snps-arc@lists.infradead.org
>> Cc: linux-arm-kernel@lists.infradead.org
>> Cc: linux-csky@vger.kernel.org
>> Cc: uclinux-h8-devel@lists.sourceforge.jp
>> Cc: linux-m68k@lists.linux-m68k.org
>> Cc: openrisc@lists.librecores.org
>> Cc: linuxppc-dev@lists.ozlabs.org
>> Cc: linux-riscv@lists.infradead.org
>> Cc: linux-sh@vger.kernel.org
>> Cc: linux-s390@vger.kernel.org
>> Cc: x86@kernel.org
>> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
>> ---
>>   include/linux/mm.h | 3 +++
>>   mm/init-mm.c       | 9 +++++++++
>>   2 files changed, 12 insertions(+)
>>
>> diff --git a/include/linux/mm.h b/include/linux/mm.h
>> index c274f75efcf9..02aa057540b7 100644
>> --- a/include/linux/mm.h
>> +++ b/include/linux/mm.h
>> @@ -244,6 +244,9 @@ int __add_to_page_cache_locked(struct page *page, struct address_space *mapping,
>>
>>   #define lru_to_page(head) (list_entry((head)->prev, struct page, lru))
>>
>> +void setup_initial_init_mm(void *start_code, void *end_code,
>> +                          void *end_data, void *brk);
>> +
> 
> Gentle query -> is there any limitation to add inline functions in
> setup_arch() functions ?

Kefeng just followed comment from Mike I guess, see 
https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20210604070633.32363-2-wangkefeng.wang@huawei.com/#2696253

Christophe


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

* Re: [PATCH v3 resend 11/15] powerpc: convert to setup_initial_init_mm()
  2021-06-08 14:54     ` Christophe Leroy
@ 2021-06-08 15:11       ` Souptick Joarder
  0 siblings, 0 replies; 22+ messages in thread
From: Souptick Joarder @ 2021-06-08 15:11 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: Kefeng Wang, linux-kernel, Linux-MM, Andrew Morton, linuxppc-dev

On Tue, Jun 8, 2021 at 8:24 PM Christophe Leroy
<christophe.leroy@csgroup.eu> wrote:
>
>
>
> Le 08/06/2021 à 16:36, Souptick Joarder a écrit :
> > On Tue, Jun 8, 2021 at 1:56 PM Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
> >>
> >> Use setup_initial_init_mm() helper to simplify code.
> >>
> >> Note klimit is (unsigned long) _end, with new helper,
> >> will use _end directly.
> >
> > With this change klimit left with no user in this file and can be
> > moved to some appropriate header.
> > But in a separate series.
>
> I have a patch to remove klimit, see
> https://patchwork.ozlabs.org/project/linuxppc-dev/patch/9fa9ba6807c17f93f35a582c199c646c4a8bfd9c.1622800638.git.christophe.leroy@csgroup.eu/

Got it. Thanks :)

>
> Christophe
>
>
> >
> >>
> >> Cc: Michael Ellerman <mpe@ellerman.id.au>
> >> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> >> Cc: linuxppc-dev@lists.ozlabs.org
> >> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> >> ---
> >>   arch/powerpc/kernel/setup-common.c | 5 +----
> >>   1 file changed, 1 insertion(+), 4 deletions(-)
> >>
> >> diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
> >> index 74a98fff2c2f..96697c6e1e16 100644
> >> --- a/arch/powerpc/kernel/setup-common.c
> >> +++ b/arch/powerpc/kernel/setup-common.c
> >> @@ -927,10 +927,7 @@ void __init setup_arch(char **cmdline_p)
> >>
> >>          klp_init_thread_info(&init_task);
> >>
> >> -       init_mm.start_code = (unsigned long)_stext;
> >> -       init_mm.end_code = (unsigned long) _etext;
> >> -       init_mm.end_data = (unsigned long) _edata;
> >> -       init_mm.brk = klimit;
> >> +       setup_initial_init_mm(_stext, _etext, _edata, _end);
> >>
> >>          mm_iommu_init(&init_mm);
> >>          irqstack_early_init();
> >> --
> >> 2.26.2
> >>
> >>

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

* Re: [PATCH v3 resend 01/15] mm: add setup_initial_init_mm() helper
  2021-06-08 14:57     ` Christophe Leroy
@ 2021-06-08 15:14       ` Souptick Joarder
  0 siblings, 0 replies; 22+ messages in thread
From: Souptick Joarder @ 2021-06-08 15:14 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: Kefeng Wang, uclinux-h8-devel, linux-s390, linux-sh, X86 ML,
	linux-kernel, linux-csky, Linux-MM, linux-m68k, openrisc,
	Andrew Morton, linux-snps-arc, linuxppc-dev, linux-riscv,
	linux-arm-kernel

On Tue, Jun 8, 2021 at 8:27 PM Christophe Leroy
<christophe.leroy@csgroup.eu> wrote:
>
>
>
> Le 08/06/2021 à 16:53, Souptick Joarder a écrit :
> > On Tue, Jun 8, 2021 at 1:56 PM Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
> >>
> >> Add setup_initial_init_mm() helper to setup kernel text,
> >> data and brk.
> >>
> >> Cc: linux-snps-arc@lists.infradead.org
> >> Cc: linux-arm-kernel@lists.infradead.org
> >> Cc: linux-csky@vger.kernel.org
> >> Cc: uclinux-h8-devel@lists.sourceforge.jp
> >> Cc: linux-m68k@lists.linux-m68k.org
> >> Cc: openrisc@lists.librecores.org
> >> Cc: linuxppc-dev@lists.ozlabs.org
> >> Cc: linux-riscv@lists.infradead.org
> >> Cc: linux-sh@vger.kernel.org
> >> Cc: linux-s390@vger.kernel.org
> >> Cc: x86@kernel.org
> >> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> >> ---
> >>   include/linux/mm.h | 3 +++
> >>   mm/init-mm.c       | 9 +++++++++
> >>   2 files changed, 12 insertions(+)
> >>
> >> diff --git a/include/linux/mm.h b/include/linux/mm.h
> >> index c274f75efcf9..02aa057540b7 100644
> >> --- a/include/linux/mm.h
> >> +++ b/include/linux/mm.h
> >> @@ -244,6 +244,9 @@ int __add_to_page_cache_locked(struct page *page, struct address_space *mapping,
> >>
> >>   #define lru_to_page(head) (list_entry((head)->prev, struct page, lru))
> >>
> >> +void setup_initial_init_mm(void *start_code, void *end_code,
> >> +                          void *end_data, void *brk);
> >> +
> >
> > Gentle query -> is there any limitation to add inline functions in
> > setup_arch() functions ?
>
> Kefeng just followed comment from Mike I guess, see
> https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20210604070633.32363-2-wangkefeng.wang@huawei.com/#2696253

Ok.
>
> Christophe
>

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

end of thread, other threads:[~2021-06-08 15:14 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-08  8:34 [PATCH v3 resend 00/15] init_mm: cleanup ARCH's text/data/brk setup code Kefeng Wang
2021-06-08  8:34 ` [PATCH v3 resend 01/15] mm: add setup_initial_init_mm() helper Kefeng Wang
2021-06-08 14:53   ` Souptick Joarder
2021-06-08 14:57     ` Christophe Leroy
2021-06-08 15:14       ` Souptick Joarder
2021-06-08  8:34 ` [PATCH v3 resend 02/15] arc: convert to setup_initial_init_mm() Kefeng Wang
2021-06-08  8:34 ` [PATCH v3 resend 03/15] arm: " Kefeng Wang
2021-06-08  8:34 ` [PATCH v3 resend 04/15] arm64: " Kefeng Wang
2021-06-08  8:34 ` [PATCH v3 resend 05/15] csky: " Kefeng Wang
2021-06-08  8:34 ` [PATCH v3 resend 06/15] h8300: " Kefeng Wang
2021-06-08  8:34 ` [PATCH v3 resend 07/15] m68k: " Kefeng Wang
2021-06-08  8:34 ` [PATCH v3 resend 08/15] nds32: " Kefeng Wang
2021-06-08  8:34 ` [PATCH v3 resend 09/15] nios2: " Kefeng Wang
2021-06-08  8:34 ` [PATCH v3 resend 10/15] openrisc: " Kefeng Wang
2021-06-08  8:34 ` [PATCH v3 resend 11/15] powerpc: " Kefeng Wang
2021-06-08 14:36   ` Souptick Joarder
2021-06-08 14:54     ` Christophe Leroy
2021-06-08 15:11       ` Souptick Joarder
2021-06-08  8:34 ` [PATCH v3 resend 12/15] riscv: " Kefeng Wang
2021-06-08  8:34 ` [PATCH v3 resend 13/15] s390: " Kefeng Wang
2021-06-08  8:34 ` [PATCH v3 resend 14/15] sh: " Kefeng Wang
2021-06-08  8:34 ` [PATCH v3 resend 15/15] x86: " Kefeng Wang

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