From nobody Tue Dec 2 02:33:24 2025 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7ED9D30E0D9 for ; Tue, 18 Nov 2025 22:23:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763504614; cv=none; b=qTAH4+Nrl9668roNirsjoAwO40W6sn4jxMTwJgunKU21BXCCbjahpPMpHMqYV7IvjKYDg0QATqyJNjTH7TvwKpd/BmkcUa6viPMXRFXqk7UXWuWe5pfK+zKHR27+/s1s8UoD4R8Fp7O4GXgdYOVknlN4JeseiO0wZkynwwRsqWw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763504614; c=relaxed/simple; bh=gkOFf1GrseR4lyx+m5A0i8MM9/uAsLY1WwIpa5M2Cos=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=fj9fzgohwPO3uE7Tu+UyJ9CvghPMslysmaSf231jH87bno4sgQkF0rY4A+uUbopI6Knwv/C4N/PU5qOUzAASxBx7MNqXViLdLq6hBpebC4kZxqIVvJj/BF9Z+TXlz05dSllIltRSMcM07ZGcV/qm7O96drk9yPzw2KVSF5XSYSs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=eRzBtuA2; arc=none smtp.client-ip=209.85.214.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="eRzBtuA2" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-29845b18d1aso101843035ad.1 for ; Tue, 18 Nov 2025 14:23:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1763504613; x=1764109413; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=EoozWi2o0AP/cWaOLQLnk9g/zPkjhcGQ8ZSDyR31DRY=; b=eRzBtuA2psnUx1ZmHHnHjodKCcsmSe+Lh0yyURFF7Suo9lkxcjIoIFhCQm+k5IHf5u fePC/ykirHpsd7Or9Hwb+ZDZJa9pni7C9YvKMFgkW/+2woGs8rRRZgi8LCO+qGQVhkbV 5RPTU9ttBIQfrLMz97kddttIzP+gqUtj9N5Wk7DM9B+whEZb8rs4fGNW/y9UEyzFRGjw cCsV6aqs98r3lc9sLDzaVfJzc+ml0XbghzQJQ/2ERNK8oVANBqA8XgEHNTYDll59fUVO l77p0dIE+tW98tufK8Ka9ExBoLXc8Ruzs7uxSTXM5fKl75GDlC1mNxpiUQcg4M15yOoJ bflg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763504613; x=1764109413; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EoozWi2o0AP/cWaOLQLnk9g/zPkjhcGQ8ZSDyR31DRY=; b=TIHVQEnGwurKP4JZwiCfFo798tRyywTGpqqmDVhzytxpXvQ1niJBxVdxQOnKLBTaW+ +pV9ZLWu+nSrWwQonearT17QjChmd0yE9Z1mRkFyxlSPPBjDW43KwJpVjFJto5eVfNUb mqb0GoRTTfW+v2hZe1gICwA35GDghB6VPT2dv/v8oHVlCzEwXtuwnMEK0U30OtjWZHC4 OMKZamYC1QFnkSf1yFztvU4cuLlPfIg10srO4YSDdXXYanm9bAcxcHTflWNFQiG9lzR3 Cyp4lk8YBBm3XHFrWJbTs4ltD91HURwLKANEAy0PjFRC5Csrez1vFrUG3QRX/bRNx8Al +YiA== X-Forwarded-Encrypted: i=1; AJvYcCUgSCC0B8elJahPFNBs1nFdSS3nQoT6qsu9MtF+M5Dx5e4XJrIEKM+qzdxHEvVpmk2kBda8yzvXW1PnfFA=@vger.kernel.org X-Gm-Message-State: AOJu0YzFIWGY3Xl3OvorNs0rJAy905+5NndwttljZ261KqA58V/sWljW D1+vATLN+xMlN2BImf6R8DyM/Yg0EY/SmA7mOMSn//aLyO5tnxEEeJcU42Mmrbj5Fk5MctvM4HQ z8Ebhtg== X-Google-Smtp-Source: AGHT+IGBpr2o1tN68nNDCesi9FJp0PssJ7eoZdkj6lok22m/Q8r6RJE+NAbbob2Q0BzsFgmO0oAokh9ajl8= X-Received: from plbjc5.prod.google.com ([2002:a17:903:25c5:b0:295:68e0:66ed]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:11c6:b0:297:e1f5:191b with SMTP id d9443c01a7336-2986a6abf3cmr224167275ad.11.1763504612758; Tue, 18 Nov 2025 14:23:32 -0800 (PST) Reply-To: Sean Christopherson Date: Tue, 18 Nov 2025 14:23:25 -0800 In-Reply-To: <20251118222328.2265758-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251118222328.2265758-1-seanjc@google.com> X-Mailer: git-send-email 2.52.0.rc1.455.g30608eb744-goog Message-ID: <20251118222328.2265758-2-seanjc@google.com> Subject: [PATCH v2 1/4] KVM: SVM: Handle #MCs in guest outside of fastpath From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini , "Kirill A. Shutemov" Cc: kvm@vger.kernel.org, x86@kernel.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, Rick Edgecombe , Jon Kohler , Tony Lindgren Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Handle Machine Checks (#MC) that happen in the guest (by forwarding them to the host) outside of KVM's fastpath so that as much host state as possible is re-loaded before invoking the kernel's #MC handler. The only requirement is that KVM invokes the #MC handler before enabling IRQs (and even that could _probably_ be relaxed to handling #MCs before enabling preemption). Waiting to handle #MCs until "more" host state is loaded hardens KVM against flaws in the #MC handler, which has historically been quite brittle. E.g. prior to commit 5567d11c21a1 ("x86/mce: Send #MC singal from task work"), the #MC code could trigger a schedule() with IRQs and preemption disabled. That led to a KVM hack-a-fix in commit 1811d979c716 ("x86/kvm: move kvm_load/put_guest_xcr0 into atomic context"). Note, except for #MCs on VM-Enter, VMX already handles #MCs outside of the fastpath. Reviewed-by: Rick Edgecombe Reviewed-by: Jon Kohler Signed-off-by: Sean Christopherson --- arch/x86/kvm/svm/svm.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 9aac0eb3a490..bf34378ebe2d 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -4321,14 +4321,6 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm= _vcpu *vcpu, u64 run_flags) =20 vcpu->arch.regs_avail &=3D ~SVM_REGS_LAZY_LOAD_SET; =20 - /* - * We need to handle MC intercepts here before the vcpu has a chance to - * change the physical cpu - */ - if (unlikely(svm->vmcb->control.exit_code =3D=3D - SVM_EXIT_EXCP_BASE + MC_VECTOR)) - svm_handle_mce(vcpu); - trace_kvm_exit(vcpu, KVM_ISA_SVM); =20 svm_complete_interrupts(vcpu); @@ -4631,8 +4623,16 @@ static int svm_check_intercept(struct kvm_vcpu *vcpu, =20 static void svm_handle_exit_irqoff(struct kvm_vcpu *vcpu) { - if (to_svm(vcpu)->vmcb->control.exit_code =3D=3D SVM_EXIT_INTR) + switch (to_svm(vcpu)->vmcb->control.exit_code) { + case SVM_EXIT_EXCP_BASE + MC_VECTOR: + svm_handle_mce(vcpu); + break; + case SVM_EXIT_INTR: vcpu->arch.at_instruction_boundary =3D true; + break; + default: + break; + } } =20 static void svm_setup_mce(struct kvm_vcpu *vcpu) --=20 2.52.0.rc1.455.g30608eb744-goog From nobody Tue Dec 2 02:33:24 2025 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CF4F30E0E4 for ; Tue, 18 Nov 2025 22:23:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763504616; cv=none; b=BrO/+rsXnXoQgFvBH420i60agr5p/auKayhgY5ODNcA7ryVN8azmdHZOvPNbUdMGWzuXo7s/SGSK9jTCMDIbR43qwzd3KXOAP0iR/1wU5zDAy76GivIuFt79u04a66Xb7GRHKthLmNglExpF4kLEuGO9HqzBKEmAnyJBCRGxLJ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763504616; c=relaxed/simple; bh=/o8KfZ3cNcE/BiIE20gNBxFK6IuWDrd7yhoJMvADFS8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=fVARzAbKqc2EzYGNiZd2d3S2g3IuEnlcksFvi/zOJoHKEwGqM/0y/U0HVVBj/jQ4R8e5GeJUyV7qxJ+a8ucz4icrH6+0BVRcLQ0GB6+EpYVrMUMssKlYJWvZXil0PMY9S2LsQuvlhU8u1dclS1I1YgBiubRQzd38QjiUvcL0Cxg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=rr4QUzhR; arc=none smtp.client-ip=209.85.214.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rr4QUzhR" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-29809acd049so105025465ad.3 for ; Tue, 18 Nov 2025 14:23:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1763504615; x=1764109415; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=QKvebzST2buQwrtL7F9ca9a+LG6gPYB7JuXVc16J77E=; b=rr4QUzhRvH7W2s3Fp8iURRPG2tqmUr5v2BfGyFwiolGJAyqoe/xUVjzI78MbfpF0EG iy+L/Xm2i6IeHQgRIBpt9xDmRDW0puqW05ToSCLAxNOm3z+J5eMRJSq8FN8HAXEaAmfm w3NR6p0pJkMBN0AwzZlCjHAWNV4a/mog4ecOI2YqVK8dsZcwGIredggq18H/gdoFPNxk xho0ebc9rPLt+huzDr6q7Lbt25q9zqTGFugesy+89PuyBcTKMfbXnGfIBcHgUpBStuYt vXEeIr3P8gGxeNQh0A3sPwbEGCK2hbGLL87T1lXAuhvCqEqEYKuQ90AJ/DAYqWZl5YrO wQTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763504615; x=1764109415; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QKvebzST2buQwrtL7F9ca9a+LG6gPYB7JuXVc16J77E=; b=lt2oiOpUo88l0rLEEtlLs0QxLn29Z7lHnRYGRIbp988Eggaud1YzoGP8KyhjP8v6JU bG0OmAo5YpChaq54WrOlXN+WSwibbAIdXCK1befZ5WF5nESu6XN3/gLsFkzpS3XiCzpR 8TjR2N8CaTcC1ak28SYBCnwYO5gpU9ym7umKUPiF20dELXXCQ/TMI7u5ZMaPuY/rp5Rv YKXc4lIlPSsfv+reUBCofVvPeLT/+/LRr9473mBzCDHaF6WqSmK4NiZtVlcSgpLAauAE dhMIc9y+Nelslt1yC6vfTCL5V2kBASYZO/orZhJPqgMV12ifUykDMTa+7ddIM/HAPbdU L8nQ== X-Forwarded-Encrypted: i=1; AJvYcCW9FyO5x4RR0pwsRY6LP+KFRYqXBYvct58hluYUUQUxRvuQg+MZSLjjmwvMZoOuvB9oSSlwQkNZ7CV2Ow0=@vger.kernel.org X-Gm-Message-State: AOJu0YxBM/+mICmKIoi+ysq22bWIQqBpYgtoGFp+HwjLds4WANL93EoX KDiDdIVtYQAzc/Fo4MrInzqUSP8KHMe7usYZUWGx+1dl3z1qe/N7lyIdcYrvGD5kIh1eLeGGNbG xx1dGmw== X-Google-Smtp-Source: AGHT+IG+97mMZM2HDntRVzkJsusKs0yMXUhQxAwl0AvkRwKpYwsDYK71pux5+Yp/6nBGQe29LFs83wtH+Kw= X-Received: from plrt3.prod.google.com ([2002:a17:902:b203:b0:297:d4ca:8805]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:f691:b0:295:6a9:cb62 with SMTP id d9443c01a7336-2986a73b4a7mr217741885ad.35.1763504614611; Tue, 18 Nov 2025 14:23:34 -0800 (PST) Reply-To: Sean Christopherson Date: Tue, 18 Nov 2025 14:23:26 -0800 In-Reply-To: <20251118222328.2265758-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251118222328.2265758-1-seanjc@google.com> X-Mailer: git-send-email 2.52.0.rc1.455.g30608eb744-goog Message-ID: <20251118222328.2265758-3-seanjc@google.com> Subject: [PATCH v2 2/4] KVM: VMX: Handle #MCs on VM-Enter/TD-Enter outside of the fastpath From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini , "Kirill A. Shutemov" Cc: kvm@vger.kernel.org, x86@kernel.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, Rick Edgecombe , Jon Kohler , Tony Lindgren Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Handle Machine Checks (#MC) that happen on VM-Enter (VMX or TDX) outside of KVM's fastpath so that as much host state as possible is re-loaded before invoking the kernel's #MC handler. The only requirement is that KVM invokes the #MC handler before enabling IRQs (and even that could _probably_ be related to handling #MCs before enabling preemption). Waiting to handle #MCs until "more" host state is loaded hardens KVM against flaws in the #MC handler, which has historically been quite brittle. E.g. prior to commit 5567d11c21a1 ("x86/mce: Send #MC singal from task work"), the #MC code could trigger a schedule() with IRQs and preemption disabled. That led to a KVM hack-a-fix in commit 1811d979c716 ("x86/kvm: move kvm_load/put_guest_xcr0 into atomic context"). Note, vmx_handle_exit_irqoff() is common to VMX and TDX guests. Cc: Tony Lindgren Cc: Rick Edgecombe Cc: Jon Kohler Signed-off-by: Sean Christopherson Reviewed-by: Binbin Wu Reviewed-by: Tony Lindgren --- arch/x86/kvm/vmx/tdx.c | 3 --- arch/x86/kvm/vmx/vmx.c | 16 +++++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c index e6105a527372..2d7a4d52ccfb 100644 --- a/arch/x86/kvm/vmx/tdx.c +++ b/arch/x86/kvm/vmx/tdx.c @@ -1110,9 +1110,6 @@ fastpath_t tdx_vcpu_run(struct kvm_vcpu *vcpu, u64 ru= n_flags) if (unlikely((tdx->vp_enter_ret & TDX_SW_ERROR) =3D=3D TDX_SW_ERROR)) return EXIT_FASTPATH_NONE; =20 - if (unlikely(vmx_get_exit_reason(vcpu).basic =3D=3D EXIT_REASON_MCE_DURIN= G_VMENTRY)) - kvm_machine_check(); - trace_kvm_exit(vcpu, KVM_ISA_VMX); =20 if (unlikely(tdx_failed_vmentry(vcpu))) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index fdcc519348cd..f369c499b2c3 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -7062,10 +7062,19 @@ void vmx_handle_exit_irqoff(struct kvm_vcpu *vcpu) if (to_vt(vcpu)->emulation_required) return; =20 - if (vmx_get_exit_reason(vcpu).basic =3D=3D EXIT_REASON_EXTERNAL_INTERRUPT) + switch (vmx_get_exit_reason(vcpu).basic) { + case EXIT_REASON_EXTERNAL_INTERRUPT: handle_external_interrupt_irqoff(vcpu, vmx_get_intr_info(vcpu)); - else if (vmx_get_exit_reason(vcpu).basic =3D=3D EXIT_REASON_EXCEPTION_NMI) + break; + case EXIT_REASON_EXCEPTION_NMI: handle_exception_irqoff(vcpu, vmx_get_intr_info(vcpu)); + break; + case EXIT_REASON_MCE_DURING_VMENTRY: + kvm_machine_check(); + break; + default: + break; + } } =20 /* @@ -7528,9 +7537,6 @@ fastpath_t vmx_vcpu_run(struct kvm_vcpu *vcpu, u64 ru= n_flags) if (unlikely(vmx->fail)) return EXIT_FASTPATH_NONE; =20 - if (unlikely((u16)vmx_get_exit_reason(vcpu).basic =3D=3D EXIT_REASON_MCE_= DURING_VMENTRY)) - kvm_machine_check(); - trace_kvm_exit(vcpu, KVM_ISA_VMX); =20 if (unlikely(vmx_get_exit_reason(vcpu).failed_vmentry)) --=20 2.52.0.rc1.455.g30608eb744-goog From nobody Tue Dec 2 02:33:24 2025 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3F763115B1 for ; Tue, 18 Nov 2025 22:23:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763504618; cv=none; b=GuOaewcwiFfOSfwKJOT954Q5yh9MGrORZQf8MB7Kz4vszTbvSBpiu56TH5yBqWG8I2T1NXqqnEe3SiOK+6kRpeDoqUB+SA8SpY9ia/3+PLDMxBOrpHfnvzjvaN4ODOk9mL0ejEFPeT/t0KL0atMHAyxm/xFAPqJ1BnJyUp8Dj2Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763504618; c=relaxed/simple; bh=ZcXkqhGD9PzgbbKyCx8gdo8aDoDPwaqdJrHsFW+B7ME=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=j7L0jxtaxHrzrMYyKhHBVNx1MENGOsAFMEdEgkERjC7CIf8iCw9xMLaTUcK5PB5yWYlLKYlfWthcHTCmI3FdjxsBvbNTYXtfN26Nqz8L51yFw1Fnx7Xlk+T8Qtzxzux9nx+Avq7CCDhLAgDT1vk80gnU/jNFfwtyJXZ6V1r1NEg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=fitKYh4r; arc=none smtp.client-ip=209.85.214.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="fitKYh4r" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-2958a134514so78975095ad.2 for ; Tue, 18 Nov 2025 14:23:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1763504616; x=1764109416; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=sX0elw2DqT+JqQ8ikKrHK9opKrqwOpcjb2Urt9cPTN8=; b=fitKYh4rUgoAh4AGK8gz941IklbaeBCNjbsbygMBhW6ju3QURngAxvxpCJogguet4L BByvf5uMgHezP6PgADpBwsD2432erTy9R3FfY2tUGBngteMVev7HFHaOfPergyW5D7Nh Kf+OB5SMejXfqTIQ1bN6QXRPol+wbynvsgeoq+6Qy7abyEuB5xeoGl5QiFBxe7HGynAE L+xXCVImXuq2RLRhZDR0E7rozPyDfZr7Esfsl+UjBp9zCZvccBkRpwPjDWckrPfyQoHK 6pjTlKBNMKjt5VBJOjwZeJgTEFja9S3u3eXBUWuotd1NjhJXW7J+BuYKr6aVI6HSdHrP Cqcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763504616; x=1764109416; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sX0elw2DqT+JqQ8ikKrHK9opKrqwOpcjb2Urt9cPTN8=; b=MtvE0hrhkb6aTSGR/95OJWWa9wuuJ4d5EVlmJKSRXv/VeHiP/zxGGNGsrKma7ijEjd bqBhCoqDp7l5FGHhLtFEI9/T6yQ/oxTCFgOUsWtHWxJRB0wdFttUvxjSfDh/jPXe7wuK sKrdmFFnZWqwwln3KToZBOFLtFCO7PuxitSFPJCnVYbP8rbNn7vdTl5XRqRXVm68FiO1 K3PL3MQ3zubNZySBK0Notu29EZByfYXuboUmGoZYtokxauymxM4qERJR+jLOEckuMfzy 10+G2QyrTi6/8M/ahkw4llQcNMwAFHAl5btxXN2NlOlsGthKfWnZPdgtUP7PzBu5R2/B cFhQ== X-Forwarded-Encrypted: i=1; AJvYcCWe/ToRq8E46O2ByzMmKddSR2atD49XBlHorDhBZUZiW5shqWs1B3dFvVNsiSaK2IYUotjiRxnIccFhFNo=@vger.kernel.org X-Gm-Message-State: AOJu0YzGxZvP7Y/zmSrIoMrIpwCjKdvXETtd7aWv7gfUDysGyXhhH6lU NZ3dc75VxIifSvzfScz9awIQaGoA9HofffKNVwmne5H1MnXYgtKBlAwP7s6Z8+2GKU9ctsZtj6i M9Dzrhw== X-Google-Smtp-Source: AGHT+IHub6aQoEkwDwmYjltvKOLCy+EyIsxZ+4Fg008fmfhq1lkJD2yOYl4kqF1FuX4dDzXK27Kcuy57/mg= X-Received: from plop7.prod.google.com ([2002:a17:902:8a87:b0:273:67d3:6303]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:1211:b0:297:d6c1:26e with SMTP id d9443c01a7336-2986a6b7bd1mr211711575ad.6.1763504616132; Tue, 18 Nov 2025 14:23:36 -0800 (PST) Reply-To: Sean Christopherson Date: Tue, 18 Nov 2025 14:23:27 -0800 In-Reply-To: <20251118222328.2265758-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251118222328.2265758-1-seanjc@google.com> X-Mailer: git-send-email 2.52.0.rc1.455.g30608eb744-goog Message-ID: <20251118222328.2265758-4-seanjc@google.com> Subject: [PATCH v2 3/4] KVM: x86: Load guest/host XCR0 and XSS outside of the fastpath run loop From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini , "Kirill A. Shutemov" Cc: kvm@vger.kernel.org, x86@kernel.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, Rick Edgecombe , Jon Kohler , Tony Lindgren Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Move KVM's swapping of XFEATURE masks, i.e. XCR0 and XSS, out of the fastpath loop now that the guts of the #MC handler runs in task context, i.e. won't invoke schedule() with preemption disabled and clobber state (or crash the kernel) due to trying to context switch XSTATE with a mix of host and guest state. For all intents and purposes, this reverts commit 1811d979c716 ("x86/kvm: move kvm_load/put_guest_xcr0 into atomic context"), which papered over an egregious bug/flaw in the #MC handler where it would do schedule() even though IRQs are disabled. E.g. the call stack from the commit: kvm_load_guest_xcr0 ... kvm_x86_ops->run(vcpu) vmx_vcpu_run vmx_complete_atomic_exit kvm_machine_check do_machine_check do_memory_failure memory_failure lock_page Commit 1811d979c716 "fixed" the immediate issue of XRSTORS exploding, but completely ignored that scheduling out a vCPU task while IRQs and preemption is wildly broken. Thankfully, commit 5567d11c21a1 ("x86/mce: Send #MC singal from task work") (somewhat incidentally?) fixed that flaw by pushing the meat of the work to the user-return path, i.e. to task context. KVM has also hardened itself against #MC goofs by moving #MC forwarding to kvm_x86_ops.handle_exit_irqoff(), i.e. out of the fastpath. While that's by no means a robust fix, restoring as much state as possible before handling the #MC will hopefully provide some measure of protection in the event that #MC handling goes off the rails again. Note, KVM always intercepts XCR0 writes for vCPUs without protected state, e.g. there's no risk of consuming a stale XCR0 when determining if a PKRU update is needed; kvm_load_host_xfeatures() only reads, and never writes, vcpu->arch.xcr0. Deferring the XCR0 and XSS loads shaves ~300 cycles off the fastpath for Intel, and ~500 cycles for AMD. E.g. using INVD in KVM-Unit-Test's vmexit.c, which an extra hack to enable CR4.OXSAVE, latency numbers for AMD Turin go from ~2000 =3D> 1500, and for Intel Emerald Rapids, go from ~1300 =3D> ~1000. Cc: Jon Kohler Reviewed-by: Rick Edgecombe Reviewed-by: Jon Kohler Signed-off-by: Sean Christopherson --- arch/x86/kvm/x86.c | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index f98c5afa3e41..d8d547c5e014 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1216,13 +1216,12 @@ void kvm_lmsw(struct kvm_vcpu *vcpu, unsigned long = msw) } EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_lmsw); =20 -void kvm_load_guest_xsave_state(struct kvm_vcpu *vcpu) +static void kvm_load_guest_xfeatures(struct kvm_vcpu *vcpu) { if (vcpu->arch.guest_state_protected) return; =20 if (kvm_is_cr4_bit_set(vcpu, X86_CR4_OSXSAVE)) { - if (vcpu->arch.xcr0 !=3D kvm_host.xcr0) xsetbv(XCR_XFEATURE_ENABLED_MASK, vcpu->arch.xcr0); =20 @@ -1230,6 +1229,27 @@ void kvm_load_guest_xsave_state(struct kvm_vcpu *vcp= u) vcpu->arch.ia32_xss !=3D kvm_host.xss) wrmsrq(MSR_IA32_XSS, vcpu->arch.ia32_xss); } +} + +static void kvm_load_host_xfeatures(struct kvm_vcpu *vcpu) +{ + if (vcpu->arch.guest_state_protected) + return; + + if (kvm_is_cr4_bit_set(vcpu, X86_CR4_OSXSAVE)) { + if (vcpu->arch.xcr0 !=3D kvm_host.xcr0) + xsetbv(XCR_XFEATURE_ENABLED_MASK, kvm_host.xcr0); + + if (guest_cpu_cap_has(vcpu, X86_FEATURE_XSAVES) && + vcpu->arch.ia32_xss !=3D kvm_host.xss) + wrmsrq(MSR_IA32_XSS, kvm_host.xss); + } +} + +void kvm_load_guest_xsave_state(struct kvm_vcpu *vcpu) +{ + if (vcpu->arch.guest_state_protected) + return; =20 if (cpu_feature_enabled(X86_FEATURE_PKU) && vcpu->arch.pkru !=3D vcpu->arch.host_pkru && @@ -1251,17 +1271,6 @@ void kvm_load_host_xsave_state(struct kvm_vcpu *vcpu) if (vcpu->arch.pkru !=3D vcpu->arch.host_pkru) wrpkru(vcpu->arch.host_pkru); } - - if (kvm_is_cr4_bit_set(vcpu, X86_CR4_OSXSAVE)) { - - if (vcpu->arch.xcr0 !=3D kvm_host.xcr0) - xsetbv(XCR_XFEATURE_ENABLED_MASK, kvm_host.xcr0); - - if (guest_cpu_cap_has(vcpu, X86_FEATURE_XSAVES) && - vcpu->arch.ia32_xss !=3D kvm_host.xss) - wrmsrq(MSR_IA32_XSS, kvm_host.xss); - } - } EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_load_host_xsave_state); =20 @@ -11311,6 +11320,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) if (vcpu->arch.guest_fpu.xfd_err) wrmsrq(MSR_IA32_XFD_ERR, vcpu->arch.guest_fpu.xfd_err); =20 + kvm_load_guest_xfeatures(vcpu); + if (unlikely(vcpu->arch.switch_db_regs && !(vcpu->arch.switch_db_regs & KVM_DEBUGREG_AUTO_SWITCH))) { set_debugreg(DR7_FIXED_1, 7); @@ -11397,6 +11408,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) vcpu->mode =3D OUTSIDE_GUEST_MODE; smp_wmb(); =20 + kvm_load_host_xfeatures(vcpu); + /* * Sync xfd before calling handle_exit_irqoff() which may * rely on the fact that guest_fpu::xfd is up-to-date (e.g. --=20 2.52.0.rc1.455.g30608eb744-goog From nobody Tue Dec 2 02:33:24 2025 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C63831AF39 for ; Tue, 18 Nov 2025 22:23:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763504620; cv=none; b=IPZvPlPaMV9ALKGQ2WXNAZ1rNZJmURH4SgpNdBf3FdlK6WqI2GdKkBW7IdfJK7j0a9GpDCmGmPZlwGlgLt8Rg1TVAVgCH4vMSUt02NvFerLsSobePYOK/ISWTmGvZnt6EMiVUyvCykUR0OoIONCHX9BYMotDVSiUErrsPFZnWsU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763504620; c=relaxed/simple; bh=Z/DjTbMxxtwfS6uS1n7NXBorkMmU7tvMoEYXRuGPlFQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=lOWF2NaHigJIm6IuOKc8zmCPDbtLdjxygz838lktl14UHuLBxOLkGhhaCCKunq6hJrEDQHHHE0EkTb9etn5d/DbUqz3lY+hsM23eHQ2yRtwG1IjvZKiCUtCZjIoN7uRxhy3x3PrYJbFR+/WhyJPv9Rqo0Wc5U/oznr3IWLt96Pc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=gYqAVY++; arc=none smtp.client-ip=209.85.214.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="gYqAVY++" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-297dfae179bso147049845ad.1 for ; Tue, 18 Nov 2025 14:23:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1763504618; x=1764109418; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=k6abdiQWX2NNeyGNyymJ5zH7pnooPhs4/ECKEvEmQik=; b=gYqAVY++AYmR9LlTNHqD4/4FxcCOidwUoSPEoZQO19ddolzD/G9brsKUTsaGedrO8j wrIvaTJj3WJkhKKngxgKUbFOp9jI8aie3+N4h6c0ZkJ+NragRcu57M+g/lqXRJkHZU9h xhQ00FxtTPYcGxxg8pKRErllfVKDrWszmj2MXx0p2hKWwrFSw2YffwCjXogRdue4P/zo lAiQhCYUHH7v5+NHHq3VWmCCR2q4iRFBPf3wFAgwsGf0km/+qJy7hcu46olV6NuXghZl 0xj+zP8Ln9CjrU8SX4frSKrkIg+QYqE4TMmgVzgW0bt+4CWmQemEUCEJ/qrCqcGS3m73 QyJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763504618; x=1764109418; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=k6abdiQWX2NNeyGNyymJ5zH7pnooPhs4/ECKEvEmQik=; b=Cfe/hFMXMPbmUz0ExlPdb7Kf49Wx3ECVz7F7iK+yfm0ZgSLS2hL/Ou4ogBw2ktmF+W qGJETCxVBhTBmiffw4ptf+JNwj0IT3cEBP725/8d/mningWCazXGpc9U3hS2lWWXKJ4Z iuwQTBClo92zz+MfjHPIZhvz9IjO1KF20q+A4JH5iMj/YpkHcD0IJ+4mTUkfhjrUJuwN CoYGAHHZQBjbKG3+wjxKyBjKWFHtgbUNWKfIUPXKuNbmty9zErA6APcl39pDai2Ctn8o yv4Q9ffY4M/989qPuO3GtZsdnwtUsLSuKp9utttovgyJbZuHruUVa0jh8WzHJ0e+eyNm AHcA== X-Forwarded-Encrypted: i=1; AJvYcCWHS8HlYAidkvwwsgwr+VmYOK3zzIDkoWXu6k/Ta8skzZRySGpdqF/Uu41cI4E1mjzsjpUGM0EwoBnPMmI=@vger.kernel.org X-Gm-Message-State: AOJu0YwY22NsArJrA3a75grhxS2SCNfFMuficcixO/JWws03JiR1+Uag 4mu/NZUYldLJeeksr++uG0voZvNiHeZLPZhsg+/Lu4zzKlv/+leBy7BhqS+K4+pxJldo5G1OOQW 2j76gYQ== X-Google-Smtp-Source: AGHT+IGDcfTyticzqgBK5utKn+m9UElTi2gzKfFB2rNfhe1Y5J2SFjpR1n1x5g/sAvVBxZxGoKfHROFByYI= X-Received: from plbko13.prod.google.com ([2002:a17:903:7cd:b0:297:ddac:51ad]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:2b0e:b0:295:9d7f:9296 with SMTP id d9443c01a7336-29a054a857amr6014265ad.45.1763504617836; Tue, 18 Nov 2025 14:23:37 -0800 (PST) Reply-To: Sean Christopherson Date: Tue, 18 Nov 2025 14:23:28 -0800 In-Reply-To: <20251118222328.2265758-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251118222328.2265758-1-seanjc@google.com> X-Mailer: git-send-email 2.52.0.rc1.455.g30608eb744-goog Message-ID: <20251118222328.2265758-5-seanjc@google.com> Subject: [PATCH v2 4/4] KVM: x86: Load guest/host PKRU outside of the fastpath run loop From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini , "Kirill A. Shutemov" Cc: kvm@vger.kernel.org, x86@kernel.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, Rick Edgecombe , Jon Kohler , Tony Lindgren Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Move KVM's swapping of PKRU outside of the fastpath loop, as there is no KVM code anywhere in the fastpath that accesses guest/userspace memory, i.e. that can consume protection keys. As documented by commit 1be0e61c1f25 ("KVM, pkeys: save/restore PKRU when guest/host switches"), KVM just needs to ensure the host's PKRU is loaded when KVM (or the kernel at-large) may access userspace memory. And at the time of commit 1be0e61c1f25, KVM didn't have a fastpath, and PKU was strictly contained to VMX, i.e. there was no reason to swap PKRU outside of vmx_vcpu_run(). Over time, the "need" to swap PKRU close to VM-Enter was likely falsely solidified by the association with XFEATUREs in commit 37486135d3a7 ("KVM: x86: Fix pkru save/restore when guest CR4.PKE=3D0, move it to x86.c"= ), and XFEATURE swapping was in turn moved close to VM-Enter/VM-Exit as a KVM hack-a-fix ution for an #MC handler bug by commit 1811d979c716 ("x86/kvm: move kvm_load/put_guest_xcr0 into atomic context"). Deferring the PKRU loads shaves ~40 cycles off the fastpath for Intel, and ~60 cycles for AMD. E.g. using INVD in KVM-Unit-Test's vmexit.c, with extra hacks to enable CR4.PKE and PKRU=3D(-1u & ~0x3), latency numbers for AMD Turin go from ~1560 =3D> ~1500, and for Intel Emerald Rapids, go from ~810 =3D> ~770. Reviewed-by: Rick Edgecombe Reviewed-by: Jon Kohler Signed-off-by: Sean Christopherson --- arch/x86/kvm/svm/svm.c | 2 -- arch/x86/kvm/vmx/vmx.c | 4 ---- arch/x86/kvm/x86.c | 14 ++++++++++---- arch/x86/kvm/x86.h | 2 -- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index bf34378ebe2d..1c67c1a6771d 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -4246,7 +4246,6 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_= vcpu *vcpu, u64 run_flags) svm_set_dr6(vcpu, DR6_ACTIVE_LOW); =20 clgi(); - kvm_load_guest_xsave_state(vcpu); =20 /* * Hardware only context switches DEBUGCTL if LBR virtualization is @@ -4289,7 +4288,6 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_= vcpu *vcpu, u64 run_flags) vcpu->arch.host_debugctl !=3D svm->vmcb->save.dbgctl) update_debugctlmsr(vcpu->arch.host_debugctl); =20 - kvm_load_host_xsave_state(vcpu); stgi(); =20 /* Any pending NMI will happen here */ diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index f369c499b2c3..9b8a6405da95 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -7475,8 +7475,6 @@ fastpath_t vmx_vcpu_run(struct kvm_vcpu *vcpu, u64 ru= n_flags) if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) vmx_set_interrupt_shadow(vcpu, 0); =20 - kvm_load_guest_xsave_state(vcpu); - pt_guest_enter(vmx); =20 atomic_switch_perf_msrs(vmx); @@ -7520,8 +7518,6 @@ fastpath_t vmx_vcpu_run(struct kvm_vcpu *vcpu, u64 ru= n_flags) =20 pt_guest_exit(vmx); =20 - kvm_load_host_xsave_state(vcpu); - if (is_guest_mode(vcpu)) { /* * Track VMLAUNCH/VMRESUME that have made past guest state diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index d8d547c5e014..9586a26eb27e 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1246,7 +1246,7 @@ static void kvm_load_host_xfeatures(struct kvm_vcpu *= vcpu) } } =20 -void kvm_load_guest_xsave_state(struct kvm_vcpu *vcpu) +static void kvm_load_guest_pkru(struct kvm_vcpu *vcpu) { if (vcpu->arch.guest_state_protected) return; @@ -1257,9 +1257,8 @@ void kvm_load_guest_xsave_state(struct kvm_vcpu *vcpu) kvm_is_cr4_bit_set(vcpu, X86_CR4_PKE))) wrpkru(vcpu->arch.pkru); } -EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_load_guest_xsave_state); =20 -void kvm_load_host_xsave_state(struct kvm_vcpu *vcpu) +static void kvm_load_host_pkru(struct kvm_vcpu *vcpu) { if (vcpu->arch.guest_state_protected) return; @@ -1272,7 +1271,6 @@ void kvm_load_host_xsave_state(struct kvm_vcpu *vcpu) wrpkru(vcpu->arch.host_pkru); } } -EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_load_host_xsave_state); =20 #ifdef CONFIG_X86_64 static inline u64 kvm_guest_supported_xfd(struct kvm_vcpu *vcpu) @@ -11350,6 +11348,12 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) =20 guest_timing_enter_irqoff(); =20 + /* + * Swap PKRU with hardware breakpoints disabled to minimize the number + * of flows where non-KVM code can run with guest state loaded. + */ + kvm_load_guest_pkru(vcpu); + for (;;) { /* * Assert that vCPU vs. VM APICv state is consistent. An APICv @@ -11378,6 +11382,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) ++vcpu->stat.exits; } =20 + kvm_load_host_pkru(vcpu); + /* * Do this here before restoring debug registers on the host. And * since we do this before handling the vmexit, a DR access vmexit diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h index f3dc77f006f9..24c754b0db2e 100644 --- a/arch/x86/kvm/x86.h +++ b/arch/x86/kvm/x86.h @@ -622,8 +622,6 @@ static inline void kvm_machine_check(void) #endif } =20 -void kvm_load_guest_xsave_state(struct kvm_vcpu *vcpu); -void kvm_load_host_xsave_state(struct kvm_vcpu *vcpu); int kvm_spec_ctrl_test_value(u64 value); int kvm_handle_memory_failure(struct kvm_vcpu *vcpu, int r, struct x86_exception *e); --=20 2.52.0.rc1.455.g30608eb744-goog