From mboxrd@z Thu Jan 1 00:00:00 1970 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id AF0DCC4708D for ; Thu, 8 Dec 2022 02:17:02 +0000 (UTC) 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:MIME-Version:Date:Message-ID:From: References:CC:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=MRhGey1DFaYbudpkNkTrFPrFQThsBbToKEXoHJwXAjU=; b=uV1MRY53fAFR932H9Sti3NRTmE FCN0uD8O6HSURhcMNKS4hYRker1R+w5tQ5UQNO5x1iF0w+eYz3UZsezkYgBAgrM/Bv6IsMo075c1W xyzNstBQ746g2UhOoxBIxfhWC9wBlRrXpdGQadP6tM8x7ymmHoZ0d3YWQnA3YMcnL7feDOBJSjiXT f13or2JsFzh9/kpnnOrFYgPJi51RIstKlhxd6uYCSo7Eu3PB3SKIxG09g7HvfCnruDInrk0NI+N1P uK0cpj/QgIpYMtMQr9qwYzkaOUrf/bqT/u3Pt4AlatY3tgkB2cVIiFrt23dy5KCMPCO6uD6xlnSBI JDyGkI6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p36Rn-000AAl-JW; Thu, 08 Dec 2022 02:15:39 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p36Rj-000A5n-Dk for linux-arm-kernel@lists.infradead.org; Thu, 08 Dec 2022 02:15:37 +0000 Received: from kwepemm600007.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NSHlw69hRzRpnZ; Thu, 8 Dec 2022 10:14:36 +0800 (CST) Received: from [10.174.185.179] (10.174.185.179) by kwepemm600007.china.huawei.com (7.193.23.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 8 Dec 2022 10:15:27 +0800 Subject: Re: [PATCH v14 16/39] arm64/sme: Implement traps and syscall handling for SME To: Mark Brown CC: Catalin Marinas , Will Deacon , Marc Zyngier , Shuah Khan , Shuah Khan , Basant Kumar Dwivedi , Luis Machado , Szabolcs Nagy , , , Alan Hayward , , Salil Akerkar , Luca Salabrino References: <20220419112247.711548-1-broonie@kernel.org> <20220419112247.711548-17-broonie@kernel.org> From: Zenghui Yu Message-ID: Date: Thu, 8 Dec 2022 10:15:26 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Originating-IP: [10.174.185.179] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600007.china.huawei.com (7.193.23.208) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221207_181535_848021_C480F6A4 X-CRM114-Status: GOOD ( 21.00 ) 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 2022/12/7 22:16, Mark Brown wrote: > On Wed, Dec 07, 2022 at 10:00:17PM +0800, Zenghui Yu wrote: >> On 2022/4/19 19:22, Mark Brown wrote: > >>> + /* >>> + * If SME is active then exit streaming mode. If ZA is active >>> + * then flush the SVE registers but leave userspace access to >>> + * both SVE and SME enabled, otherwise disable SME for the >>> + * task and fall through to disabling SVE too. This means > >> It looks a bit confusing to me that in the current implementation, if >> ZA is *not* active, we don't actually go to disable SME for the task >> (which IMHO can be disabled as user-space is not actively using it now). > > Unlike SVE there's no overhead from leaving SME enabled, the enable bits > for SM and ZA tell us if there is extra register state to be saved so we > don't have to worry about the costs there like we do with SVE. The only > reason for not just unconditionally enabling SME is the potentially > large backing storage required for the registers, if a task isn't using > SME there's no need to impose that overhead. If we disable SME for > userspace after the storage has been allocated then we just require an > additional trip through EL1 to reenable it for any future usage which > would hurt performance but not really gain us anything otherwise. We > don't want to discurage applications from disabling ZA when not in use > given that there's likely to be physical overheads from keeping it > enabled. Ah, thanks a lot for the explanations. The comment itself can be improved though (I think). >>> + if (svcr & SYS_SVCR_EL0_SM_MASK) >>> + sme_smstop_sm(); > >> As per the SME syscall ABI > >> | On syscall PSTATE.SM will be cleared and the SVE registers will be >> | handled as per the standard SVE ABI. > >> and the SVE syscall ABI > >> | On syscall, V0..V31 are preserved (as without SVE). Thus, bits >> | [127:0] of Z0..Z31 are preserved. All other bits of Z0..Z31, and all >> | of P0..P15 and FFR become zero on return from a syscall. > >> Can we infer from the documentation that V0-V31 should be preserved on >> return from a syscall? But with sme_smstop_sm(), all implemented bits of >> Z0-Z31 are set to zero by hardware. Is this intentional? > >> Please fix me up if I've mis-read things here. > > No, the intention is to say that we exit streaming mode and then handle > things as per the non-streaming ABI. Exiting streaming mode has the > effect of clearing the values as you say. Thanks, Zenghui _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel