Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1092908ybl; Tue, 3 Dec 2019 01:22:30 -0800 (PST) X-Google-Smtp-Source: APXvYqx0EwgyWEqxQZ++xatlNbZMpCU4ubvYww01jHeSv4RSo/IBcdl8xnJT73I4Ii6UdLZkrecn X-Received: by 2002:a9d:6f85:: with SMTP id h5mr2455605otq.19.1575364950574; Tue, 03 Dec 2019 01:22:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575364950; cv=none; d=google.com; s=arc-20160816; b=MMqxxeidZMn/yH/nqsSD/zXBxYnigcyduFPUfZ+vhs/rdpQ90jmq6dnF0I3zqMFEV1 6UxNH50gbIXzszoYnIMn9FJ9RRF4QFkZjFXrZvbSe++U6yaQt0AWbxr3Q0Jtn40V4Klx SxhGsWxUHgB9+MaTqRDbI/wrWzUSD5/s36j0EGFqHN29ppQ+U/IyihvLVRi2TlyPGPjU m5Hktb3hEKBazrNCR9UjpUhXKHeNd+qIXC7TdF0sqpJ4ft++znqWrVU3BXcynnIAArAN v7jSPUg6BvF74+pG59UzaW7BvWt5OFE2n4JV5VpRE9oTgqqM3juR8qekN1tIkpAKhjHC fftw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=pLfHU77WwXfBD7pMGsHDD+p0Rc83y3B7FwHLS1IWzvM=; b=TifvU4nFsseIOUHYo/nL+VMLYnPR7paH7mLDGlPLx04Uj25b/XQouoca//lmlq4D/Y WCedwci6cJp5EQ3beNi9v4drzEZPT0r/miK15/NMQt1FPfv7+//+pbOTT8kowTXPwGOB vQw7dWrn8REkbMaGIaLLP/u5OySQvxg4HI/0uLdGAEhqh5RYBRLoqkNIlxfO7hLs5Ftr nJUTJOh3E3jyCP1X3qb/WFFkiLrSIlJI/ZaWArwyvH+Go0wG9kcQJAgAS2heCl09FpB6 7kP6vW0u61FKoh0W+ppnaALiGvVRHjMmuDFjlxxFOTb961gTYyWcnqJkuBy5Ef73XWtB IdVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vKNBsT21; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s17si844894otr.155.2019.12.03.01.22.17; Tue, 03 Dec 2019 01:22:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vKNBsT21; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725957AbfLCJVt (ORCPT + 99 others); Tue, 3 Dec 2019 04:21:49 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:32780 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725773AbfLCJVt (ORCPT ); Tue, 3 Dec 2019 04:21:49 -0500 Received: by mail-lj1-f194.google.com with SMTP id 21so2968010ljr.0; Tue, 03 Dec 2019 01:21:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=pLfHU77WwXfBD7pMGsHDD+p0Rc83y3B7FwHLS1IWzvM=; b=vKNBsT21J8ZmTFIfzJUai/Q0kXssW+UxkGC9gBvpLdAWujf4C9mtZg5wyJod34zHVz 2Xm1P/mB7YLsDu6PGRTVByJ8K42r/MZfieEAH2562lTwZ1zIkV6xnni9SX2uxggdu1KO zAdVLRgxSJwRk64WOb9GdRmYNGA3hHdZ6aumVb/G8F8XbB6kCmVBx68IfUo4WtPV0jaD +I/LqFeDEYDb+Djhq1LEKNXgCClVX7Hea6gjted+KiUC2CHunBEr6ekEihOzspcxEh3H 9K2cGrtaZPfrXy7EN6gGeECpZMx9elUofjywOvoFhG9gXqOa0vDqw/zgGcU+YRzQMAi8 29lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=pLfHU77WwXfBD7pMGsHDD+p0Rc83y3B7FwHLS1IWzvM=; b=ibuaTkoZAuJeHOO44a1Dj2OSGwUmfyOByZHcuaTpTrcP+FdPaOqGTPmBCjecYYpNed hJ0TRGaiaGy9H5CE92w8FKZ+sxJ0zwzrfGy1Xot58cvnSnzOnwf2HaFdUtLyy7T81bHq PWBe0H5qiEdwaRIZRbfLteU1AJcLlhKtZaH8O1zV/EfE14Qhai5DpOClIHUA07fEFpfS D7SAwAJUGY5l8IkoflNf3MNP/i1MxjDUDCBxT4JKWYtHbpRNPf32MzKOWA7pGPtyyQZx DVe9yAwb9SkGA4HrY5gjcwHHmlRiIPcKMoDFoOrWIwLziSWMk1RNzC8EvMIsZpB2Vktp tcgQ== X-Gm-Message-State: APjAAAWCj0Mk/EtiOIMOltYOSj13JC1xe5Z2JruhrnYFeLpXRwBKtz8B uA7HTyBi5BZClKyvDjwCd7BT9hejQWiCOX0LFGrCsqxthBs= X-Received: by 2002:a2e:9093:: with SMTP id l19mr1668457ljg.235.1575364906310; Tue, 03 Dec 2019 01:21:46 -0800 (PST) MIME-Version: 1.0 References: <20191127203114.766709977@linuxfoundation.org> <20191127203119.676489279@linuxfoundation.org> <20191202145105.GA571975@kroah.com> In-Reply-To: From: Jack Wang Date: Tue, 3 Dec 2019 10:21:35 +0100 Message-ID: Subject: Re: [PATCH 4.19 067/306] KVM: nVMX: move check_vmentry_postreqs() call to nested_vmx_enter_non_root_mode() To: Paolo Bonzini Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, stable , Sean Christopherson , Jim Mattson , Sasha Levin Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Paolo Bonzini =E4=BA=8E2019=E5=B9=B412=E6=9C=882=E6= =97=A5=E5=91=A8=E4=B8=80 =E4=B8=8B=E5=8D=884:09=E5=86=99=E9=81=93=EF=BC=9A > > On 02/12/19 15:51, Greg Kroah-Hartman wrote: > > On Mon, Dec 02, 2019 at 03:40:04PM +0100, Jack Wang wrote: > >> Greg Kroah-Hartman =E4=BA=8E2019=E5=B9=B4= 11=E6=9C=8827=E6=97=A5=E5=91=A8=E4=B8=89 =E4=B8=8B=E5=8D=8810:30=E5=86=99= =E9=81=93=EF=BC=9A > >>> > >>> From: Sean Christopherson > >>> > >>> [ Upstream commit 7671ce21b13b9596163a29f4712cb2451a9b97dc ] > >>> > >>> In preparation of supporting checkpoint/restore for nested state, > >>> commit ca0bde28f2ed ("kvm: nVMX: Split VMCS checks from nested_vmx_ru= n()") > >>> modified check_vmentry_postreqs() to only perform the guest EFER > >>> consistency checks when nested_run_pending is true. But, in the > >>> normal nested VMEntry flow, nested_run_pending is only set after > >>> check_vmentry_postreqs(), i.e. the consistency check is being skipped= . > >>> > >>> Alternatively, nested_run_pending could be set prior to calling > >>> check_vmentry_postreqs() in nested_vmx_run(), but placing the > >>> consistency checks in nested_vmx_enter_non_root_mode() allows us > >>> to split prepare_vmcs02() and interleave the preparation with > >>> the consistency checks without having to change the call sites > >>> of nested_vmx_enter_non_root_mode(). In other words, the rest > >>> of the consistency check code in nested_vmx_run() will be joining > >>> the postreqs checks in future patches. > >>> > >>> Fixes: ca0bde28f2ed ("kvm: nVMX: Split VMCS checks from nested_vmx_ru= n()") > >>> Signed-off-by: Sean Christopherson > >>> Cc: Jim Mattson > >>> Reviewed-by: Jim Mattson > >>> Signed-off-by: Paolo Bonzini > >>> Signed-off-by: Sasha Levin > >>> --- > >>> arch/x86/kvm/vmx.c | 10 +++------- > >>> 1 file changed, 3 insertions(+), 7 deletions(-) > >>> > >>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > >>> index fe7fdd666f091..bdf019f322117 100644 > >>> --- a/arch/x86/kvm/vmx.c > >>> +++ b/arch/x86/kvm/vmx.c > >>> @@ -12694,6 +12694,9 @@ static int enter_vmx_non_root_mode(struct kvm= _vcpu *vcpu, u32 *exit_qual) > >>> if (likely(!evaluate_pending_interrupts) && kvm_vcpu_apicv_ac= tive(vcpu)) > >>> evaluate_pending_interrupts |=3D vmx_has_apicv_interr= upt(vcpu); > >>> > >>> + if (from_vmentry && check_vmentry_postreqs(vcpu, vmcs12, exit= _qual)) > >>> + return EXIT_REASON_INVALID_STATE; > >>> + > >>> enter_guest_mode(vcpu); > >>> > >>> if (!(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_DEBUG_CONTROL= S)) > >>> @@ -12836,13 +12839,6 @@ static int nested_vmx_run(struct kvm_vcpu *v= cpu, bool launch) > >>> */ > >>> skip_emulated_instruction(vcpu); > >>> > >>> - ret =3D check_vmentry_postreqs(vcpu, vmcs12, &exit_qual); > >>> - if (ret) { > >>> - nested_vmx_entry_failure(vcpu, vmcs12, > >>> - EXIT_REASON_INVALID_STATE, e= xit_qual); > >>> - return 1; > >>> - } > >>> - > >>> /* > >>> * We're finally done with prerequisite checking, and can sta= rt with > >>> * the nested entry. > >>> -- > >>> 2.20.1 > >>> > >>> > >>> > >> Hi all, > >> > >> This commit caused many kvm-unit-tests regression, cherry-pick > >> following commits from 4.20 fix the regression: > >> d63907dc7dd1 ("KVM: nVMX: rename enter_vmx_non_root_mode to > >> nested_vmx_enter_non_root_mode") > >> a633e41e7362 ("KVM: nVMX: assimilate nested_vmx_entry_failure() into > >> nested_vmx_enter_non_root_mode()") > > > > Now queued up, thanks! > > > > greg k-h > > > > Why was it backported anyway? Can everybody please just stop applying > KVM patches to stable kernels unless CCed to stable@vger.kernel.org? > > I thought I had already asked Sasha to opt out of the autoselect > nonsense after catching another bug that would have been introduced. > > Paolo > Hi Paolo, Should we simply revert the patch, maybe also 9fe573d539a8 ("KVM: nVMX: reset cache/shadows when switching loaded VMCS") Both of them are from one big patchset: https://patchwork.kernel.org/cover/10616179/ Revert both patches recover the regression I see on kvm-unit-tests. Thanks, Jack Wang