From: Robin Murphy <robin.murphy@arm.com>
To: Guanghui Feng <guanghuifeng@linux.alibaba.com>,
catalin.marinas@arm.com, will@kernel.org, maz@kernel.org,
qperret@google.com, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Cc: baolin.wang@linux.alibaba.com, zhuo.song@linux.alibaba.com,
zhangliguang@linux.alibaba.com
Subject: Re: [PATCH] arm64: clear_page: use stnp non-temporal instruction for performance optimizing
Date: Tue, 16 Nov 2021 23:12:19 +0000 [thread overview]
Message-ID: <7096e4d4-d27a-42f5-34d0-11ce7156a8f1@arm.com> (raw)
In-Reply-To: <1637075294-30747-1-git-send-email-guanghuifeng@linux.alibaba.com>
On 2021-11-16 15:08, Guanghui Feng wrote:
> When clear page mem, there is no need to alloc cache for storing these
> mem value. And the copy_page.S have used stnp instruction for optimizing.
> So I rewrite the clear_page.S with stnp. At the same time, I have tested it
> with stnp instruction which will get about twice the performance improvement.
>
> Signed-off-by: Guanghui Feng <guanghuifeng@linux.alibaba.com>
> ---
> arch/arm64/lib/clear_page.S | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/arch/arm64/lib/clear_page.S b/arch/arm64/lib/clear_page.S
> index b84b179..e9dc2d6 100644
> --- a/arch/arm64/lib/clear_page.S
> +++ b/arch/arm64/lib/clear_page.S
> @@ -15,13 +15,18 @@
> * x0 - dest
> */
> SYM_FUNC_START_PI(clear_page)
> - mrs x1, dczid_el0
> - and w1, w1, #0xf
> - mov x2, #4
> - lsl x1, x2, x1
> -
> -1: dc zva, x0
> - add x0, x0, x1
> + mov x1, #0
> + mov x2, #0
Regardless of the bigger question around the architectural intent that
DC ZVA is supposed to be the best way to clear memory (sanity check:
this wasn't under virtualisation with HCR_EL2.TDZ set, was it?) - out of
curiosity, why do this and not just "stnp xzr, xzr, ..."?
Note also that this is liable to conflict with the patch for respecting
DCZID_EL0.DZP. On which note, is DC {GVA,GZVA} performance also a
concern, or does your platform not have MTE? If the performance anomaly
does turn out to be platform-specific, maybe it might be better to quirk
those platforms to set DZP, rather than changing the code for everyone?
Robin.
> +1:
> + stnp x1, x2, [x0]
> + stnp x1, x2, [x0, #16]
> + stnp x1, x2, [x0, #32]
> + stnp x1, x2, [x0, #48]
> + stnp x1, x2, [x0, #64]
> + stnp x1, x2, [x0, #80]
> + stnp x1, x2, [x0, #96]
> + stnp x1, x2, [x0, #112]
> + add x0, x0, #128
> tst x0, #(PAGE_SIZE - 1)
> b.ne 1b
> ret
>
prev parent reply other threads:[~2021-11-16 23:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-16 15:08 Guanghui Feng
2021-11-16 18:17 ` Catalin Marinas
2021-11-16 23:12 ` Robin Murphy [this message]
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=7096e4d4-d27a-42f5-34d0-11ce7156a8f1@arm.com \
--to=robin.murphy@arm.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=catalin.marinas@arm.com \
--cc=guanghuifeng@linux.alibaba.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=qperret@google.com \
--cc=will@kernel.org \
--cc=zhangliguang@linux.alibaba.com \
--cc=zhuo.song@linux.alibaba.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
all inboxes | Powered by JetHome®