Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5BA2C433EF for ; Tue, 16 Nov 2021 23:01:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 63A8061BBD for ; Tue, 16 Nov 2021 23:01:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 63A8061BBD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ruk/jFBT2s89gDUs+864OWhou5LUC7Uf5utzXeJEqrQ=; b=0BcM9RjCcSHb1c W4F8zh3iFwUpVAbL8BU7TshVk9orof2D1/ilveWxpVJLBPKfMDZXWQX1Z9JREfY7W48d3UAiT97el 9eeWtIBMfjoGU3oUts004l/eyT0cBdJg/dJfHlHO63641LsibJI1VHCbP4MDyKsJFx4gMdFLYnnEP IpCYTw3fZmJZjP+9HYUVEFqsQ7cJpdxEAUh5xtT+wscB6OlQpis4xLWYoCG7GpFXK1QLx9a6qcYof IexXnNL3CXJkoc/7ev7+ta1JxSmU1gr5rHFcOXhlT4lFnMCezAWk0MwL+SZc6pS1BBFGOPjjLZ0G/ 7EJvyjPAuMXLqEWFsXhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mn7Qz-002uCE-G7; Tue, 16 Nov 2021 23:00:13 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mn7Qw-002uBr-2m for linux-arm-kernel@lists.infradead.org; Tue, 16 Nov 2021 23:00:11 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 157FF6D; Tue, 16 Nov 2021 15:00:08 -0800 (PST) Received: from [10.57.82.45] (unknown [10.57.82.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1E37A3F766; Tue, 16 Nov 2021 15:00:05 -0800 (PST) Message-ID: <574b481a-900c-3f91-9967-d117cde69a44@arm.com> Date: Tue, 16 Nov 2021 23:00:00 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: [PATCH v2 1/2] arm64: clear_page() shouldn't use DC ZVA when DCZID_EL0.DZP == 1 Content-Language: en-GB To: Reiji Watanabe , Catalin Marinas , Will Deacon Cc: Marc Zyngier , Mark Rutland , Peter Collingbourne , Evgenii Stepanov , linux-arm-kernel@lists.infradead.org, Peter Shier , Ricardo Koller , Oliver Upton , Jing Zhang , Raghavendra Rao Anata References: <20211108071149.823570-1-reijiw@google.com> <20211108071149.823570-2-reijiw@google.com> From: Robin Murphy In-Reply-To: <20211108071149.823570-2-reijiw@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211116_150010_209696_BEE359D7 X-CRM114-Status: GOOD ( 12.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2021-11-08 07:11, 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. Reviewed-by: Robin Murphy FWIW I did eventually figure out the "pre-bias" trick from v1 thanks to Mark's nod toward the original context, but a quick survey of various optimisation guides implied that the explicit add should generally be preferred over post-index writeback anyway, so I think we're all good here. Cheers, Robin. > Fixes: f27bb139c387 ("arm64: Miscellaneous library functions") > Signed-off-by: Reiji Watanabe > --- > arch/arm64/lib/clear_page.S | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/arch/arm64/lib/clear_page.S b/arch/arm64/lib/clear_page.S > index b84b179edba3..ea3a6c927fe8 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 ZVA is prohibited */ > and w1, w1, #0xf > mov x2, #4 > lsl x1, x2, x1 > @@ -25,5 +26,14 @@ SYM_FUNC_START_PI(clear_page) > tst x0, #(PAGE_SIZE - 1) > b.ne 1b > ret > + > +2: stp xzr, xzr, [x0] > + stp xzr, xzr, [x0, #16] > + stp xzr, xzr, [x0, #32] > + stp xzr, xzr, [x0, #48] > + add x0, x0, #64 > + tst x0, #(PAGE_SIZE - 1) > + b.ne 2b > + ret > SYM_FUNC_END_PI(clear_page) > EXPORT_SYMBOL(clear_page) > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel