From patchwork Thu May 24 16:56:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dave Martin X-Patchwork-Id: 920007 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ixkLtTJR"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40sFt342J3z9ryk for ; Fri, 25 May 2018 02:57:14 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.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=Gx9g4tK6DQPBaTEO+H0ArrwUOv7AIrlGs6/5E2cplfs=; b=ixkLtTJRIab0Q5 kuG4ZvCA+iH7hSHpVN83i5gYkge7CifkXnwh+knOYSnhQnnp3NVFXOM+8J2lRbP6CNM8Uo7Y5x4mq FgDA02CgtAXq9GEt0KDmpkiAs7CqBi3y+UzTxJQe0LnvELlt88lRagDkgnwcJtiS5jAyDthKQ/qy+ AzzLKQK0VXSyxUveafy7Icg84qXK4bXSPj0wAmI5Bt1KlXuPBk7WADsXVtizVCf/HnRgxZDP2L/1m oVhJikPw8NmBuR+4YlcvL/IV+KgUSr9db2HZrs9S67w7sN0pqAGJedH5/0q8SkWkio8CFkVjxvPyx kRrAcMWTu5PJS7Yfm8Pg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLtY6-0002Cm-Rp; Thu, 24 May 2018 16:57:10 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLtY1-00028S-9M for linux-arm-kernel@lists.infradead.org; Thu, 24 May 2018 16:57:06 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 947771596; Thu, 24 May 2018 09:56:54 -0700 (PDT) Received: from e103592.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 689403F25D; Thu, 24 May 2018 09:56:52 -0700 (PDT) From: Dave Martin To: kvmarm@lists.cs.columbia.edu Subject: [PATCH v11 00/19] KVM: arm64: Optimise FPSIMD context switching Date: Thu, 24 May 2018 17:56:29 +0100 Message-Id: <1527181008-13549-1-git-send-email-Dave.Martin@arm.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180524_095705_345002_BC2D130F X-CRM114-Status: GOOD ( 16.08 ) X-Spam-Score: -5.0 (-----) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-5.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [217.140.101.70 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Christoffer Dall , Ard Biesheuvel , Marc Zyngier , Catalin Marinas , Will Deacon , linux-kernel@vger.kernel.org, Steven Rostedt , Oleg Nesterov , Peter Zijlstra , Ingo Molnar , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org Note: Most of these patches are Arm-specific. People not Cc'd on the whole series can find it in the linux-arm-kernel archive [2]. Git: see [3] This series aims to improve the way FPSIMD context is handled by KVM. Changes since the previous v10 [1] are minor, but one patch has been split. ** To Catalin Marinas, Alex Bennée: ** I have retained your Reviewed-bys on patches 7 and 8: these were split from patch 7 of v9. Although the code is (almost) the same as noted below, I advise you to take a look. (all) reviewers please note: * Patches 7 and 8 have been split from the previous patch 7, since the update to INIT_THREAD_INFO is logically a fix and deserves a Fixes: tag. I have also moved the definition of INIT_THREAD_INFO to after the TIF_* definitions that it now depends on (mysteriously this wasn't causing a compile error anyway, but I've not dug into why). * Other changes are all additions or rewordings of comments, and amendments commit messages. Cheers ---Dave [1] [PATCH v10 00/18] KVM: arm64: Optimise FPSIMD context switching http://lists.infradead.org/pipermail/linux-arm-kernel/2018-May/579899.html [2] linux-arm-kernel archive http://lists.infradead.org/pipermail/linux-arm-kernel/2018-May/thread.html [3] http://linux-arm.org/git?p=linux-dm.git;a=shortlog;h=refs/heads/kvm-vhe-fpsimd/v11 Christoffer Dall (1): KVM: arm/arm64: Introduce kvm_arch_vcpu_run_pid_change Dave Martin (18): arm64: fpsimd: Fix TIF_FOREIGN_FPSTATE after invalidating cpu regs thread_info: Add update_thread_flag() helpers arm64: Use update{,_tsk}_thread_flag() KVM: arm64: Convert lazy FPSIMD context switch trap to C arm64: fpsimd: Generalise context saving for non-task contexts arm64: fpsimd: Avoid FPSIMD context leakage for the init task arm64: fpsimd: Eliminate task->mm checks arm64/sve: Refactor user SVE trap maintenance for external use KVM: arm64: Repurpose vcpu_arch.debug_flags for general-purpose flags KVM: arm64: Optimise FPSIMD handling to reduce guest/host thrashing arm64/sve: Move read_zcr_features() out of cpufeature.h arm64/sve: Switch sve_pffr() argument from task to thread arm64/sve: Move sve_pffr() to fpsimd.h and make inline KVM: arm64: Save host SVE context as appropriate KVM: arm64: Remove eager host SVE state saving KVM: arm64: Remove redundant *exit_code changes in fpsimd_guest_exit() KVM: arm64: Fold redundant exit code checks out of fixup_guest_exit() KVM: arm64: Invoke FPSIMD context switch trap from C arch/arm/include/asm/kvm_host.h | 10 +- arch/arm64/Kconfig | 7 ++ arch/arm64/include/asm/cpufeature.h | 29 ------ arch/arm64/include/asm/fpsimd.h | 21 +++++ arch/arm64/include/asm/kvm_asm.h | 3 - arch/arm64/include/asm/kvm_host.h | 45 +++++++-- arch/arm64/include/asm/processor.h | 15 ++- arch/arm64/include/asm/thread_info.h | 13 +-- arch/arm64/kernel/fpsimd.c | 177 +++++++++++++++++------------------ arch/arm64/kernel/ptrace.c | 1 + arch/arm64/kvm/Kconfig | 1 + arch/arm64/kvm/Makefile | 2 +- arch/arm64/kvm/debug.c | 8 +- arch/arm64/kvm/fpsimd.c | 110 ++++++++++++++++++++++ arch/arm64/kvm/hyp/debug-sr.c | 6 +- arch/arm64/kvm/hyp/entry.S | 43 --------- arch/arm64/kvm/hyp/hyp-entry.S | 19 ---- arch/arm64/kvm/hyp/switch.c | 124 ++++++++++++++++-------- arch/arm64/kvm/hyp/sysreg-sr.c | 4 +- arch/arm64/kvm/sys_regs.c | 9 +- include/linux/kvm_host.h | 9 ++ include/linux/sched.h | 6 ++ include/linux/thread_info.h | 11 +++ virt/kvm/Kconfig | 3 + virt/kvm/arm/arm.c | 14 ++- virt/kvm/kvm_main.c | 7 +- 26 files changed, 437 insertions(+), 260 deletions(-) create mode 100644 arch/arm64/kvm/fpsimd.c