linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] riscv: TRANSPARENT_HUGEPAGE: depends on MMU
@ 2021-05-25  0:13 Randy Dunlap
  2021-05-25 10:33 ` Mike Rapoport
  0 siblings, 1 reply; 4+ messages in thread
From: Randy Dunlap @ 2021-05-25  0:13 UTC (permalink / raw)
  To: linux-mm
  Cc: Randy Dunlap, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-riscv, Andrew Morton, Nanyong Sun

Fix a Kconfig warning and many build errors:

WARNING: unmet direct dependencies detected for COMPACTION
  Depends on [n]: MMU [=n]
  Selected by [y]:
  - TRANSPARENT_HUGEPAGE [=y] && HAVE_ARCH_TRANSPARENT_HUGEPAGE [=y]

and the subseqent thousands of build errors and warnings.

Fixes: e88b333142e4 ("riscv: mm: add THP support on 64-bit")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: linux-riscv@lists.infradead.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Nanyong Sun <sunnanyong@huawei.com>
---
I really think that mm/Kconfig should have "depends on MMU" for
TRANSPARENT_HUGEPAGE, but commit 15626062f4a9 from 2012
("thp, x86: introduce HAVE_ARCH_TRANSPARENT_HUGEPAGE") thought
differently. I.e., mm/Kconfig should be protecting all arches
against this Kconfig problem.

 arch/riscv/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20210524.orig/arch/riscv/Kconfig
+++ linux-next-20210524/arch/riscv/Kconfig
@@ -106,7 +106,7 @@ config RISCV
 	select SYSCTL_EXCEPTION_TRACE
 	select THREAD_INFO_IN_TASK
 	select UACCESS_MEMCPY if !MMU
-	select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT
+	select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU
 
 config ARCH_MMAP_RND_BITS_MIN
 	default 18 if 64BIT


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

* Re: [PATCH -next] riscv: TRANSPARENT_HUGEPAGE: depends on MMU
  2021-05-25  0:13 [PATCH -next] riscv: TRANSPARENT_HUGEPAGE: depends on MMU Randy Dunlap
@ 2021-05-25 10:33 ` Mike Rapoport
  2021-05-25 15:40   ` Randy Dunlap
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Rapoport @ 2021-05-25 10:33 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: linux-mm, Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-riscv,
	Andrew Morton, Nanyong Sun

On Mon, May 24, 2021 at 05:13:02PM -0700, Randy Dunlap wrote:
> Fix a Kconfig warning and many build errors:
> 
> WARNING: unmet direct dependencies detected for COMPACTION
>   Depends on [n]: MMU [=n]
>   Selected by [y]:
>   - TRANSPARENT_HUGEPAGE [=y] && HAVE_ARCH_TRANSPARENT_HUGEPAGE [=y]
> 
> and the subseqent thousands of build errors and warnings.
> 
> Fixes: e88b333142e4 ("riscv: mm: add THP support on 64-bit")
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: Paul Walmsley <paul.walmsley@sifive.com>
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Albert Ou <aou@eecs.berkeley.edu>
> Cc: linux-riscv@lists.infradead.org
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Nanyong Sun <sunnanyong@huawei.com>

Acked-by: Mike Rapoport <rppt@linux.ibm.com>

> ---
> I really think that mm/Kconfig should have "depends on MMU" for
> TRANSPARENT_HUGEPAGE, but commit 15626062f4a9 from 2012
> ("thp, x86: introduce HAVE_ARCH_TRANSPARENT_HUGEPAGE") thought
> differently. I.e., mm/Kconfig should be protecting all arches
> against this Kconfig problem.

We could 

diff --git a/mm/Kconfig b/mm/Kconfig
index 02d44e3420f5..85bc8bf32e7b 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -403,7 +403,7 @@ config NOMMU_INITIAL_TRIM_EXCESS
 
 config TRANSPARENT_HUGEPAGE
 	bool "Transparent Hugepage Support"
-	depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE
+	depends on MMU && HAVE_ARCH_TRANSPARENT_HUGEPAGE
 	select COMPACTION
 	select XARRAY_MULTI
 	help

but in a sense HAVE_ARCH_TRANSPARENT_HUGEPAGE should imply that MMU is
selected :)

>  arch/riscv/Kconfig |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- linux-next-20210524.orig/arch/riscv/Kconfig
> +++ linux-next-20210524/arch/riscv/Kconfig
> @@ -106,7 +106,7 @@ config RISCV
>  	select SYSCTL_EXCEPTION_TRACE
>  	select THREAD_INFO_IN_TASK
>  	select UACCESS_MEMCPY if !MMU
> -	select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT
> +	select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU
>  
>  config ARCH_MMAP_RND_BITS_MIN
>  	default 18 if 64BIT
> 

-- 
Sincerely yours,
Mike.


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

* Re: [PATCH -next] riscv: TRANSPARENT_HUGEPAGE: depends on MMU
  2021-05-25 10:33 ` Mike Rapoport
