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=-8.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT 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 8CFCEC433E2 for ; Fri, 28 Aug 2020 18:16:02 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 5ED6720DD4 for ; Fri, 28 Aug 2020 18:16:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Gr7LWWhA"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="ApEwhKa4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5ED6720DD4 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=FT+NPdDBscVuNb6r4RneJXRKkHp46R/OtUmhbVoQtMA=; b=Gr7LWWhAI+XI14++RfAmOt/WoF kWCRKnTF+16lH9PFJ+OFpTmWyd9bkrKu+HfXtm0C2x22nuQ/HDkr0gk/VUjqje8yRx7O9zdVW/nsZ LXMjF1NjPFKY+oW4H90Nbz4zvP64lxSAXFUHrZVqmLLmL9OEqoCAme5zUjS+Jm8MBO8OP4t6hpsnm w6mmj47zCNrr5PDA3IqvefVs/dJPsy7Cmm0N9vAO51jsDf5g00Qe1OVVYqnCF3vmqgGVH1vzysyiV 6EDGGuvxTJJdcCBKfggzD67DfNUefQp2NG9Ij4DAsTPezxXgUa1FChJ4VKRFbpDKGcaVZ4rYSxsNr 7Urdf0rQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kBitP-0004dB-Ap; Fri, 28 Aug 2020 18:14:27 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kBitN-0004cl-8P for linux-arm-kernel@lists.infradead.org; Fri, 28 Aug 2020 18:14:26 +0000 Received: from localhost (fw-tnat.cambridge.arm.com [217.140.96.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0B70820936; Fri, 28 Aug 2020 18:14:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598638464; bh=s3ti8vXzVfZxlzTyfPkE8kqf1UgCJfRLd530/Z7OGEY=; h=From:To:Cc:Subject:Date:From; b=ApEwhKa4s4/+5pIN46R5rJlPUoW2IFBywzjQxtZmg0G3vdocJXf9AYt4D7oSNlijM crSN1CcWP1bPCpYqV9IGn4Vhy5d6Vf2poNc8pJb23A+fZ1t8hDsXGiMBqIOF0eYOcr YEotTd9bVSUQEB3t6Ar2hVQOaAjSjYYZoCe3Cqh0= From: Mark Brown To: Catalin Marinas , Will Deacon Subject: [PATCH v4 0/8] arm64/sve: First steps towards optimizing syscalls Date: Fri, 28 Aug 2020 19:11:47 +0100 Message-Id: <20200828181155.17745-1-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200828_141425_454375_E9CF8A43 X-CRM114-Status: GOOD ( 22.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Julien Grall , Zhang Lei , Julien Grall , Mark Brown , Dave Martin , linux-arm-kernel@lists.infradead.org, Daniel Kiss Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This is a first attempt to optimize the syscall path when the user application uses SVE. The patch series was originally written by Julien Grall but has been left for a long time, I've updated it to current kernels and tried to address the pending review feedback that I found (which was mostly documentation issues). I may have missed some things there, apologies if I did, and one thing I've not yet done is produced a diagram of the states the relevant TIF_ flags can have - I need to work out a sensible format for that. Per the syscall ABI, SVE registers will be unknown after a syscall. In practice, the kernel will disable SVE and the registers will be zeroed (except the first 128-bits of each vector) on the next SVE instruction. In a workload mixing SVE and syscalls, this will result to 2 entry/exit to the kernel per syscall as we trap on the first SVE access after the syscall. This series aims to avoid the second entry/exit by zeroing the SVE registers on syscall return with a twist when the task will get rescheduled. This implementation will have an impact on application using SVE only once. SVE will now be turned on until the application terminates (unless disabling it via ptrace). Cleverer strategies for choosing between SVE and FPSIMD context switching are possible (see fpu_counter for SH in mainline, or [1]), but it is difficult to assess the benefit right now. We could improve the behaviour in the future as a selection of mature hardware platforsm emerges that we can benchmark. It is also possible to optimize the case when the SVE vector-length is 128-bit (i.e the same size as the FPSIMD vectors). This could be explored in the future. Note that the last patch for the series is is not here to optimize syscall but SVE trap access by directly converting in hardware the FPSIMD state to SVE state. If there are an interest to have this optimization earlier, I can reshuffle the patches in the series. v4: - Rebase onto v5.9-rc2 - Address review comments from Dave Martin, mostly documentation but also some refactorings to ensure we don't check capabilities multiple times and the addition of some WARN_ONs to make sure assumptions we are making about what TIF_ flags can be set when are true. v3: - Rebased to current kernels. - Addressed review comments from v2, mostly around tweaks in the [1] https://git.sphere.ly/dtc/kernel_moto_falcon/commit/acc207616a91a413a50fdd8847a747c4a7324167 Julien Grall (8): arm64/fpsimd: Update documentation of do_sve_acc arm64/signal: Update the comment in preserve_sve_context arm64/fpsimdmacros: Allow the macro "for" to be used in more cases arm64/fpsimdmacros: Introduce a macro to update ZCR_EL1.LEN arm64/sve: Implement a helper to flush SVE registers arm64/sve: Implement a helper to load SVE registers from FPSIMD state arm64/sve: Don't disable SVE on syscalls return arm64/sve: Rework SVE trap access to use TIF_SVE_NEEDS_FLUSH arch/arm64/include/asm/fpsimd.h | 5 ++ arch/arm64/include/asm/fpsimdmacros.h | 48 +++++++++++--- arch/arm64/include/asm/thread_info.h | 6 +- arch/arm64/kernel/entry-fpsimd.S | 30 +++++++++ arch/arm64/kernel/fpsimd.c | 95 ++++++++++++++++++++++----- arch/arm64/kernel/process.c | 1 + arch/arm64/kernel/ptrace.c | 11 ++++ arch/arm64/kernel/signal.c | 19 +++++- arch/arm64/kernel/syscall.c | 13 ++-- 9 files changed, 188 insertions(+), 40 deletions(-) base-commit: d012a7190fc1fd72ed48911e77ca97ba4521bccd -- 2.20.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel