From: Dev Jain <dev.jain@arm.com>
To: Yeo Reum Yun <YeoReum.Yun@arm.com>,
"jroedel@suse.de" <jroedel@suse.de>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Cc: Ryan Roberts <Ryan.Roberts@arm.com>,
"david@redhat.com" <david@redhat.com>,
"willy@infradead.org" <willy@infradead.org>,
"hch@lst.de" <hch@lst.de>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH] mm: Update mask post pxd_clear_bad()
Date: Mon, 17 Mar 2025 12:33:24 +0530 [thread overview]
Message-ID: <acdd3003-4a05-4587-93d3-89df3bcd010f@arm.com> (raw)
In-Reply-To: <GV1PR08MB105214AFCE69B0333DF65D3BCFBD22@GV1PR08MB10521.eurprd08.prod.outlook.com>
On 14/03/25 7:57 pm, Yeo Reum Yun wrote:
> Hi Dev,
>
>>> Since pxd_clear_bad() is an operation changing the state of the page tables,
>>> we should call arch_sync_kernel_mappings() post this.
>>>
>>> Fixes: e80d3909be42 ("mm: track page table modifications in __apply_to_page_range()")
>>> Cc: <stable@vger.kernel.org>
>>> Signed-off-by: Dev Jain <dev.jain@arm.com>
>>> ---
>>> mm/memory.c | 4 ++++
>>> 1 file changed, 4 insertions(+)
>>>
>>> diff --git a/mm/memory.c b/mm/memory.c
>>> index 78c7ee62795e..9a4a8c710be0 100644
>>> --- a/mm/memory.c
>>> +++ b/mm/memory.c
>>> @@ -2987,6 +2987,7 @@ static int apply_to_pmd_range(struct mm_struct *mm, pud_t *pud,
>>> if (!create)
>>> continue;
>>> pmd_clear_bad(pmd);
>>> + *mask = PGTBL_PMD_MODIFIED;
>>
>> Oh well, I guess these should have been *mask |= PGTBL_PMD_MODIFIED.
>>
>>
>>> }
>>> err = apply_to_pte_range(mm, pmd, addr, next,
>>> fn, data, create, mask);
>>> @@ -3023,6 +3024,7 @@ static int apply_to_pud_range(struct mm_struct *mm, p4d_t *p4d,
>>> if (!create)
>>> continue;
>>> pud_clear_bad(pud);
>>> + *mask = PGTBL_PUD_MODIFIED;
>>> }
>>> err = apply_to_pmd_range(mm, pud, addr, next,
>>> fn, data, create, mask);
>>> @@ -3059,6 +3061,7 @@ static int apply_to_p4d_range(struct mm_struct *mm, pgd_t *pgd,
>>> if (!create)
>>> continue;
>>> p4d_clear_bad(p4d);
>>> + *mask = PGTBL_P4D_MODIFIED;
>>> }
>>> err = apply_to_pud_range(mm, p4d, addr, next,
>>> fn, data, create, mask);
>>> @@ -3095,6 +3098,7 @@ static int __apply_to_page_range(struct mm_struct *mm, unsigned long addr,
>>> if (!create)
>>> continue;
>>> pgd_clear_bad(pgd);
>> + mask = PGTBL_PGD_MODIFIED;
>>> }
>>> err = apply_to_p4d_range(mm, pgd, addr, next,
>>> fn, data, create, &mask);
>
> I don't think this wouldn't need.
> the pXd_clear_bad() is only called at creation of each level of page table,
> and when it clear, the following, apply_to_pXd_range() function would be set
> the make properly via pXd_alloc() and apply_to_pte_range().
Makes sense. But pxd_clear_bad() gets called in case of !pxd_none(), so
while creating, why would the page containing the page table not be
none? I believe it should be cleared already?
>
> Thanks.
>
>
next prev parent reply other threads:[~2025-03-17 7:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-13 18:14 [PATCH] mm: Update mask post pxd_clear_bad() Dev Jain
2025-03-13 18:28 ` Dev Jain
2025-03-14 14:27 ` Yeo Reum Yun
2025-03-17 7:03 ` Dev Jain [this message]
2025-03-13 20:44 ` Matthew Wilcox
2025-03-14 12:57 ` Dev Jain
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=acdd3003-4a05-4587-93d3-89df3bcd010f@arm.com \
--to=dev.jain@arm.com \
--cc=Ryan.Roberts@arm.com \
--cc=YeoReum.Yun@arm.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=hch@lst.de \
--cc=jroedel@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=stable@vger.kernel.org \
--cc=willy@infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.