linux-s390.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] s390: Disable ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
@ 2025-10-30 14:55 Heiko Carstens
  2025-10-30 15:10 ` David Hildenbrand
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Heiko Carstens @ 2025-10-30 14:55 UTC (permalink / raw)
  To: Luiz Capitulino, Gerald Schaefer, Alexander Gordeev,
	Vasily Gorbik, Christian Borntraeger
  Cc: Joao Martins, David Hildenbrand, osalvador, aneesh.kumar, akpm,
	linux-kernel, linux-mm, linux-s390

As reported by Luiz Capitulino enabling HVO on s390 leads to reproducible
crashes. The problem is that kernel page tables are modified without
flushing corresponding TLB entries.

Even if it looks like the empty flush_tlb_all() implementation on s390 is
the problem, it is actually a different problem: on s390 it is not allowed
to replace an active/valid page table entry with another valid page table
entry without the detour over an invalid entry. A direct replacement may
lead to random crashes and/or data corruption.

In order to invalidate an entry special instructions have to be used
(e.g. ipte or idte). Alternatively there are also special instructions
available which allow to replace a valid entry with a different valid
entry (e.g. crdte or cspg).

Given that the HVO code currently does not provide the hooks to allow for
an implementation which is compliant with the s390 architecture
requirements, disable ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP again, which is
basically a revert of the original patch which enabled it.

Reported-by: Luiz Capitulino <luizcap@redhat.com>
Closes: https://lore.kernel.org/all/20251028153930.37107-1-luizcap@redhat.com/
Fixes: 00a34d5a99c0 ("s390: select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP")
Cc: stable@vger.kernel.org
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
---
 arch/s390/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index c4145672ca34..df22b10d9141 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -158,7 +158,6 @@ config S390
 	select ARCH_WANT_IRQS_OFF_ACTIVATE_MM
 	select ARCH_WANT_KERNEL_PMD_MKWRITE
 	select ARCH_WANT_LD_ORPHAN_WARN
-	select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
 	select ARCH_WANTS_THP_SWAP
 	select BUILDTIME_TABLE_SORT
 	select CLONE_BACKWARDS2
-- 
2.48.1


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

* Re: [PATCH] s390: Disable ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
  2025-10-30 14:55 [PATCH] s390: Disable ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP Heiko Carstens
@ 2025-10-30 15:10 ` David Hildenbrand
  2025-10-30 15:34 ` Gerald Schaefer
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: David Hildenbrand @ 2025-10-30 15:10 UTC (permalink / raw)
  To: Heiko Carstens, Luiz Capitulino, Gerald Schaefer,
	Alexander Gordeev, Vasily Gorbik, Christian Borntraeger
  Cc: Joao Martins, osalvador, aneesh.kumar, akpm, linux-kernel,
	linux-mm, linux-s390

On 30.10.25 15:55, Heiko Carstens wrote:
> As reported by Luiz Capitulino enabling HVO on s390 leads to reproducible
> crashes. The problem is that kernel page tables are modified without
> flushing corresponding TLB entries.
> 
> Even if it looks like the empty flush_tlb_all() implementation on s390 is
> the problem, it is actually a different problem: on s390 it is not allowed
> to replace an active/valid page table entry with another valid page table
> entry without the detour over an invalid entry. A direct replacement may
> lead to random crashes and/or data corruption.
> 
> In order to invalidate an entry special instructions have to be used
> (e.g. ipte or idte). Alternatively there are also special instructions
> available which allow to replace a valid entry with a different valid
> entry (e.g. crdte or cspg).
> 
> Given that the HVO code currently does not provide the hooks to allow for
> an implementation which is compliant with the s390 architecture
> requirements, disable ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP again, which is
> basically a revert of the original patch which enabled it.
> 
> Reported-by: Luiz Capitulino <luizcap@redhat.com>
> Closes: https://lore.kernel.org/all/20251028153930.37107-1-luizcap@redhat.com/
> Fixes: 00a34d5a99c0 ("s390: select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP")
> Cc: stable@vger.kernel.org
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
> ---

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Cheers

David / dhildenb


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

* Re: [PATCH] s390: Disable ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
  2025-10-30 14:55 [PATCH] s390: Disable ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP Heiko Carstens
  2025-10-30 15:10 ` David Hildenbrand
