diff mbox series

[3/4] mm: Make GENERIC_PTDUMP dependent on MMU

Message ID 20250213040934.3245750-4-anshuman.khandual@arm.com (mailing list archive)
State Superseded
Headers show
Series mm: Rework generic PTDUMP configs | expand

Commit Message

Anshuman Khandual Feb. 13, 2025, 4:09 a.m. UTC
There is no page table dump without a MMU. Make this dependency at generic
level and drop the same from riscv platform instead.

Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-riscv@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 arch/riscv/Kconfig | 2 +-
 mm/Kconfig.debug   | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Christophe Leroy Feb. 13, 2025, 7:30 a.m. UTC | #1
Le 13/02/2025 à 05:09, Anshuman Khandual a écrit :
> There is no page table dump without a MMU. Make this dependency at generic
> level and drop the same from riscv platform instead.
> 
> Cc: Paul Walmsley <paul.walmsley@sifive.com>
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-riscv@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-mm@kvack.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
>   arch/riscv/Kconfig | 2 +-
>   mm/Kconfig.debug   | 1 +
>   2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 7612c52e9b1e..c4cdba6460b8 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -112,7 +112,7 @@ config RISCV
>   	select GENERIC_IRQ_SHOW_LEVEL
>   	select GENERIC_LIB_DEVMEM_IS_ALLOWED
>   	select GENERIC_PCI_IOMAP
> -	select GENERIC_PTDUMP if MMU
> +	select GENERIC_PTDUMP

Are you sure this works as expected ?

See https://docs.kernel.org/kbuild/kconfig-language.html :

Note:
     select should be used with care. select will force a symbol to a 
value without visiting the dependencies. By abusing select you are able 
to select a symbol FOO even if FOO depends on BAR that is not set. In 
general use select only for non-visible symbols (no prompts anywhere) 
and for symbols with no dependencies.

>   	select GENERIC_SCHED_CLOCK
>   	select GENERIC_SMP_IDLE_THREAD
>   	select GENERIC_TIME_VSYSCALL if MMU && 64BIT
> diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug
> index a51a1149909a..c08406760d29 100644
> --- a/mm/Kconfig.debug
> +++ b/mm/Kconfig.debug
> @@ -214,6 +214,7 @@ config DEBUG_WX
>   	  If in doubt, say "Y".
>   
>   config GENERIC_PTDUMP
> +	depends on MMU
>   	bool
>   
>   config PTDUMP_CORE
Steven Price Feb. 13, 2025, 11:23 a.m. UTC | #2
On 13/02/2025 04:09, Anshuman Khandual wrote:
> There is no page table dump without a MMU. Make this dependency at generic
> level and drop the same from riscv platform instead.
> 
> Cc: Paul Walmsley <paul.walmsley@sifive.com>
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-riscv@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-mm@kvack.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>

As Christophe has pointed out - this is broken. The select will override
the dependency you've added in GENERIC_PTDUMP. Generally have "depends
on" for symbols that are "select"ed is broken. I'd suggest just dropping
this patch.

Steve

> ---
>  arch/riscv/Kconfig | 2 +-
>  mm/Kconfig.debug   | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 7612c52e9b1e..c4cdba6460b8 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -112,7 +112,7 @@ config RISCV
>  	select GENERIC_IRQ_SHOW_LEVEL
>  	select GENERIC_LIB_DEVMEM_IS_ALLOWED
>  	select GENERIC_PCI_IOMAP
> -	select GENERIC_PTDUMP if MMU
> +	select GENERIC_PTDUMP
>  	select GENERIC_SCHED_CLOCK
>  	select GENERIC_SMP_IDLE_THREAD
>  	select GENERIC_TIME_VSYSCALL if MMU && 64BIT
> diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug
> index a51a1149909a..c08406760d29 100644
> --- a/mm/Kconfig.debug
> +++ b/mm/Kconfig.debug
> @@ -214,6 +214,7 @@ config DEBUG_WX
>  	  If in doubt, say "Y".
>  
>  config GENERIC_PTDUMP
> +	depends on MMU
>  	bool
>  
>  config PTDUMP_CORE
Anshuman Khandual Feb. 14, 2025, 6:49 a.m. UTC | #3
On 2/13/25 16:53, Steven Price wrote:
> On 13/02/2025 04:09, Anshuman Khandual wrote:
>> There is no page table dump without a MMU. Make this dependency at generic
>> level and drop the same from riscv platform instead.
>>
>> Cc: Paul Walmsley <paul.walmsley@sifive.com>
>> Cc: Palmer Dabbelt <palmer@dabbelt.com>
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> Cc: linux-riscv@lists.infradead.org
>> Cc: linux-kernel@vger.kernel.org
>> Cc: linux-mm@kvack.org
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> 
> As Christophe has pointed out - this is broken. The select will override
> the dependency you've added in GENERIC_PTDUMP. Generally have "depends
> on" for symbols that are "select"ed is broken. I'd suggest just dropping
> this patch.

Agreed, will drop this patch. Thanks Steven and Christophe for the
explanation here regarding correct usage regarding the "select"'s
construct.

> 
> Steve
> 
>> ---
>>  arch/riscv/Kconfig | 2 +-
>>  mm/Kconfig.debug   | 1 +
>>  2 files changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
>> index 7612c52e9b1e..c4cdba6460b8 100644
>> --- a/arch/riscv/Kconfig
>> +++ b/arch/riscv/Kconfig
>> @@ -112,7 +112,7 @@ config RISCV
>>  	select GENERIC_IRQ_SHOW_LEVEL
>>  	select GENERIC_LIB_DEVMEM_IS_ALLOWED
>>  	select GENERIC_PCI_IOMAP
>> -	select GENERIC_PTDUMP if MMU
>> +	select GENERIC_PTDUMP
>>  	select GENERIC_SCHED_CLOCK
>>  	select GENERIC_SMP_IDLE_THREAD
>>  	select GENERIC_TIME_VSYSCALL if MMU && 64BIT
>> diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug
>> index a51a1149909a..c08406760d29 100644
>> --- a/mm/Kconfig.debug
>> +++ b/mm/Kconfig.debug
>> @@ -214,6 +214,7 @@ config DEBUG_WX
>>  	  If in doubt, say "Y".
>>  
>>  config GENERIC_PTDUMP
>> +	depends on MMU
>>  	bool
>>  
>>  config PTDUMP_CORE
>
diff mbox series

Patch

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 7612c52e9b1e..c4cdba6460b8 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -112,7 +112,7 @@  config RISCV
 	select GENERIC_IRQ_SHOW_LEVEL
 	select GENERIC_LIB_DEVMEM_IS_ALLOWED
 	select GENERIC_PCI_IOMAP
-	select GENERIC_PTDUMP if MMU
+	select GENERIC_PTDUMP
 	select GENERIC_SCHED_CLOCK
 	select GENERIC_SMP_IDLE_THREAD
 	select GENERIC_TIME_VSYSCALL if MMU && 64BIT
diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug
index a51a1149909a..c08406760d29 100644
--- a/mm/Kconfig.debug
+++ b/mm/Kconfig.debug
@@ -214,6 +214,7 @@  config DEBUG_WX
 	  If in doubt, say "Y".
 
 config GENERIC_PTDUMP
+	depends on MMU
 	bool
 
 config PTDUMP_CORE