Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp483046ybl; Fri, 6 Dec 2019 00:55:39 -0800 (PST) X-Google-Smtp-Source: APXvYqwQMHEEBuzXQOlwvscrELvL2gdinbjuxOCuf6X6eGBuQWuGpzQ1gklwmkMMs4ChPbB2QZ4f X-Received: by 2002:a05:6830:18cd:: with SMTP id v13mr9596168ote.118.1575622539197; Fri, 06 Dec 2019 00:55:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575622539; cv=none; d=google.com; s=arc-20160816; b=bzMSymAJuGqgZTky17aSQmsxh9VlkELcqs2fidzxTWt87/gqM+fZ/WKGcBwLZ+ko2t ePfv2j5JtXGAxay/BdrmU9Cbz/NJIOcwUSY/5jvGAp2a7bLiOESgPM4O39NUUWJ6POwb G1ihuXoUZAmNPE2OVUOPbCz9NveRp91OaOIy9nQMvyoGcdhr94ikBbJo8ZN8hgMr32EB WL5htFBUfPd0vJEU6OTZshLQS6FaC9vL8Ldfibtp3beLk8tSj4Z12umiKL6513snExsb hW8sVaoCwGqBLIjUCycB+bSQdFRhHey/+3bGAzsTMoWBZtiyfbF5wQodWiB1y9t6+hoN rQCg== 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:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=3gYEsWmy4JuBzTSatOZIC7YaHvzWd9GrO4iSAH/St48=; b=y4gANORCPsmc9Mka7W+HoZfgvN5YCo4mTKSKOeJszWWEK7YCAC6tiVCFvmq8njldDQ RwxneL5mPsW75xo9M2SNB1N/Vcx9lM9MkzLCPJ9EmWWq7sC5TVKMUnenPVaU0UXLg+oL XTt8km/Kwk0aGIiqR4Gmth4/3woZ4T+oiC8ynQQemxoxFaHmAiRjAeAbSi9dRgMwUU5V tSHZzTufI9SJd1Kn5hqdWP9QMz+P/7PqLZ5MZ0fTZuYWJDrFCQ3TzudoDVc6JezHbD9J Ji2vAnY+hHRCHnomdy/b6ri0c6YPHLPmtOD9VlyJ1tmHG9TJha+IwD5TCNFmFGbho47/ iEBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="mZ/H32HN"; 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 v14si2563159oto.127.2019.12.06.00.55.26; Fri, 06 Dec 2019 00:55:39 -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="mZ/H32HN"; 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 S1726258AbfLFIyu (ORCPT + 99 others); Fri, 6 Dec 2019 03:54:50 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:42545 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725966AbfLFIyu (ORCPT ); Fri, 6 Dec 2019 03:54:50 -0500 Received: by mail-lf1-f67.google.com with SMTP id y19so4647005lfl.9; Fri, 06 Dec 2019 00:54: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 :content-transfer-encoding; bh=3gYEsWmy4JuBzTSatOZIC7YaHvzWd9GrO4iSAH/St48=; b=mZ/H32HNjhBtmGVGVzYUoONZ3TdIjQkkOAdG0A6R0KbrKngB69GYZTX5vYNgqXTXkp hrHG1sPKReq2zSTcEADqVOeSQentFypuxj7zP9QUAgdexgptroVnLqnrfil5byypjKs+ 26vXMS+Ug/0jPkrtNyVV1/QSAbMs/0YbwrHiu5rEl2sT3G7brsWS9n6CV3sTxL2/temW xDz5E+2Jl1D2fYm6ozZu2aSsrwtRBnaiOlExIwfYkJIgC+X0w13Cq8FNQHTc+z4r+z2e 1fbkKXx5NAf0LZxabslDnTrDJMw3ugiH5W1JB6XWjVCgFmjcv2tLYBmcTILz/DAjIrhU dqxw== 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:content-transfer-encoding; bh=3gYEsWmy4JuBzTSatOZIC7YaHvzWd9GrO4iSAH/St48=; b=XGdYgvWSiuTLnsZZ53IMgs0Gxevqm5He5MYAJCYWMf2VrVxco8Rh4M+xwvOpGzUCBB 8oAQ3hOeqztXRF7ZoyosAtc84Q6ggVlqd96Yu8KvYTJeO467cOThfVP393ZTFhK96pxj +GTOsDhd+Bt1MlCCdh5l6RZABo+D+s/zav9qkUG1prNBrN6UzAF3fQTGaErce+O25KHp bI5O75JV1s7VdVHkgurKEWjNTdxu19k1I6WH/4AJKp4zFMoJBpB8xcdNhN2RyVG/834A s12tRBTECGXUGa9PAA9DJvQUnw8ZC0GcUOOKUZA6+FSgQy0aqO37H4Pj/nYbRbYjNTTx fgYw== X-Gm-Message-State: APjAAAWZg0zmuqB7vDLOqF9jYwFlt9J0iRG5VDBHHjUZmrdDodkf3xoz ewfI3tX52dD4EZG7w+f/jSoM3R8Z4WiBkpyGJjk= X-Received: by 2002:ac2:4422:: with SMTP id w2mr7575453lfl.178.1575622486717; Fri, 06 Dec 2019 00:54:46 -0800 (PST) MIME-Version: 1.0 References: <20191127203114.766709977@linuxfoundation.org> <20191127203119.676489279@linuxfoundation.org> <20191204175033.smve4dleem2ht7st@xps.therub.org> <20191205205206.2mnr3dj2slamuhrl@xps.therub.org> In-Reply-To: <20191205205206.2mnr3dj2slamuhrl@xps.therub.org> From: Jack Wang Date: Fri, 6 Dec 2019 09:54: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: Jack Wang , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, stable , Sean Christopherson , Jim Mattson , Paolo Bonzini , 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 Dan Rue =E4=BA=8E2019=E5=B9=B412=E6=9C=885=E6=97=A5=E5= =91=A8=E5=9B=9B =E4=B8=8B=E5=8D=889:52=E5=86=99=E9=81=93=EF=BC=9A > > On Thu, Dec 05, 2019 at 10:51:18AM +0100, Jack Wang wrote: > > Dan Rue =E4=BA=8E2019=E5=B9=B412=E6=9C=884=E6=97= =A5=E5=91=A8=E4=B8=89 =E4=B8=8B=E5=8D=886:50=E5=86=99=E9=81=93=EF=BC=9A > > > > > > On Mon, Dec 02, 2019 at 03:40:04PM +0100, Jack Wang wrote: > > > > Greg Kroah-Hartman =E4=BA=8E2019=E5=B9= =B411=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_vm= x_run()") > > > > > 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 ski= pped. > > > > > > > > > > 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_vm= x_run()") > > > > > 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_apic= v_active(vcpu)) > > > > > evaluate_pending_interrupts |=3D vmx_has_apicv_in= terrupt(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_CON= TROLS)) > > > > > @@ -12836,13 +12839,6 @@ static int nested_vmx_run(struct kvm_vcp= u *vcpu, 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_STAT= E, exit_qual); > > > > > - return 1; > > > > > - } > > > > > - > > > > > /* > > > > > * We're finally done with prerequisite checking, and can= start 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: > > > > > > Hi Jack - can you be more specific about the failing tests? What type= of > > > environment and which tests failed, which version of kvm-unit-tests? = Do > > > you have any logs available? I ask because we do run kvm-unit-tests o= n > > > x86 and arm64 but we did not see these regressions. > > > > > > Thanks, > > > Dan > > > > > Hi Dan, > > > > I'm running at kvm-unit-tests commit b1414c5f0142 ("x86: vmx: fix > > required alignment for posted interrupt descriptor") > > > > using "run_tests.sh -a -t -j8" with qemu-2.7.1 > > > > Left side has only 78 tests ok, and right side has 112 tests ok. > > Thanks - so we run it with "run_tests.sh -v" and only see 43 passes in > the best case. Besides missing -a, we see a skip for the vmx related > tests because vmx isn't enabled in our environment. > > We will fix those problems in LKFT so that we can catch regressions like > this before they are released. > > Dan Sounds good. Thanks, Jack