From: David Hildenbrand <david@redhat.com>
To: Heiko Carstens <hca@linux.ibm.com>
Cc: Luiz Capitulino <luizcap@redhat.com>,
borntraeger@linux.ibm.com, joao.m.martins@oracle.com,
mike.kravetz@oracle.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, linux-s390@vger.kernel.org,
gor@linux.ibm.com, gerald.schaefer@linux.ibm.com,
agordeev@linux.ibm.com, osalvador@suse.de,
akpm@linux-foundation.org, aneesh.kumar@kernel.org
Subject: Re: [PATCH v2] s390: fix HugeTLB vmemmap optimization crash
Date: Wed, 29 Oct 2025 13:15:44 +0100 [thread overview]
Message-ID: <9a8254b9-92f8-4530-88e8-fca3b7465908@redhat.com> (raw)
In-Reply-To: <20251029104457.8393B96-hca@linux.ibm.com>
On 29.10.25 11:44, Heiko Carstens wrote:
> On Wed, Oct 29, 2025 at 10:57:15AM +0100, David Hildenbrand wrote:
>> On 28.10.25 22:15, Luiz Capitulino wrote:
>>> A reproducible crash occurs when enabling HugeTLB vmemmap optimization (HVO)
>>> on s390. The crash and the proposed fix were worked on an s390 KVM guest
>>> running on an older hypervisor, as I don't have access to an LPAR. However,
>>> the same issue should occur on bare-metal.
> ...
>>> This commit fixes this by implementing flush_tlb_all() on s390 as an
>>> alias to __tlb_flush_global(). This should cause a flush on all TLB
>>> entries on all CPUs as expected by the flush_tlb_all() semantics.
>>>
>>> Fixes: f13b83fdd996 ("hugetlb: batch TLB flushes when freeing vmemmap")
>>> Signed-off-by: Luiz Capitulino <luizcap@redhat.com>
>>> ---
>>
>> Nice finding!
>>
>> Makes me wonder whether the default flush_tlb_all() should actually map to a
>> BUILD_BUG(), such that we don't silently not-flush on archs that don't
>> implement it.
>
> Which default flush_tlb_all()? :)
What I meant is: all such functions that an architecture doesn't expect
to be called because they are effectively unimplemented.
Taking a look at flush_tlb_all(), there is really only a dummy
implementation on s390x and on riscv without MMU.
So yeah, there is no "default" fallback one :)
BTW, I'm staring at s390x's flush_tlb() function and wonder why that one
is defined. I'm sure there is a good reason ;)
>
> There was a no-op implementation for s390, and besides drivers/xen/balloon.c
> there is only mm/hugetlb_vmemmap.c in common code which makes use of this. To
> me it looks like both call sites only need to flush TLB entries of the kernel
> address space. So I'd rather prefer if flush_tlb_all() would die instead.
I'd assume that we only modify the kernel virtual address space, so I agree.
>
> But I'm also wondering about the correctness of the whole thing even with this
> patch. If I'm not mistaken then vmemmap_split_pmd() changes an active pmd
> entry of the kernel mapping. That is: an active leaf entry (aka large page) is
> changed to an active entry pointing to a page table.
That's my understanding as well.
>
> Changing active entries without the detour over an invalid entry or using
> proper instructions like crdte or cspg is not allowed on s390. This was solved
> for other parts that change active entries of the kernel mapping in an
> architecture compliant way for s390 (see arch/s390/mm/pageattr.c).
Good point. I recall ARM64 has similar break-before-make requirements
because they cannot tolerate two different TLB entries (small vs. large)
for the same virtual address.
And if I rememebr correctly, that's the reason why arm64 does not enable
ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP just yet.
--
Cheers
David / dhildenb
next prev parent reply other threads:[~2025-10-29 12:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-28 21:15 [PATCH v2] s390: fix HugeTLB vmemmap optimization crash Luiz Capitulino
2025-10-28 21:53 ` Andrew Morton
2025-10-30 14:59 ` Heiko Carstens
2025-10-29 6:36 ` Alexander Gordeev
2025-10-29 9:57 ` David Hildenbrand
2025-10-29 10:44 ` Heiko Carstens
2025-10-29 12:15 ` David Hildenbrand [this message]
2025-10-29 12:49 ` Heiko Carstens
2025-10-30 14:38 ` Gerald Schaefer
2025-10-30 14:54 ` Luiz Capitulino
2025-10-30 14:56 ` Heiko Carstens
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9a8254b9-92f8-4530-88e8-fca3b7465908@redhat.com \
--to=david@redhat.com \
--cc=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@kernel.org \
--cc=borntraeger@linux.ibm.com \
--cc=gerald.schaefer@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=joao.m.martins@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-s390@vger.kernel.org \
--cc=luizcap@redhat.com \
--cc=mike.kravetz@oracle.com \
--cc=osalvador@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).