linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Re: linux-next: Tree for Dec 1 (riscv, crash_core)
@ 2023-12-04  2:10 Baoquan He
  2023-12-04  2:19 ` [PATCH 1/2] riscv, crash: don't export some symbols when CONFIG_MMU=n Baoquan He
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Baoquan He @ 2023-12-04  2:10 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: Stephen Rothwell, akpm, ignat, linux-next, linux-kernel,
	linux-riscv, kexec, eric_devolder

eric_devolder@yahoo.com, ignat@cloudflare.com,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-riscv <linux-riscv@lists.infradead.org>,
	kexec <kexec@lists.infradead.org>
Bcc: bhe@redhat.com
Subject: Re: linux-next: Tree for Dec 1 (riscv, crash_core)
Reply-To: 
In-Reply-To: <bbd1bbfb-c482-433d-bce9-2b591b8e855e@infradead.org>

On 12/01/23 at 11:53am, Randy Dunlap wrote:
> 
> 
> On 11/30/23 18:37, Stephen Rothwell wrote:
> > Hi all,
> > 
> > Changes since 20231130:
> > 
> 
> on riscv 32-bit or 64-bit, with
> # CONFIG_MMU is not set

Thanks for providing the kernel config to ease reproduction. In the config,
there are:

CONFIG_CRASH_CORE=y
CONFIG_KEXEC_CORE=y
CONFIG_CRASH_DUMP=y
......
# CONFIG_MMU is not set

After investigation, I found this happened after Ignat's patch:
commit 1c7a3fa49ef7 ("kexec: drop dependency on ARCH_SUPPORTS_KEXEC from CRASH_DUMP")

Copy above commit change here for reference, and also risc-v's
ARCH_SUPPORTS_KEXEC depends on MMU:
--------------------------------------------------------
diff --git a/kernel/Kconfig.kexec b/kernel/Kconfig.kexec
index fc38f1ae3a30..946dffa048b7 100644
--- a/kernel/Kconfig.kexec
+++ b/kernel/Kconfig.kexec
@@ -96,7 +96,6 @@ config KEXEC_JUMP
 config CRASH_DUMP
        bool "kernel crash dumps"
        depends on ARCH_SUPPORTS_CRASH_DUMP
-       depends on ARCH_SUPPORTS_KEXEC
        select CRASH_CORE
        select KEXEC_CORE
        help

arch/riscv/Kconfig
---------------------
config ARCH_SUPPORTS_KEXEC
        def_bool MMU

Before Ignat's patch, once CONFIG_MMU is unset, CONFIG_CRASH_DUMP,
CONFIG_KEXEC_CORE, CONFIG_CRASH_CORE are all unset automatically. The
crash_core codes are not compiled. That's why no compiling error is
seen.

After Ignat's patch applied, we can enable CONFIG_CRASH_DUMP,
CONFIG_KEXEC_CORE, CONFIG_CRASH_CORE independently. However, there are
several macro definitions, such as VA_BITS, VMEMMAP_START, VMEMMAP_END,
MODULES_VADDR, MODULES_END are only available when CONFIG_MMU=y.

I made two patches to decouple the kexec/crash code with CONFIG_MMU. Not
sure if risc-v wants that.

Or we can simply add dependency on MMU for ARCH_SUPPORTS_CRASH_DUMP.
Then when CONFIG_MMU=n, CONFIG_CRASH_DUMP, CONFIG_KEXEC_CORE,
CONFIG_CRASH_CORE will be unset too. Please help check which one need be
taken.


diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 24c1799e2ec4..03d290da7262 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -708,6 +708,7 @@ config ARCH_SUPPORTS_KEXEC_PURGATORY
 
 config ARCH_SUPPORTS_CRASH_DUMP
 	def_bool y
+	depends on MMU=y
 
 config ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
 	def_bool CRASH_CORE

> 
> In file included from ../arch/riscv/kernel/crash_core.c:3:
> ../arch/riscv/kernel/crash_core.c: In function 'arch_crash_save_vmcoreinfo':
> ../arch/riscv/kernel/crash_core.c:8:27: error: 'VA_BITS' undeclared (first use in this function)
>     8 |         VMCOREINFO_NUMBER(VA_BITS);
>       |                           ^~~~~~~
> ../include/linux/crash_core.h:78:64: note: in definition of macro 'VMCOREINFO_NUMBER'
>    78 |         vmcoreinfo_append_str("NUMBER(%s)=%ld\n", #name, (long)name)
>       |                                                                ^~~~
> ../arch/riscv/kernel/crash_core.c:8:27: note: each undeclared identifier is reported only once for each function it appears in
>     8 |         VMCOREINFO_NUMBER(VA_BITS);
>       |                           ^~~~~~~
> ../include/linux/crash_core.h:78:64: note: in definition of macro 'VMCOREINFO_NUMBER'
>    78 |         vmcoreinfo_append_str("NUMBER(%s)=%ld\n", #name, (long)name)
>       |                                                                ^~~~
> ../arch/riscv/kernel/crash_core.c:12:58: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'int' [-Wformat=]
>    12 |         vmcoreinfo_append_str("NUMBER(VMALLOC_START)=0x%lx\n", VMALLOC_START);
>       |                                                        ~~^
>       |                                                          |
>       |                                                          long unsigned int
>       |                                                        %x
> ../arch/riscv/kernel/crash_core.c:14:64: error: 'VMEMMAP_START' undeclared (first use in this function)
>    14 |         vmcoreinfo_append_str("NUMBER(VMEMMAP_START)=0x%lx\n", VMEMMAP_START);
>       |                                                                ^~~~~~~~~~~~~
> ../arch/riscv/kernel/crash_core.c:15:62: error: 'VMEMMAP_END' undeclared (first use in this function); did you mean 'MEMREMAP_ENC'?
>    15 |         vmcoreinfo_append_str("NUMBER(VMEMMAP_END)=0x%lx\n", VMEMMAP_END);
>       |                                                              ^~~~~~~~~~~
>       |                                                              MEMREMAP_ENC
> 
> 64-bit only: 
> 
> ../arch/riscv/kernel/crash_core.c:17:64: error: 'MODULES_VADDR' undeclared (first use in this function)
>    17 |         vmcoreinfo_append_str("NUMBER(MODULES_VADDR)=0x%lx\n", MODULES_VADDR);
>       |                                                                ^~~~~~~~~~~~~
> ../arch/riscv/kernel/crash_core.c:18:62: error: 'MODULES_END' undeclared (first use in this function)
>    18 |         vmcoreinfo_append_str("NUMBER(MODULES_END)=0x%lx\n", MODULES_END);
>       |                                                              ^~~~~~~~~~~
> 
> 
> 
> -- 
> ~Randy
> 


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

* [PATCH 1/2] riscv, crash: don't export some symbols when CONFIG_MMU=n
  2023-12-04  2:10 Re: linux-next: Tree for Dec 1 (riscv, crash_core) Baoquan He
@ 2023-12-04  2:19 ` Baoquan He
  2023-12-04 19:14   ` Randy Dunlap
  2024-01-20 21:09   ` patchwork-bot+linux-riscv
  2023-12-04  2:23 ` [PATCH 2/2] riscv, kexec: fix dependency of two items Baoquan He
  2023-12-04 19:11 ` linux-next: Tree for Dec 1 (riscv, crash_core) Randy Dunlap
  2 siblings, 2 replies; 9+ messages in thread