@ 2025-10-30 15:34 ` Gerald Schaefer
  2025-10-30 15:45 ` Luiz Capitulino
  2025-11-03  4:59 ` Ritesh Harjani
  3 siblings, 0 replies; 5+ messages in thread
From: Gerald Schaefer @ 2025-10-30 15:34 UTC (permalink / raw)
  To: Heiko Carstens
  Cc: Luiz Capitulino, Alexander Gordeev, Vasily Gorbik,
	Christian Borntraeger, Joao Martins, David Hildenbrand, osalvador,
	aneesh.kumar, akpm, linux-kernel, linux-mm, linux-s390

On Thu, 30 Oct 2025 15:55:05 +0100
Heiko Carstens <hca@linux.ibm.com> wrote:

> As reported by Luiz Capitulino enabling HVO on s390 leads to reproducible
> crashes. The problem is that kernel page tables are modified without
> flushing corresponding TLB entries.
> 
> Even if it looks like the empty flush_tlb_all() implementation on s390 is
> the problem, it is actually a different problem: on s390 it is not allowed
> to replace an active/valid page table entry with another valid page table
> entry without the detour over an invalid entry. A direct replacement may
> lead to random crashes and/or data corruption.
> 
> In order to invalidate an entry special instructions have to be used
> (e.g. ipte or idte). Alternatively there are also special instructions
> available which allow to replace a valid entry with a different valid
> entry (e.g. crdte or cspg).
> 
> Given that the HVO code currently does not provide the hooks to allow for
> an implementation which is compliant with the s390 architecture
> requirements, disable ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP again, which is
> basically a revert of the original patch which enabled it.
> 
> Reported-by: Luiz Capitulino <luizcap@redhat.com>
> Closes: https://lore.kernel.org/all/20251028153930.37107-1-luizcap@redhat.com/
> Fixes: 00a34d5a99c0 ("s390: select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP")
> Cc: stable@vger.kernel.org
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
> ---
>  arch/s390/Kconfig | 1 -
>  1 file changed, 1 deletion(-)

Thanks!

Reviewed-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com>

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

* Re: [PATCH] s390: Disable ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
  2025-10-30 14:55 [PATCH] s390: Disable ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP Heiko Carstens
  2025-10-30 15:10 ` David Hildenbrand
  2025-10-30 15:34 ` Gerald Schaefer
@ 2025-10-30 15:45 ` Luiz Capitulino
  2025-11-03  4:59 ` Ritesh Harjani
  3 siblings, 0 replies; 5+ messages in thread
From: Luiz Capitulino @ 2025-10-30 15:45 UTC (permalink / raw)
  To: Heiko Carstens, Gerald Schaefer, Alexander Gordeev, Vasily Gorbik,
	Christian Borntraeger
  Cc: Joao Martins, David Hildenbrand, osalvador, aneesh.kumar, akpm,
	linux-kernel, linux-mm, linux-s390

On 2025-10-30 10:55, Heiko Carstens wrote:
> As reported by Luiz Capitulino enabling HVO on s390 leads to reproducible
> crashes. The problem is that kernel page tables are modified without
> flushing corresponding TLB entries.
> 
> Even if it looks like the empty flush_tlb_all() implementation on s390 is
> the problem, it is actually a different problem: on s390 it is not allowed
> to replace an active/valid page table entry with another valid page table
> entry without the detour over an invalid entry. A direct replacement may
> lead to random crashes and/or data corruption.
> 
> In order to invalidate an entry special instructions have to be used
> (e.g. ipte or idte). Alternatively there are also special instructions
> available which allow to replace a valid entry with a different valid
> entry (e.g. crdte or cspg).
> 
> Given that the HVO code currently does not provide the hooks to allow for
> an implementation which is compliant with the s390 architecture
> requirements, disable ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP again, which is
> basically a revert of the original patch which enabled it.
> 
> Reported-by: Luiz Capitulino <luizcap@redhat.com>
> Closes: https://lore.kernel.org/all/20251028153930.37107-1-luizcap@redhat.com/
> Fixes: 00a34d5a99c0 ("s390: select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP")
> Cc: stable@vger.kernel.org
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>

Obvious enough change, but FWIW:

Tested-by: Luiz Capitulino <luizcap@redhat.com>

> ---
>   arch/s390/Kconfig | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
> index c4145672ca34..df22b10d9141 100644
> --- a/arch/s390/Kconfig
> +++ b/arch/s390/Kconfig
> @@ -158,7 +158,6 @@ config S390
>   	select ARCH_WANT_IRQS_OFF_ACTIVATE_MM
>   	select ARCH_WANT_KERNEL_PMD_MKWRITE
>   	select ARCH_WANT_LD_ORPHAN_WARN
> -	select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
>   	select ARCH_WANTS_THP_SWAP
>   	select BUILDTIME_TABLE_SORT
>   	select CLONE_BACKWARDS2


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

* Re: [PATCH] s390: Disable ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
  2025-10-30 14:55 [PATCH] s390: Disable ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP Heiko Carstens
                   ` (2 preceding siblings ...)
  2025-10-30 15:45 ` Luiz Capitulino
@ 2025-11-03  4:59 ` Ritesh Harjani
  3 siblings, 0 replies; 5+ messages in thread
