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 X-Spam-Level: X-Spam-Status: No, score=-5.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41FFBC433ED for ; Fri, 21 May 2021 11:57:25 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 900EC6008E for ; Fri, 21 May 2021 11:57:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 900EC6008E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Z6B1vE0eUTGXoykjGSFIshryig+lBKm1e40hl0cDDM8=; b=fFvZpiyRFWQL3/M7npgk95EZcA MzwvXI9pVDtQMfLuIziU9DwzNWtjuDw2d6GUr/gptgMxanHcj/wXYy02NbcjmLT1SXJc5WR4mQVIN JlZROtux7cg5iImACs9rgL48NsABGVd4GjYdFIG94DmcucI9KPDmlJpRfU8On19x5DIBATvEetly3 5V66oHX1oWIoMbeNucCAzcSUrjN9gEPuvLLbRcZjzgghZRvpgU1kvcQ/JIFo5sDUhwPPV1j5U3kik xkzzq+qQ3YbcXRl86vUDZV4tclWzhooAC3vR3+OswIwQnnBrvN1H8LVTWpLfRSud0o0TYTxlNPymg xgsyT2wQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lk3jv-005EQr-4m; Fri, 21 May 2021 11:54:52 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lk3js-005EQ7-1B for linux-arm-kernel@desiato.infradead.org; Fri, 21 May 2021 11:54:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=KUBbbIkzwyxtv4Uewl72BL8/3ICgxG9bTfYdHVWAkpk=; b=MdAt0Og9i5rzh2zK/S8YtCA/b1 qWdRGIluk/zz5LcNfupfCN/x+4vsAnZV+bKKcpbTp9E4PZRkjsdXozDuliaM/qZxOux0ABPiPiid5 yuDRaOUS9+b28g70HWl0yhFS4+jbjCTHvgIp+8+8u5BSotFjgUUfcLrAHBxH3+p7fo/xXkqh+u2q6 iWRxl9TL8/9ASK1TrCkrEi6k31zqfxrzUeb6sT4PEQM/626LD8reBf3ENc827E0bmOf6A/B35Ae8l 60/9iuVFTcFYW3GBl7vpWY+P2qgfvS8wcbtD85kVR8BpOkzfdDB3+gqujpuznuCvPl8dTgyHp9kVK EuWXLujQ==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lk3jp-00H50Q-Ax for linux-arm-kernel@lists.infradead.org; Fri, 21 May 2021 11:54:46 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7F1576100C; Fri, 21 May 2021 11:54:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621598085; bh=ybzBPw26Ot6D2BqBrLTh/riX7CZLmq7j5GozLVtLqZ0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JaqPROlzaj4Jy7/wejYgvabg5YtkOmpvdHJEbTAtze8pbo7qsgCyLi6nSl80jk5BZ uLWS+Vbl7SiOtjOeEygqzAW0hMTQENEdBIzGAFyqbOCV2Q0Kyc0WfFbyqSKHhbVtyL hSr8lMYaDNrQ4c6uHMJt1V5wsTYNbOmKZk8MUn91M3wMgweKB4Aiv/1WV7bh/ccCVA +qYy6zts4KZ8hac1dlK2oFLr4N7ESa7CzwI597qA8omwiB1PyW0nwPss4Ap2GGUHWH 5Hy73hWosg+uYWZjSQuJZfVIad6PDEPep50PpVBnD5dSIVP/MJ/j+3GwCZ4RzGKrz1 +ybV20IxR7nxQ== Date: Fri, 21 May 2021 12:54:41 +0100 From: Mark Brown To: Catalin Marinas Cc: psodagud@codeaurora.org, will@kernel.org, Dave.Martin@arm.com, amit.kachhap@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: sve_user_discard Message-ID: <20210521115441.GA5825@sirena.org.uk> References: <785d7bc29da6bff0dceeb712c24601fd@codeaurora.org> <20210521091254.GA6675@arm.com> MIME-Version: 1.0 In-Reply-To: <20210521091254.GA6675@arm.com> X-Cookie: Do not write below this line. User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210521_045445_438528_6C95E21E X-CRM114-Status: GOOD ( 28.39 ) 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-Type: multipart/mixed; boundary="===============6201957066390081388==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============6201957066390081388== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="WIyZ46R2i8wDzkSu" Content-Disposition: inline --WIyZ46R2i8wDzkSu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, May 21, 2021 at 10:12:54AM +0100, Catalin Marinas wrote: > On Thu, May 20, 2021 at 04:02:03PM -0700, psodagud@codeaurora.org wrote: > > This is regarding sve_user_disable(CPACR_EL1_ZEN_EL0EN) on every system > > call. If a userspace task is using SVE instructions and making sys calls in > > between, it would impact the performance of the thread. On every SVE > > instructions after SVC/system call, it would trap to EL1. > > I think by setting CPACR_EL1_ZEN_EL0EN flag, the processor faults when it > > runs an SVE instruction. This approach may be taken as part of FPSIMD > > registers switching optimizations. Can below portion of the code use > > thread.fpsimd_cpu and fpsimd_last_state variables to avoid clearing > > CPACR_EL1_ZEN_EL0EN for this kind of use cases? This mail hasn't hit the lists yet so I've only got the quoted portions, missing some context like the "code below" referenced above so I don't know exactly what the proposal is. > There were attempts over the past couple of years to optimise the > syscall return use-case. I think the latest is this one: > https://lore.kernel.org/r/20201106193553.22946-2-broonie@kernel.org There's actually this more recently: https://lore.kernel.org/linux-arm-kernel/20210512151131.27877-1-broonie@kernel.org/ which does 90% of the optimisation in a lot less code, people seem a bit more enthusiastic about that version. > I'll let Mark comment on his plans for reviving the series. Do you > happen to have some realistic workload that would be improved by this? > We can always write a micro-benchmark but I wonder how much this matters > in the real world. Yeah, I'm not sure how much of a meaningful overhead there is from doing the sve_user_discard() vs testing to see if we need to do it while maintaining correctness. Whatever overhead there is with the current code will only take effect if we're hitting a slow path anyway so it feels like it might be more trouble than it's worth. If the proposal was to just leave SVE enabled for userspace then the issue there is that we'd have to context switch SVE even if the process isn't using it, there is nothing other than a syscall that lets us stop doing that. It will be interesting to look at this stuff as SVE hardware starts to become more widely available and used on a wider range of workloads on systems with various vector sizes, lazy restore might be worth looking at for example possibly in conjunction with always allowing SVE from userspace. --WIyZ46R2i8wDzkSu Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmCnn4EACgkQJNaLcl1U h9Dfhwf9GT73m0jO5ZzRlrEtKUQOuJbxTHfXQcrYcJd4jPG1568wQaW1LhtjmAWQ MLDZMD4inzrg+ez7KR6k5VI1YoTiOo6RDQdJ7DLVqIqKB87gF/XcMcDIb04mLfcg VNDva3uajrR+nR9tuk0ZrTNuj9PrAiJx4NPDmATYKPfxaZ7Is3nsFEbD3v4StTQ/ Seens0oUqukeIH+ta1AjC/6+SuRYaSL1T3c5YKfKYGj4AoEdVCpc2hNXNiLTraq0 /A715NKhqKZmFtrQAWGoq3NElV4QLAa8VT+1RmAEsCMj1OOPJegjIv2DCovu3kbG D04gBecD+r8uaynotl39ZLwTtvgqKg== =wIQZ -----END PGP SIGNATURE----- --WIyZ46R2i8wDzkSu-- --===============6201957066390081388== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============6201957066390081388==--