Re: [PATCH for 7.4-rc2+ 4/7] s390/mm: always clear _SEGMENT_ENTRY_READ in pmdp_invalidate()
From: Zi Yan
Date: Wed Dec 02 2026 - 10:58:38 EST
On 2 Dec 2026, at 5:20, Alexander Gordeev wrote:
> On Tue, Dec 01, 2026 at 04:47:16PM -0500, Zi Yan wrote:
>> On 1 Dec 2026, at 10:41, Alexander Gordeev wrote:
>>
>>> On Tue, Dec 01, 2026 at 10:06:11AM -0500, Zi Yan wrote:
>>>> Thanks. What is the plan for upstreaming this? 7.4-rcX or 7.5-rcX?
>>>> I would like to keep track of it for V2, since Patch 6 and 7 depend
>>>> on it. In addition, I will need to convert 3 more places in V2 to
>>>> use pmdp_invalidate(), so V2 will take a while.
>>>
>>> This is 7.5-rc1 material. Do you expect v2 could make it into 7.5?
>>> If so, I would rather get it as a whole via the mm tree.
>>
>> Yes, I am working on it.
>
> Great! With your original message slightly reworded:
>
> pmdp_invalidate() sets _SEGMENT_ENTRY_INVALID, but that bit alone does
> not make the entry pmd_protnone(). Clear the _SEGMENT_ENTRY_READ as
> well, so that GUP-fast backs off and no longer grabs a reference to a
> folio mapped by the invalidated PMD.
>
> Code can invalidate a PMD and then based on folio refcount decides
> whether it may drop the mapping. That relies on GUP-fast backing off
> from an invalidated PMD, as it does on x86, arm64, and powerpc.
>
> With CONFIG_PAGE_TABLE_CHECK, pmdp_invalidate() already clears
> _SEGMENT_ENTRY_READ, which makes the entry pmd_protnone(), so GUP-fast
> does not follow it. Do that unconditionally. As noted in commit
> 7b4dde5e40ad6 ("s390/pgtable: Add s390 support for page table check"),
> an invalidated PMD that is pmd_protnone() is fine for the remaining
> pmd_protnone() users, which run under the page table lock or are
> lockless walkers that should not follow it anyway.
>
> Reviewed-by: Alexander Gordeev <agordeev@xxxxxxxxxxxxx>
Thank you for the commit message and Rb.
Best Regards,
Yan, Zi