@ 2021-05-25 15:40   ` Randy Dunlap
  2021-05-29 23:08     ` Palmer Dabbelt
  0 siblings, 1 reply; 4+ messages in thread
From: Randy Dunlap @ 2021-05-25 15:40 UTC (permalink / raw)
  To: Mike Rapoport
  Cc: linux-mm, Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-riscv,
	Andrew Morton, Nanyong Sun

On 5/25/21 3:33 AM, Mike Rapoport wrote:
> On Mon, May 24, 2021 at 05:13:02PM -0700, Randy Dunlap wrote:
>> Fix a Kconfig warning and many build errors:
>>
>> WARNING: unmet direct dependencies detected for COMPACTION
>>   Depends on [n]: MMU [=n]
>>   Selected by [y]:
>>   - TRANSPARENT_HUGEPAGE [=y] && HAVE_ARCH_TRANSPARENT_HUGEPAGE [=y]
>>
>> and the subseqent thousands of build errors and warnings.
>>
>> Fixes: e88b333142e4 ("riscv: mm: add THP support on 64-bit")
>> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
>> Cc: Paul Walmsley <paul.walmsley@sifive.com>
>> Cc: Palmer Dabbelt <palmer@dabbelt.com>
>> Cc: Albert Ou <aou@eecs.berkeley.edu>
>> Cc: linux-riscv@lists.infradead.org
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> Cc: Nanyong Sun <sunnanyong@huawei.com>
> 
> Acked-by: Mike Rapoport <rppt@linux.ibm.com>
> 
>> ---
>> I really think that mm/Kconfig should have "depends on MMU" for
>> TRANSPARENT_HUGEPAGE, but commit 15626062f4a9 from 2012
>> ("thp, x86: introduce HAVE_ARCH_TRANSPARENT_HUGEPAGE") thought
>> differently. I.e., mm/Kconfig should be protecting all arches
>> against this Kconfig problem.
> 
> We could 
> 
> diff --git a/mm/Kconfig b/mm/Kconfig
> index 02d44e3420f5..85bc8bf32e7b 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -403,7 +403,7 @@ config NOMMU_INITIAL_TRIM_EXCESS
>  
>  config TRANSPARENT_HUGEPAGE
>  	bool "Transparent Hugepage Support"
> -	depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE
> +	depends on MMU && HAVE_ARCH_TRANSPARENT_HUGEPAGE
>  	select COMPACTION
>  	select XARRAY_MULTI
>  	help
> 
> but in a sense HAVE_ARCH_TRANSPARENT_HUGEPAGE should imply that MMU is
> selected :)

Yes, I had this patch before the one that I sent but decided against it
based on history.

>>  arch/riscv/Kconfig |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> --- linux-next-20210524.orig/arch/riscv/Kconfig
>> +++ linux-next-20210524/arch/riscv/Kconfig
>> @@ -106,7 +106,7 @@ config RISCV
>>  	select SYSCTL_EXCEPTION_TRACE
>>  	select THREAD_INFO_IN_TASK
>>  	select UACCESS_MEMCPY if !MMU
>> -	select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT
>> +	select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU
>>  
>>  config ARCH_MMAP_RND_BITS_MIN
>>  	default 18 if 64BIT
>>
> 

thanks.
-- 
~Randy



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

* Re: [PATCH -next] riscv: TRANSPARENT_HUGEPAGE: depends on MMU
  2021-05-25 15:40   ` Randy Dunlap
@ 2021-05-29 23:08     ` Palmer Dabbelt
  0 siblings, 0 replies; 4+ messages in thread
