Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1100521ybl; Tue, 3 Dec 2019 01:32:18 -0800 (PST) X-Google-Smtp-Source: APXvYqx2JI5HIQbwEHN2fund7G0nMxv5EVOzToPz2inAdiDnNIZU0HUUh8KYAvjQ7WNNgbqqm9gT X-Received: by 2002:a05:6830:1e30:: with SMTP id t16mr287943otr.220.1575365538207; Tue, 03 Dec 2019 01:32:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575365538; cv=none; d=google.com; s=arc-20160816; b=sJtWBNfs0ITi4MUrKW10T8iwpY/UWF/HhHLcoBJLN2AryVLyCB/ux8nENqHD6uWGfa YwsNdgYI8GPp5UTUhl0IyjcLsIcMZu2itqsxSNo1iicUatLC3+spqhQUzCqJHxk1VTCi HPhjWyIID/f78cJ7FBvuRMfZ4vbL52ztegfRvGO23rfE4rTKmccQfNNmoaGxDlu/XYJm /47qqYIWGYcElStG/Xui9Y55I5nDx7GxyehCtrJN7a5fE2NfiqToWiM13Jp2HBeLs6r1 sw2ClXcPr8iAXABA3PzPZYTEuyGZIIh8HdnIP7/g4UU3XiLFbF7d4LY5XN3A2DCcO2Uz UfPw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=ccF0ajXP8HBc8ijEIbPxb/SW3cou8LZhbpgUuAl6x/w=; b=mI2GLKMpqjnHahqu7oLEu2qTn2JZEbwr/3aDLal67jIeRPx82O05L8efBXcqz3cT32 DU8LLAGbjDatsx578EPuTR/OUIRjqfCx2vtpM4zCAjKVWdGsDnZxIEg8t4Vrh3Aw3wNj drbt1ZK3glJ2mey3ve/MAPrtbZNV+b00tC5EXqXC4ErHWlfKUENmlgkLHcrzKNS8EuhJ ZapPDDu6zs6OztowRQtRrNA7VMPoPDKSoPVq/ayQ4q8ezRJfCazm8ZqbOFLwgZkDjFwq 6NSB7477/lMSEpglOX02gfQ/AKym/y5cIRy6vNhH/MTgrSVAIzaJozO1vLcyppeYvGLk 45lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Nd1rHXvt; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e26si905712otp.143.2019.12.03.01.32.05; Tue, 03 Dec 2019 01:32:18 -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=@redhat.com header.s=mimecast20190719 header.b=Nd1rHXvt; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726098AbfLCJbY (ORCPT + 99 others); Tue, 3 Dec 2019 04:31:24 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:58292 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725957AbfLCJbY (ORCPT ); Tue, 3 Dec 2019 04:31:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575365480; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ccF0ajXP8HBc8ijEIbPxb/SW3cou8LZhbpgUuAl6x/w=; b=Nd1rHXvt1HPan8I5V8/39qYJAAOBbLOGc2hP5EzXSEZ3oPdSXgm98lLZXVF3NZLFu7GEny d2WvN0I2pINAoBwMp9RCbN15UTWk44vLG50PW//inwB9go2ZKR6s9uOMLNE/gpzWY25s8f 3ciRHwqeJ49fqeer+iLQAdn+jduJ54E= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-432-BgxgNBrxPqWR3axuKaItxw-1; Tue, 03 Dec 2019 04:31:17 -0500 Received: by mail-wr1-f72.google.com with SMTP id t3so1441489wrm.23 for ; Tue, 03 Dec 2019 01:31:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=pqLIE58UAw3dvThIrcQE32eMUDCSJr2Vnkr2jVztGkA=; b=C/nHTwQfZHL6n4x/5qtIMhUPLP7Z0qH8yN3NwJtm7ocw8yleGVXWpK6uvJhXhHFGSp MPeCkWfyUOoP3OJ6kYsiOUNEVpvE63cZxg+ZS7fzaPCwMEEqSU9Sa75g+CX0LUM/SDm/ bH4C+Og5eriJNmluHUemlWWEbLXgt+f/Hc29hmNqWDzEU1UlYKqpJhdyb2gp+41IsYoA MBEoQBm35JJrIP1EHH5yigGxMVLzZnoCb+TM9Q/9l2xTKBm8jV5u4sBD9c7peFTLQYgD 6Olvn9rRpF/qP69NdL2fgA3B4Dx9HbzExYzkpIZDmrrwxJIKwAYOcwRJ/B/cjn2vLWTO a7xg== X-Gm-Message-State: APjAAAWadGZboNF4qwVAEzSvW8JUIPZOV9LNWWl9HlFG+RhdtaGwBihx y+azjsmnMwuaTsbj5PuU2PpJRVpR5iTz8d2MUMd0cZZOxOtBZjKb69zL1qYi1rhRevK8hB/qDP2 8e+5ZrUvpMocc0ZbFzSZfXYsK X-Received: by 2002:a1c:2745:: with SMTP id n66mr32903744wmn.171.1575365475980; Tue, 03 Dec 2019 01:31:15 -0800 (PST) X-Received: by 2002:a1c:2745:: with SMTP id n66mr32903710wmn.171.1575365475660; Tue, 03 Dec 2019 01:31:15 -0800 (PST) Received: from ?IPv6:2001:b07:6468:f312:8dc6:5dd5:2c0a:6a9a? ([2001:b07:6468:f312:8dc6:5dd5:2c0a:6a9a]) by smtp.gmail.com with ESMTPSA id r6sm2783864wrv.40.2019.12.03.01.31.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Dec 2019 01:31:15 -0800 (PST) Subject: Re: [PATCH 4.19 067/306] KVM: nVMX: move check_vmentry_postreqs() call to nested_vmx_enter_non_root_mode() To: Jack Wang Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, stable , Sean Christopherson , Jim Mattson , Sasha Levin References: <20191127203114.766709977@linuxfoundation.org> <20191127203119.676489279@linuxfoundation.org> <20191202145105.GA571975@kroah.com> From: Paolo Bonzini Message-ID: <828cf8b7-11ac-e707-57b6-cb598cc37f1b@redhat.com> Date: Tue, 3 Dec 2019 10:31:13 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-MC-Unique: BgxgNBrxPqWR3axuKaItxw-1 X-Mimecast-Spam-Score: 0 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 On 03/12/19 10:21, Jack Wang wrote: > 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, >=20 > Should we simply revert the patch, maybe also > 9fe573d539a8 ("KVM: nVMX: reset cache/shadows when switching loaded VMCS"= ) >=20 > Both of them are from one big patchset: > https://patchwork.kernel.org/cover/10616179/ >=20 > Revert both patches recover the regression I see on kvm-unit-tests. Greg already included the patches that the bot missed, so it's okay. Paolo