From: Baoquan He @ 2023-12-04  2:19 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: Stephen Rothwell, akpm, ignat, linux-next, linux-kernel,
	linux-riscv, kexec, eric_devolder

When dropping select of KEXEC and dependency on ARCH_SUPPORTS_KEXEC
from CRASH_DUMP, compiling error is reported when below config items are
set:
-----------------------
CONFIG_CRASH_CORE=y
CONFIG_KEXEC_CORE=y
CONFIG_CRASH_DUMP=y
......
-----------------------

-------------------------------------------------------------------------------------------------
arch/riscv/kernel/crash_core.c:8:27: error: 'VA_BITS' undeclared (first use in this function)
 8 |         VMCOREINFO_NUMBER(VA_BITS);
   |                           ^~~~~~~
include/linux/crash_core.h:78:64: note: in definition of macro 'VMCOREINFO_NUMBER'
78 |         vmcoreinfo_append_str("NUMBER(%s)=%ld\n", #name, (long)name)
   |                                                                ^~~~

arch/riscv/kernel/crash_core.c:14:64: error: 'VMEMMAP_START' undeclared (first use in this function)
14 |         vmcoreinfo_append_str("NUMBER(VMEMMAP_START)=0x%lx\n", VMEMMAP_START);
   |                                                                ^~~~~~~~~~~~~
arch/riscv/kernel/crash_core.c:15:62: error: 'VMEMMAP_END' undeclared (first use in this function); did you mean 'MEMREMAP_ENC'?
15 |         vmcoreinfo_append_str("NUMBER(VMEMMAP_END)=0x%lx\n", VMEMMAP_END);
   |                                                              ^~~~~~~~~~~
   |                                                              MEMREMAP_ENC
arch/riscv/kernel/crash_core.c:17:64: error: 'MODULES_VADDR' undeclared (first use in this function)
17 |         vmcoreinfo_append_str("NUMBER(MODULES_VADDR)=0x%lx\n", MODULES_VADDR);
   |                                                                ^~~~~~~~~~~~~
arch/riscv/kernel/crash_core.c:18:62: error: 'MODULES_END' undeclared (first use in this function)
18 |         vmcoreinfo_append_str("NUMBER(MODULES_END)=0x%lx\n", MODULES_END);
-------------------------------------------------------------------------------------------------

Currently, riscv's ARCH_SUPPORTS_KEXEC has dependency on MMU. Before
dropping ARCH_SUPPORTS_KEXEC, disabling CONFIG_MMU will unset
CONFIG_CRASH_DUMP, CONFIG_KEXEC_CORE, CONFIG_CRASH_CORE. Hence
crash_core related codes won't be compiled.

---------------------
arch/riscv/Kconfig:
config ARCH_SUPPORTS_KEXEC
        def_bool MMU
---------------------

After dropping ARCH_SUPPORTS_KEXEC, CONFIG_CRASH_DUMP, CONFIG_KEXEC_CORE,
CONFIG_CRASH_CORE can be set independently of CONFIG_MMU. However, there
are several macro definitions, such as VA_BITS, VMEMMAP_START, VMEMMAP_END,
MODULES_VADDR, MODULES_END are only available when CONFIG_MMU=y. Then
compiling errors are triggered.

Here, add CONFIG_MMU ifdeffery in arch_crash_save_vmcoreinfo() to export
those symbols when CONFIG_MMU is enabled.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
 arch/riscv/kernel/crash_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/crash_core.c b/arch/riscv/kernel/crash_core.c
index 55f1d7856b54..8706736fd4e2 100644
--- a/arch/riscv/kernel/crash_core.c
+++ b/arch/riscv/kernel/crash_core.c
@@ -5,17 +5,19 @@
 
 void arch_crash_save_vmcoreinfo(void)
 {
-	VMCOREINFO_NUMBER(VA_BITS);
 	VMCOREINFO_NUMBER(phys_ram_base);
 
 	vmcoreinfo_append_str("NUMBER(PAGE_OFFSET)=0x%lx\n", PAGE_OFFSET);
 	vmcoreinfo_append_str("NUMBER(VMALLOC_START)=0x%lx\n", VMALLOC_START);
 	vmcoreinfo_append_str("NUMBER(VMALLOC_END)=0x%lx\n", VMALLOC_END);
+#ifdef CONFIG_MMU
+	VMCOREINFO_NUMBER(VA_BITS);
 	vmcoreinfo_append_str("NUMBER(VMEMMAP_START)=0x%lx\n", VMEMMAP_START);
 	vmcoreinfo_append_str("NUMBER(VMEMMAP_END)=0x%lx\n", VMEMMAP_END);
 #ifdef CONFIG_64BIT
 	vmcoreinfo_append_str("NUMBER(MODULES_VADDR)=0x%lx\n", MODULES_VADDR);
 	vmcoreinfo_append_str("NUMBER(MODULES_END)=0x%lx\n", MODULES_END);
+#endif
 #endif
 	vmcoreinfo_append_str("NUMBER(KERNEL_LINK_ADDR)=0x%lx\n", KERNEL_LINK_ADDR);
 	vmcoreinfo_append_str("NUMBER(va_kernel_pa_offset)=0x%lx\n",
-- 
2.41.0


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

* [PATCH 2/2] riscv, kexec: fix dependency of two items
  2023-12-04  2:10 Re: linux-next: Tree for Dec 1 (riscv, crash_core) Baoquan He
  2023-12-04  2:19 ` [PATCH 1/2] riscv, crash: don't export some symbols when CONFIG_MMU=n Baoquan He
@ 2023-12-04  2:23 ` Baoquan He
  2023-12-04 19:14   ` Randy Dunlap
  2023-12-04 19:11 ` linux-next: Tree for Dec 1 (riscv, crash_core) Randy Dunlap
  2 siblings, 1 reply; 9+ messages in thread
From: Baoquan He @ 2023-12-04  2:23 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: Stephen Rothwell, akpm, ignat, linux-next, linux-kernel,
	linux-riscv, kexec, eric_devolder

Drop the dependency on MMU from ARCH_SUPPORTS_KEXEC and
ARCH_SUPPORTS_KEXEC_FILE because CONFIG_MMU could be disabled while
people may still want to have KEXEC/KEXEC_FILE functionality.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
 arch/riscv/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 95a2a06acc6a..24c1799e2ec4 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -685,7 +685,7 @@ config RISCV_BOOT_SPINWAIT
 	  If unsure what to do here, say N.
 
 config ARCH_SUPPORTS_KEXEC
-	def_bool MMU
+	def_bool y
 
 config ARCH_SELECTS_KEXEC
 	def_bool y
@@ -693,7 +693,7 @@ config ARCH_SELECTS_KEXEC
 	select HOTPLUG_CPU if SMP
 
 config ARCH_SUPPORTS_KEXEC_FILE
-	def_bool 64BIT && MMU
+	def_bool 64BIT
 
 config ARCH_SELECTS_KEXEC_FILE
 	def_bool y
-- 
2.41.0


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

* Re: linux-next: Tree for Dec 1 (riscv, crash_core)
  2023-12-04  2:10 Re: linux-next: Tree for Dec 1 (riscv, crash_core) Baoquan He
  2023-12-04  2:19 ` [PATCH 1/2] riscv, crash: don't export some symbols when CONFIG_MMU=n Baoquan He
  2023-12-04  2:23 ` [PATCH 2/2] riscv, kexec: fix dependency of two items Baoquan He
@ 2023-12-04 19:11 ` Randy Dunlap
  2 siblings, 0 replies; 9+ messages in thread
From: Randy Dunlap @ 2023-12-04 19:11 UTC (permalink / raw)
  To: Baoquan He
  Cc: Stephen Rothwell, akpm, ignat, linux-next, linux-kernel,
	linux-riscv, kexec, eric_devolder

Hi,

On 12/3/23 18:10, Baoquan He wrote:
> eric_devolder@yahoo.com, ignat@cloudflare.com,
> 	Linux Next Mailing List <linux-next@vger.kernel.org>,
> 	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
> 	linux-riscv <linux-riscv@lists.infradead.org>,
> 	kexec <kexec@lists.infradead.org>
> Bcc: bhe@redhat.com
> Subject: Re: linux-next: Tree for Dec 1 (riscv, crash_core)
> Reply-To: 
> In-Reply-To: <bbd1bbfb-c482-433d-bce9-2b591b8e855e@infradead.org>
> 
> On 12/01/23 at 11:53am, Randy Dunlap wrote:
>>
>>
>> On 11/30/23 18:37, Stephen Rothwell wrote:
>>> Hi all,
>>>
>>> Changes since 20231130:
>>>
>>
>> on riscv 32-bit or 64-bit, with
>> # CONFIG_MMU is not set
> 

[]

> I made two patches to decouple the kexec/crash code with CONFIG_MMU. Not
> sure if risc-v wants that.
> 
> Or we can simply add dependency on MMU for ARCH_SUPPORTS_CRASH_DUMP.
> Then when CONFIG_MMU=n, CONFIG_CRASH_DUMP, CONFIG_KEXEC_CORE,
> CONFIG_CRASH_CORE will be unset too. Please help check which one need be
> taken.
> 
> 
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 24c1799e2ec4..03d290da7262 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -708,6 +708,7 @@ config ARCH_SUPPORTS_KEXEC_PURGATORY
>  
>  config ARCH_SUPPORTS_CRASH_DUMP
>  	def_bool y
> +	depends on MMU=y
>  
>  config ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
>  	def_bool CRASH_CORE
> 

That works if the RISC-V folks prefer it.


Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested

Thanks.

-- 
~Randy

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

* Re: [PATCH 1/2] riscv, crash: don't export some symbols when CONFIG_MMU=n
  2023-12-04  2:19 ` [PATCH 1/2] riscv, crash: don't export some symbols when CONFIG_MMU=n Baoquan He
@ 2023-12-04 19:14   ` Randy Dunlap
  2023-12-05  7:18     ` Baoquan He
  2024-01-20 21:09   ` patchwork-bot+linux-riscv
  1 sibling, 1 reply; 9+ messages in thread
From: Randy Dunlap @ 2023-12-04 19:14 UTC (permalink / raw)
  To: Baoquan He
  Cc: Stephen Rothwell, akpm, ignat, linux-next, linux-kernel,
	linux-riscv, kexec, eric_devolder



On 12/3/23 18:19, Baoquan He wrote:
> When dropping select of KEXEC and dependency on ARCH_SUPPORTS_KEXEC
> from CRASH_DUMP, compiling error is reported when below config items are
> set:
> -----------------------
> CONFIG_CRASH_CORE=y
> CONFIG_KEXEC_CORE=y
> CONFIG_CRASH_DUMP=y
> ......
> -----------------------
> 

[]

> 
> Currently, riscv's ARCH_SUPPORTS_KEXEC has dependency on MMU. Before
> dropping ARCH_SUPPORTS_KEXEC, disabling CONFIG_MMU will unset
> CONFIG_CRASH_DUMP, CONFIG_KEXEC_CORE, CONFIG_CRASH_CORE. Hence
> crash_core related codes won't be compiled.
> 
> ---------------------
> arch/riscv/Kconfig:
> config ARCH_SUPPORTS_KEXEC
>         def_bool MMU
> ---------------------
> 
> After dropping ARCH_SUPPORTS_KEXEC, CONFIG_CRASH_DUMP, CONFIG_KEXEC_CORE,
> CONFIG_CRASH_CORE can be set independently of CONFIG_MMU. However, there
> are several macro definitions, such as VA_BITS, VMEMMAP_START, VMEMMAP_END,
> MODULES_VADDR, MODULES_END are only available when CONFIG_MMU=y. Then
> compiling errors are triggered.
> 
> Here, add CONFIG_MMU ifdeffery in arch_crash_save_vmcoreinfo() to export
> those symbols when CONFIG_MMU is enabled.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
>  arch/riscv/kernel/crash_core.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/riscv/kernel/crash_core.c b/arch/riscv/kernel/crash_core.c
> index 55f1d7856b54..8706736fd4e2 100644
> --- a/arch/riscv/kernel/crash_core.c
> +++ b/arch/riscv/kernel/crash_core.c
> @@ -5,17 +5,19 @@
>  
>  void arch_crash_save_vmcoreinfo(void)
>  {
> -	VMCOREINFO_NUMBER(VA_BITS);
>  	VMCOREINFO_NUMBER(phys_ram_base);
>  
>  	vmcoreinfo_append_str("NUMBER(PAGE_OFFSET)=0x%lx\n", PAGE_OFFSET);
>  	vmcoreinfo_append_str("NUMBER(VMALLOC_START)=0x%lx\n", VMALLOC_START);
>  	vmcoreinfo_append_str("NUMBER(VMALLOC_END)=0x%lx\n", VMALLOC_END);
> +#ifdef CONFIG_MMU
> +	VMCOREINFO_NUMBER(VA_BITS);
>  	vmcoreinfo_append_str("NUMBER(VMEMMAP_START)=0x%lx\n", VMEMMAP_START);
>  	vmcoreinfo_append_str("NUMBER(VMEMMAP_END)=0x%lx\n", VMEMMAP_END);
>  #ifdef CONFIG_64BIT
>  	vmcoreinfo_append_str("NUMBER(MODULES_VADDR)=0x%lx\n", MODULES_VADDR);
>  	vmcoreinfo_append_str("NUMBER(MODULES_END)=0x%lx\n", MODULES_END);
> +#endif
>  #endif
>  	vmcoreinfo_append_str("NUMBER(KERNEL_LINK_ADDR)=0x%lx\n", KERNEL_LINK_ADDR);
>  	vmcoreinfo_append_str("NUMBER(va_kernel_pa_offset)=0x%lx\n",

Both riscv 32-bit and 64-bit complain:

../arch/riscv/kernel/crash_core.c: In function 'arch_crash_save_vmcoreinfo':
../arch/riscv/kernel/crash_core.c:11:58: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'int' [-Wformat=]
   11 |         vmcoreinfo_append_str("NUMBER(VMALLOC_START)=0x%lx\n", VMALLOC_START);
      |                                                        ~~^
      |                                                          |
      |                                                          long unsigned int
      |                                                        %x


Otherwise this builds without failure.

Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested

Thanks.

-- 
~Randy

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

* Re: [PATCH 2/2] riscv, kexec: fix dependency of two items
  2023-12-04  2:23 ` [PATCH 2/2] riscv, kexec: fix dependency of two items Baoquan He
@ 2023-12-04 19:14   ` Randy Dunlap
  0 siblings, 0 replies; 9+ messages in thread
From: Randy Dunlap @ 2023-12-04 19:14 UTC (permalink / raw)
  To: Baoquan He
  Cc: Stephen Rothwell, akpm, ignat, linux-next, linux-kernel,
	linux-riscv, kexec, eric_devolder



On 12/3/23 18:23, Baoquan He wrote:
> Drop the dependency on MMU from ARCH_SUPPORTS_KEXEC and
> ARCH_SUPPORTS_KEXEC_FILE because CONFIG_MMU could be disabled while
> people may still want to have KEXEC/KEXEC_FILE functionality.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>

Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested

Thanks.

> ---
>  arch/riscv/Kconfig | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 95a2a06acc6a..24c1799e2ec4 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -685,7 +685,7 @@ config RISCV_BOOT_SPINWAIT
>  	  If unsure what to do here, say N.
>  
>  config ARCH_SUPPORTS_KEXEC
> -	def_bool MMU
> +	def_bool y
>  
>  config ARCH_SELECTS_KEXEC
>  	def_bool y
> @@ -693,7 +693,7 @@ config ARCH_SELECTS_KEXEC
>  	select HOTPLUG_CPU if SMP
>  
>  config ARCH_SUPPORTS_KEXEC_FILE
> -	def_bool 64BIT && MMU
> +	def_bool 64BIT
>  
>  config ARCH_SELECTS_KEXEC_FILE
>  	def_bool y

-- 
~Randy

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

* Re: [PATCH 1/2] riscv, crash: don't export some symbols when CONFIG_MMU=n
  2023-12-04 19:14   ` Randy Dunlap
@ 2023-12-05  7:18     ` Baoquan He
  2023-12-05 17:08       ` Randy Dunlap
  0 siblings, 1 reply; 9+ messages in thread
From: Baoquan He @ 2023-12-05  7:18 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: Stephen Rothwell, akpm, ignat, linux-next, linux-kernel,
	linux-riscv, kexec, eric_devolder

On 12/04/23 at 11:14am, Randy Dunlap wrote:
......
> > ---
> >  arch/riscv/kernel/crash_core.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/riscv/kernel/crash_core.c b/arch/riscv/kernel/crash_core.c
> > index 55f1d7856b54..8706736fd4e2 100644
> > --- a/arch/riscv/kernel/crash_core.c
> > +++ b/arch/riscv/kernel/crash_core.c
> > @@ -5,17 +5,19 @@
> >  
> >  void arch_crash_save_vmcoreinfo(void)
> >  {
> > -	VMCOREINFO_NUMBER(VA_BITS);
> >  	VMCOREINFO_NUMBER(phys_ram_base);
> >  
> >  	vmcoreinfo_append_str("NUMBER(PAGE_OFFSET)=0x%lx\n", PAGE_OFFSET);
> >  	vmcoreinfo_append_str("NUMBER(VMALLOC_START)=0x%lx\n", VMALLOC_START);
> >  	vmcoreinfo_append_str("NUMBER(VMALLOC_END)=0x%lx\n", VMALLOC_END);
> > +#ifdef CONFIG_MMU
> > +	VMCOREINFO_NUMBER(VA_BITS);
> >  	vmcoreinfo_append_str("NUMBER(VMEMMAP_START)=0x%lx\n", VMEMMAP_START);
> >  	vmcoreinfo_append_str("NUMBER(VMEMMAP_END)=0x%lx\n", VMEMMAP_END);
> >  #ifdef CONFIG_64BIT
> >  	vmcoreinfo_append_str("NUMBER(MODULES_VADDR)=0x%lx\n", MODULES_VADDR);
> >  	vmcoreinfo_append_str("NUMBER(MODULES_END)=0x%lx\n", MODULES_END);
> > +#endif
> >  #endif
> >  	vmcoreinfo_append_str("NUMBER(KERNEL_LINK_ADDR)=0x%lx\n", KERNEL_LINK_ADDR);
> >  	vmcoreinfo_append_str("NUMBER(va_kernel_pa_offset)=0x%lx\n",
> 
> Both riscv 32-bit and 64-bit complain:
> 
> ../arch/riscv/kernel/crash_core.c: In function 'arch_crash_save_vmcoreinfo':
> ../arch/riscv/kernel/crash_core.c:11:58: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'int' [-Wformat=]
>    11 |         vmcoreinfo_append_str("NUMBER(VMALLOC_START)=0x%lx\n", VMALLOC_START);
>       |                                                        ~~^
>       |                                                          |
>       |                                                          long unsigned int
>       |                                                        %x

Thanks for all these testing.

This warning is irrelevant to the kexec patch, it's becasue 
VMALLOC_START is defined as 0 which is int when CONFIG_MMU=n.

Below patch can fix the warning.

From 46984a0287e5f1b41ae3e9adfcfa0d26b71db8f4 Mon Sep 17 00:00:00 2001
From: Baoquan He <bhe@redhat.com>
Date: Tue, 5 Dec 2023 11:02:55 +0800
Subject: [PATCH] riscv: fix VMALLC_START definition
Content-type: text/plain

When below config items are set, compiler complained:

--------------------
CONFIG_CRASH_CORE=y
CONFIG_KEXEC_CORE=y
CONFIG_CRASH_DUMP=y
......
-----------------------

-------------------------------------------------------------------
arch/riscv/kernel/crash_core.c: In function 'arch_crash_save_vmcoreinfo':
arch/riscv/kernel/crash_core.c:11:58: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'int' [-Wformat=]
11 |         vmcoreinfo_append_str("NUMBER(VMALLOC_START)=0x%lx\n", VMALLOC_START);
   |                                                        ~~^
   |                                                          |
   |                                                          long unsigned int
   |                                                        %x
----------------------------------------------------------------------

This is because on riscv macro VMALLOC_START has different type when
CONFIG_MMU is set or unset.

arch/riscv/include/asm/pgtable.h:
--------------------------------------------------

Changing it to _AC(0, UL) in case CONFIG_MMU=n can fix the warning.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
 arch/riscv/include/asm/pgtable.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
index 294044429e8e..ab00235b018f 100644
--- a/arch/riscv/include/asm/pgtable.h
+++ b/arch/riscv/include/asm/pgtable.h
@@ -899,7 +899,7 @@ static inline pte_t pte_swp_clear_exclusive(pte_t pte)
 #define PAGE_KERNEL		__pgprot(0)
 #define swapper_pg_dir		NULL
 #define TASK_SIZE		0xffffffffUL
-#define VMALLOC_START		0
+#define VMALLOC_START		_AC(0, UL)
 #define VMALLOC_END		TASK_SIZE
 
 #endif /* !CONFIG_MMU */
-- 
2.41.0


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

* Re: [PATCH 1/2] riscv, crash: don't export some symbols when CONFIG_MMU=n
  2023-12-05  7:18     ` Baoquan He
@ 2023-12-05 17:08       ` Randy Dunlap
  0 siblings, 0 replies; 9+ messages in thread
From: Randy Dunlap @ 2023-12-05 17:08 UTC (permalink / raw)
  To: Baoquan He
  Cc: Stephen Rothwell, akpm, ignat, linux-next, linux-kernel,
	linux-riscv, kexec, eric_devolder



On 12/4/23 23:18, Baoquan He wrote:
> On 12/04/23 at 11:14am, Randy Dunlap wrote:

[]

>>
>> Both riscv 32-bit and 64-bit complain:
>>
>> ../arch/riscv/kernel/crash_core.c: In function 'arch_crash_save_vmcoreinfo':
>> ../arch/riscv/kernel/crash_core.c:11:58: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'int' [-Wformat=]
>>    11 |         vmcoreinfo_append_str("NUMBER(VMALLOC_START)=0x%lx\n", VMALLOC_START);
>>       |                                                        ~~^
>>       |                                                          |
>>       |                                                          long unsigned int
>>       |                                                        %x
> 
> Thanks for all these testing.
> 
> This warning is irrelevant to the kexec patch, it's becasue 
> VMALLOC_START is defined as 0 which is int when CONFIG_MMU=n.
> 
> Below patch can fix the warning.
> 
> From 46984a0287e5f1b41ae3e9adfcfa0d26b71db8f4 Mon Sep 17 00:00:00 2001
> From: Baoquan He <bhe@redhat.com>
> Date: Tue, 5 Dec 2023 11:02:55 +0800
> Subject: [PATCH] riscv: fix VMALLC_START definition
> Content-type: text/plain
> 
> When below config items are set, compiler complained:
> 
> --------------------
> CONFIG_CRASH_CORE=y
> CONFIG_KEXEC_CORE=y
> CONFIG_CRASH_DUMP=y
> ......
> -----------------------
> 
> -------------------------------------------------------------------
> arch/riscv/kernel/crash_core.c: In function 'arch_crash_save_vmcoreinfo':
> arch/riscv/kernel/crash_core.c:11:58: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'int' [-Wformat=]
> 11 |         vmcoreinfo_append_str("NUMBER(VMALLOC_START)=0x%lx\n", VMALLOC_START);
>    |                                                        ~~^
>    |                                                          |
>    |                                                          long unsigned int
>    |                                                        %x
> ----------------------------------------------------------------------
> 
> This is because on riscv macro VMALLOC_START has different type when
> CONFIG_MMU is set or unset.
> 
> arch/riscv/include/asm/pgtable.h:
> --------------------------------------------------
> 
> Changing it to _AC(0, UL) in case CONFIG_MMU=n can fix the warning.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested


Thanks.

> ---
>  arch/riscv/include/asm/pgtable.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
> index 294044429e8e..ab00235b018f 100644
> --- a/arch/riscv/include/asm/pgtable.h
> +++ b/arch/riscv/include/asm/pgtable.h
> @@ -899,7 +899,7 @@ static inline pte_t pte_swp_clear_exclusive(pte_t pte)
>  #define PAGE_KERNEL		__pgprot(0)
>  #define swapper_pg_dir		NULL
>  #define TASK_SIZE		0xffffffffUL
> -#define VMALLOC_START		0
> +#define VMALLOC_START		_AC(0, UL)
>  #define VMALLOC_END		TASK_SIZE
>  
>  #endif /* !CONFIG_MMU */

-- 
~Randy

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

* Re: [PATCH 1/2] riscv, crash: don't export some symbols when CONFIG_MMU=n
  2023-12-04  2:19 ` [PATCH 1/2] riscv, crash: don't export some symbols when CONFIG_MMU=n Baoquan He
  2023-12-04 19:14   ` Randy Dunlap
@ 2024-01-20 21:09   ` patchwork-bot+linux-riscv
  1 sibling, 0 replies; 9+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-01-20 21:09 UTC (permalink / raw)
  To: Baoquan He
  Cc: linux-riscv, rdunlap, sfr, akpm, ignat, linux-next, linux-kernel,
	kexec, eric_devolder

Hello:

This series was applied to riscv/linux.git (fixes)
by Andrew Morton <akpm@linux-foundation.org>:

On Mon, 4 Dec 2023 10:19:36 +0800 you wrote:
> When dropping select of KEXEC and dependency on ARCH_SUPPORTS_KEXEC
> from CRASH_DUMP, compiling error is reported when below config items are
> set:
> -----------------------
> CONFIG_CRASH_CORE=y
> CONFIG_KEXEC_CORE=y
> CONFIG_CRASH_DUMP=y
> ......
> 
> [...]

Here is the summary with links:
  - [1/2] riscv, crash: don't export some symbols when CONFIG_MMU=n
    https://git.kernel.org/riscv/c/c41bd2514184
  - [2/2] riscv, kexec: fix dependency of two items
    (no matching commit)

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-01-20 21:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-04  2:10 Re: linux-next: Tree for Dec 1 (riscv, crash_core) Baoquan He
2023-12-04  2:19 ` [PATCH 1/2] riscv, crash: don't export some symbols when CONFIG_MMU=n Baoquan He
2023-12-04 19:14   ` Randy Dunlap
2023-12-05  7:18     ` Baoquan He
2023-12-05 17:08       ` Randy Dunlap
2024-01-20 21:09   ` patchwork-bot+linux-riscv
2023-12-04  2:23 ` [PATCH 2/2] riscv, kexec: fix dependency of two items Baoquan He
2023-12-04 19:14   ` Randy Dunlap
2023-12-04 19:11 ` linux-next: Tree for Dec 1 (riscv, crash_core) Randy Dunlap

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