linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 resend 01/15] mm: add setup_initial_init_mm() helper
       [not found] <20210608083418.137226-1-wangkefeng.wang@huawei.com>
@ 2021-06-08  8:34 ` Kefeng Wang
  2021-06-08 14:53   ` Souptick Joarder
  2021-06-08  8:34 ` [PATCH v3 resend 11/15] powerpc: convert to setup_initial_init_mm() Kefeng Wang
  1 sibling, 1 reply; 8+ messages in thread
From: Kefeng Wang @ 2021-06-08  8:34 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: uclinux-h8-devel, linux-s390, Kefeng Wang, linux-sh, x86,
	linux-csky, linux-mm, linux-m68k, openrisc, linux-riscv,
	linux-snps-arc, linuxppc-dev, linux-arm-kernel

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] 8+ messages in thread

* [PATCH v3 resend 11/15] powerpc: convert to setup_initial_init_mm()
       [not found] <20210608083418.137226-1-wangkefeng.wang@huawei.com>
  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 14:36   ` Souptick Joarder
  1 sibling, 1 reply; 8+ messages in thread
From: Kefeng Wang @ 2021-06-08  8:34 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel; +Cc: linux-mm, Kefeng Wang, 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] 8+ 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: convert to setup_initial_init_mm() Kefeng Wang
@ 2021-06-08 14:36   ` Souptick Joarder
  2021-06-08 14:54     ` Christophe Leroy
  0 siblings, 1 reply; 8+ messages in thread
From: Souptick Joarder @ 2021-06-08 14:36 UTC (permalink / raw)
  To: Kefeng Wang; +Cc: linux-kernel, Linux-MM, Andrew Morton, 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] 8+ 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; 8+ messages in thread
From: Souptick Joarder @ 2021-06-08 14:53 UTC (permalink / raw)
  To: 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

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] 8+ 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; 8+ messages in thread
From: Christophe Leroy @ 2021-06-08 14:54 UTC (permalink / raw)
  To: Souptick Joarder, Kefeng Wang
  Cc: Linux-MM, Andrew Morton, linuxppc-dev, linux-kernel



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] 8+ 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; 8+ 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] 8+ 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; 8+ messages in thread
From: Souptick Joarder @ 2021-06-08 15:11 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: Linux-MM, Kefeng Wang, linuxppc-dev, linux-kernel, Andrew Morton

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] 8+ 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; 8+ messages in thread
From: Souptick Joarder @ 2021-06-08 15:14 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: uclinux-h8-devel, linux-s390, Kefeng Wang, 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] 8+ messages in thread

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210608083418.137226-1-wangkefeng.wang@huawei.com>
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 11/15] powerpc: convert to setup_initial_init_mm() Kefeng Wang
2021-06-08 14:36   ` Souptick Joarder
2021-06-08 14:54     ` Christophe Leroy
2021-06-08 15:11       ` Souptick Joarder

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