From: Will Deacon <will@kernel.org>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Reiji Watanabe <reijiw@google.com>,
Robin Murphy <robin.murphy@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Marc Zyngier <maz@kernel.org>,
linux-arm-kernel@lists.infradead.org,
Peter Shier <pshier@google.com>,
Ricardo Koller <ricarkol@google.com>,
Oliver Upton <oupton@google.com>,
Jing Zhang <jingzhangos@google.com>,
Raghavendra Rao Anata <rananta@google.com>
Subject: Re: [PATCH] arm64: clear_page() shouldn't use DC ZVA when DCZID_EL0.DZP == 1
Date: Thu, 28 Oct 2021 08:46:10 +0100 [thread overview]
Message-ID: <20211028074609.GA23476@willie-the-truck> (raw)
In-Reply-To: <20211027110947.GB51402@C02TD0UTHF1T.local>
On Wed, Oct 27, 2021 at 12:09:47PM +0100, Mark Rutland wrote:
> On Tue, Oct 26, 2021 at 11:44:51PM -0700, Reiji Watanabe wrote:
> > On Tue, Oct 26, 2021 at 5:23 AM Mark Rutland <mark.rutland@arm.com> wrote:
> > > On Tue, Oct 26, 2021 at 12:22:20PM +0100, Robin Murphy wrote:
> > > > On 2021-10-26 04:48, Reiji Watanabe wrote:
> > > > > Currently, clear_page() uses DC ZVA instruction unconditionally. But it
> > > > > should make sure that DCZID_EL0.DZP, which indicates whether or not use
> > > > > of DC ZVA instruction is prohibited, is zero when using the instruction.
> > > > > Use stp as memset does instead when DCZID_EL0.DZP == 1.
> > > > >
> > > > > Signed-off-by: Reiji Watanabe <reijiw@google.com>
> > > > > ---
> > > > > arch/arm64/lib/clear_page.S | 11 +++++++++++
> > > > > 1 file changed, 11 insertions(+)
> > > > >
> > > > > diff --git a/arch/arm64/lib/clear_page.S b/arch/arm64/lib/clear_page.S
> > > > > index b84b179edba3..7ce1bfa4081c 100644
> > > > > --- a/arch/arm64/lib/clear_page.S
> > > > > +++ b/arch/arm64/lib/clear_page.S
> > > > > @@ -16,6 +16,7 @@
> > > > > */
> > > > > SYM_FUNC_START_PI(clear_page)
> > > > > mrs x1, dczid_el0
> > > > > + tbnz x1, #4, 2f /* Branch if DC GVA is prohibited */
> > >
> > > DCZID_EL0.DZP (AKA DCZID_EL0[4]) says whether all of DC {ZVA,GVA,GZVA}
> > > are prohibited. This loop uses DZ ZVA, not GC GVA, so it'd be nice to
> > > s/GVA/ZVA/ here.
> >
> > Thank you for catching it ! I will fix that.
> >
> > > Howver, `DC GVA` and `DC GZVA` are both used in mte_set_mem_tag_range(),
> > > which'll need a similar update...
> >
> > Yes, I'm aware of that and mte_zero_clear_page_tags() needs to get
> > updated as well. But, Since I'm not familiar with MTE (and I don't
> > have any plans to use MTE yet), I didn't work on them (I'm not sure
> > how I can test them).
> > I might try to fix them separately later as well when I have time
> > (not so soon most likely though).
>
> My view is that we should either:
>
> * Document that we require DCZID_EL0.DZP==0, as is implicitly the case
> today.
I disagree with that. There's nothing wrong in trapping this stuff, as long
as you go ahead and emulate it, which is exactly why we aren't checking it at
the moment as EL2 should be prepared to handle the trap. The Arm ARM talks
about the instructions being "prohibited" but that doesn't mean anything --
the reality is that they trap to EL2.
We could document *that* though?
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-10-28 7:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-26 3:48 [PATCH] arm64: clear_page() shouldn't use DC ZVA when DCZID_EL0.DZP == 1 Reiji Watanabe
2021-10-26 9:06 ` Catalin Marinas
2021-10-27 1:35 ` Reiji Watanabe
2021-10-26 11:22 ` Robin Murphy
2021-10-26 12:23 ` Mark Rutland
2021-10-27 6:44 ` Reiji Watanabe
2021-10-27 11:09 ` Mark Rutland
2021-10-28 1:49 ` Reiji Watanabe
2021-10-28 7:46 ` Will Deacon [this message]
2021-10-28 9:03 ` Mark Rutland
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=20211028074609.GA23476@willie-the-truck \
--to=will@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=jingzhangos@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=oupton@google.com \
--cc=pshier@google.com \
--cc=rananta@google.com \
--cc=reijiw@google.com \
--cc=ricarkol@google.com \
--cc=robin.murphy@arm.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).