From: Palmer Dabbelt @ 2021-05-29 23:08 UTC (permalink / raw)
  To: rdunlap, rppt; +Cc: linux-mm, Paul Walmsley, aou, linux-riscv, akpm, sunnanyong

On Tue, 25 May 2021 08:40:10 PDT (-0700), rdunlap@infradead.org wrote:
> On 5/25/21 3:33 AM, Mike Rapoport wrote:
>> On Mon, May 24, 2021 at 05:13:02PM -0700, Randy Dunlap wrote:
>>> Fix a Kconfig warning and many build errors:
>>>
>>> WARNING: unmet direct dependencies detected for COMPACTION
>>>   Depends on [n]: MMU [=n]
>>>   Selected by [y]:
>>>   - TRANSPARENT_HUGEPAGE [=y] && HAVE_ARCH_TRANSPARENT_HUGEPAGE [=y]
>>>
>>> and the subseqent thousands of build errors and warnings.
>>>
>>> Fixes: e88b333142e4 ("riscv: mm: add THP support on 64-bit")
>>> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
>>> Cc: Paul Walmsley <paul.walmsley@sifive.com>
>>> Cc: Palmer Dabbelt <palmer@dabbelt.com>
>>> Cc: Albert Ou <aou@eecs.berkeley.edu>
>>> Cc: linux-riscv@lists.infradead.org
>>> Cc: Andrew Morton <akpm@linux-foundation.org>
>>> Cc: Nanyong Sun <sunnanyong@huawei.com>
>>
>> Acked-by: Mike Rapoport <rppt@linux.ibm.com>
>>
>>> ---
>>> I really think that mm/Kconfig should have "depends on MMU" for
>>> TRANSPARENT_HUGEPAGE, but commit 15626062f4a9 from 2012
>>> ("thp, x86: introduce HAVE_ARCH_TRANSPARENT_HUGEPAGE") thought
>>> differently. I.e., mm/Kconfig should be protecting all arches
>>> against this Kconfig problem.
>>
>> We could
>>
>> diff --git a/mm/Kconfig b/mm/Kconfig
>> index 02d44e3420f5..85bc8bf32e7b 100644
>> --- a/mm/Kconfig
>> +++ b/mm/Kconfig
>> @@ -403,7 +403,7 @@ config NOMMU_INITIAL_TRIM_EXCESS
>>
>>  config TRANSPARENT_HUGEPAGE
>>  	bool "Transparent Hugepage Support"
>> -	depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE
>> +	depends on MMU && HAVE_ARCH_TRANSPARENT_HUGEPAGE
>>  	select COMPACTION
>>  	select XARRAY_MULTI
>>  	help
>>
>> but in a sense HAVE_ARCH_TRANSPARENT_HUGEPAGE should imply that MMU is
>> selected :)
>
> Yes, I had this patch before the one that I sent but decided against it
> based on history.

IMO 15626062f4a9 ("thp, x86: introduce HAVE_ARCH_TRANSPARENT_HUGEPAGE") 
is really saying "the arches that have transparent huge pages are MMU=y, 
so we don't need the extra check".  That seems reasonable as of when the 
code landed, and while arm has MMU=n and THP it already depends on MMU 
(via ARM_LPAE, which seems kind of natural there).

The generic version seems fine to me, but I'm going to take this one now 
so we can avoid the build issues.

>>>  arch/riscv/Kconfig |    2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> --- linux-next-20210524.orig/arch/riscv/Kconfig
>>> +++ linux-next-20210524/arch/riscv/Kconfig
>>> @@ -106,7 +106,7 @@ config RISCV
>>>  	select SYSCTL_EXCEPTION_TRACE
>>>  	select THREAD_INFO_IN_TASK
>>>  	select UACCESS_MEMCPY if !MMU
>>> -	select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT
>>> +	select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU
>>>
>>>  config ARCH_MMAP_RND_BITS_MIN
>>>  	default 18 if 64BIT
>>>
>>
>
> thanks.


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

end of thread, other threads:[~2021-05-29 23:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25  0:13 [PATCH -next] riscv: TRANSPARENT_HUGEPAGE: depends on MMU Randy Dunlap
2021-05-25 10:33 ` Mike Rapoport
2021-05-25 15:40   ` Randy Dunlap
2021-05-29 23:08     ` Palmer Dabbelt

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