From: Catalin Marinas <catalin.marinas@arm.com>
To: Yang Shi <yang@os.amperecomputing.com>
Cc: Sasha Levin <sashal@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Will Deacon <will@kernel.org>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
David Hildenbrand <david@redhat.com>
Subject: Re: [GIT PULL] arm64 updates for 6.13-rc1
Date: Thu, 28 Nov 2024 14:12:18 +0000 [thread overview]
Message-ID: <Z0h6Qtleb-znhX3u@arm.com> (raw)
In-Reply-To: <dc5e8809-825f-4c38-b487-b16c7d516311@os.amperecomputing.com>
On Wed, Nov 27, 2024 at 05:21:37PM -0800, Yang Shi wrote:
> > > diff --git a/arch/arm64/mm/copypage.c b/arch/arm64/mm/copypage.c
> > > index 87b3f1a25535..ef303a2262c5 100644
> > > --- a/arch/arm64/mm/copypage.c
> > > +++ b/arch/arm64/mm/copypage.c
> > > @@ -30,9 +30,9 @@ void copy_highpage(struct page *to, struct page *from)
> > > if (!system_supports_mte())
> > > return;
> > > - if (folio_test_hugetlb(src) &&
> > > - folio_test_hugetlb_mte_tagged(src)) {
> > > - if (!folio_try_hugetlb_mte_tagging(dst))
> > > + if (folio_test_hugetlb(src)) {
> > > + if (!folio_test_hugetlb_mte_tagged(src) ||
> > > + !folio_try_hugetlb_mte_tagging(dst))
> > > return;
> > > /*
> > I wonder why we had a 'return' here originally rather than a
> > WARN_ON_ONCE() as we do further down for the page case. Do you seen any
> > issue with the hunk below? Destination should be a new folio and not
> > tagged yet:
>
> Yes, I did see problem. Because we copy tags for all sub pages then set
> folio mte tagged when copying the data for the first subpage. The warning
> will be triggered when we copy the second subpage.
Ah, good point, copy_highpage() will be called multiple times for each
subpage but we only do the copying once for the folio.
Now, I wonder whether we should actually defer the tag copying until
copy_page() is called on the head page. This way we can keep the warning
for consistency with the non-compound page case:
diff --git a/arch/arm64/mm/copypage.c b/arch/arm64/mm/copypage.c
index 87b3f1a25535..a86c897017df 100644
--- a/arch/arm64/mm/copypage.c
+++ b/arch/arm64/mm/copypage.c
@@ -30,11 +30,13 @@ void copy_highpage(struct page *to, struct page *from)
if (!system_supports_mte())
return;
- if (folio_test_hugetlb(src) &&
- folio_test_hugetlb_mte_tagged(src)) {
- if (!folio_try_hugetlb_mte_tagging(dst))
+ if (folio_test_hugetlb(src)) {
+ if (!folio_test_hugetlb_mte_tagged(src) ||
+ from != folio_page(src, 0))
return;
+ WARN_ON_ONCE(!folio_try_hugetlb_mte_tagging(dst));
+
/*
* Populate tags for all subpages.
*
--
Catalin
next prev parent reply other threads:[~2024-11-28 14:15 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-18 10:06 [GIT PULL] arm64 updates for 6.13-rc1 Catalin Marinas
2024-11-19 2:24 ` pr-tracker-bot
2024-11-25 15:09 ` Sasha Levin
2024-11-25 19:09 ` Catalin Marinas
2024-11-26 17:41 ` Yang Shi
2024-11-27 18:14 ` Catalin Marinas
2024-11-28 1:21 ` Yang Shi
2024-11-28 9:56 ` David Hildenbrand
2024-12-02 16:22 ` Yang Shi
2024-12-04 15:29 ` Catalin Marinas
2024-12-04 15:32 ` David Hildenbrand
2024-12-04 15:50 ` Catalin Marinas
2024-12-04 16:00 ` Yang Shi
2024-12-04 16:00 ` David Hildenbrand
2024-12-04 16:17 ` Yang Shi
2024-11-28 14:12 ` Catalin Marinas [this message]
2024-12-02 16:05 ` Yang Shi
2024-12-02 16:10 ` David Hildenbrand
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=Z0h6Qtleb-znhX3u@arm.com \
--to=catalin.marinas@arm.com \
--cc=david@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sashal@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=will@kernel.org \
--cc=yang@os.amperecomputing.com \
/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).