From: Ritesh Harjani @ 2025-11-03  4:59 UTC (permalink / raw)
  To: Heiko Carstens, Luiz Capitulino, Gerald Schaefer,
	Alexander Gordeev, Vasily Gorbik, Christian Borntraeger
  Cc: Joao Martins, David Hildenbrand, osalvador, aneesh.kumar, akpm,
	linux-kernel, linux-mm, linux-s390

Heiko Carstens <hca@linux.ibm.com> writes:

> As reported by Luiz Capitulino enabling HVO on s390 leads to reproducible
> crashes. The problem is that kernel page tables are modified without
> flushing corresponding TLB entries.
>
> Even if it looks like the empty flush_tlb_all() implementation on s390 is
> the problem, it is actually a different problem: on s390 it is not allowed
> to replace an active/valid page table entry with another valid page table
> entry without the detour over an invalid entry. A direct replacement may
> lead to random crashes and/or data corruption.
>
> In order to invalidate an entry special instructions have to be used
> (e.g. ipte or idte). Alternatively there are also special instructions
> available which allow to replace a valid entry with a different valid
> entry (e.g. crdte or cspg).
>
> Given that the HVO code currently does not provide the hooks to allow for
> an implementation which is compliant with the s390 architecture
> requirements, disable ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP again, which is
> basically a revert of the original patch which enabled it.
>
> Reported-by: Luiz Capitulino <luizcap@redhat.com>
> Closes: https://lore.kernel.org/all/20251028153930.37107-1-luizcap@redhat.com/
> Fixes: 00a34d5a99c0 ("s390: select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP")
> Cc: stable@vger.kernel.org
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
> ---
>  arch/s390/Kconfig | 1 -
>  1 file changed, 1 deletion(-)

Yup architectures like aarch64 and PPC64 keep it disable for the same
reason. However patch [1] allows for enabling similar optimization for
DAX vmemmap "ARCH_WANT_OPTIMIZE_DAX_VMEMMAP", if DAX is supported.

I see in 6.18-1 pull request s390 had "Add DAX support for DCSS memory
block devices".

[1]: https://lore.kernel.org/all/20230724190759.483013-8-aneesh.kumar@linux.ibm.com/T/#u

-ritesh

>
> diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
> index c4145672ca34..df22b10d9141 100644
> --- a/arch/s390/Kconfig
> +++ b/arch/s390/Kconfig
> @@ -158,7 +158,6 @@ config S390
>  	select ARCH_WANT_IRQS_OFF_ACTIVATE_MM
>  	select ARCH_WANT_KERNEL_PMD_MKWRITE
>  	select ARCH_WANT_LD_ORPHAN_WARN
> -	select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
>  	select ARCH_WANTS_THP_SWAP
>  	select BUILDTIME_TABLE_SORT
>  	select CLONE_BACKWARDS2
> -- 
> 2.48.1

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

end of thread, other threads:[~2025-11-03  5:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-30 14:55 [PATCH] s390: Disable ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP Heiko Carstens
2025-10-30 15:10 ` David Hildenbrand
2025-10-30 15:34 ` Gerald Schaefer
2025-10-30 15:45 ` Luiz Capitulino
2025-11-03  4:59 ` Ritesh Harjani

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