From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9CF7C32774 for ; Mon, 22 Aug 2022 19:40:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238713AbiHVTkS (ORCPT ); Mon, 22 Aug 2022 15:40:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbiHVTkP (ORCPT ); Mon, 22 Aug 2022 15:40:15 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE79E48C98 for ; Mon, 22 Aug 2022 12:40:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661197213; 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=PrW6FQ33VHjaFPww6I50ua2R22m09A1ZPI8tkRBeC24=; b=gcx7MsunA/CMM8NCimBb+VixL02T5bkPs9btTbg0E+sYFyiombz9lxLMZGc0GNL82H/UbU GVoLz3IJTJvQ9auA7DFFpkDkY/ysx8sjXHJkVCOwvYx1jgkba7qxkZQQr4TXkBTYKhpwJq XWlRAwmQD9qLkLJQlvF4OPTvgZ03Eqo= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-255-bB_aq8HVOniIc-CcaogKkQ-1; Mon, 22 Aug 2022 15:40:11 -0400 X-MC-Unique: bB_aq8HVOniIc-CcaogKkQ-1 Received: by mail-ed1-f70.google.com with SMTP id x3-20020a05640226c300b00446ad76aeb5so2730259edd.8 for ; Mon, 22 Aug 2022 12:40:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=PrW6FQ33VHjaFPww6I50ua2R22m09A1ZPI8tkRBeC24=; b=Vlxfsxx1vHtOdPiytrv+cF4T28xZHhWYliHZPz083USf6XXP5+/RggM5g3Rt2sVu0E YjM/eCIvr6zXMg5+zaXHYOwmJwfSQl10oyGu2JZQrGsv5mLDbjHd2nESUaXcYX4K3n97 kMFWomzkbu3/gUOVpJae814Uo0VDetLLykalmfMBGp2HUKAfW4XcKFhSApb6dlJ6Mnoz DJBMwJFjoJnSBxXatC7FThlPY5j6ceSdsgu03HQsunr8FoCG93ohJ62VBymYK51xycgk kC9N7ao7Ywg+gQuX1fwR8Ltjb9HoRPwG5dbXufzF16qUGizz8cfh/Dzs5p2KLKKu7SxX URLw== X-Gm-Message-State: ACgBeo1YbtrDhHelWKclTgB2MtBs26Xge5nQmuEXLpKzmgUNfHGCOHBv w7rQ8i0qXAgUId2v2BPKCT0BXDYO8km2X/b8fOP2FV1S7HvCq42rpDXi60yswPLUP50FSuJ24t7 TNgX879Vjx4ib7Wqf4m7ncMsV X-Received: by 2002:a17:906:eecb:b0:73c:5bcb:8eb3 with SMTP id wu11-20020a170906eecb00b0073c5bcb8eb3mr12429535ejb.284.1661197210456; Mon, 22 Aug 2022 12:40:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR4niDRL1RcFobHgT2AB075N+mpNaqURdq6mZbMNFfEFmFM9xPuItdS4fWDKpGE3WRVJj+XW2A== X-Received: by 2002:a17:906:eecb:b0:73c:5bcb:8eb3 with SMTP id wu11-20020a170906eecb00b0073c5bcb8eb3mr12429529ejb.284.1661197210269; Mon, 22 Aug 2022 12:40:10 -0700 (PDT) Received: from ?IPV6:2001:b07:6468:f312:9af8:e5f5:7516:fa89? ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.googlemail.com with ESMTPSA id v1-20020a50d081000000b0043a7c24a669sm160532edd.91.2022.08.22.12.40.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 22 Aug 2022 12:40:09 -0700 (PDT) Message-ID: <4edc98dc-31b4-bfb4-bb8e-4b453b006dec@redhat.com> Date: Mon, 22 Aug 2022 21:40:08 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH v3 3/7] KVM: nVMX: Make an event request when pending an MTF nested VM-Exit Content-Language: en-US To: Jim Mattson Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, mlevitsk@redhat.com, seanjc@google.com, stable@vger.kernel.org References: <20220822170659.2527086-1-pbonzini@redhat.com> <20220822170659.2527086-4-pbonzini@redhat.com> From: Paolo Bonzini In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/22/22 19:52, Jim Mattson wrote: > On Mon, Aug 22, 2022 at 10:08 AM Paolo Bonzini wrote: >> >> From: Sean Christopherson >> >> Set KVM_REQ_EVENT when MTF becomes pending to ensure that KVM will run >> through inject_pending_event() and thus vmx_check_nested_events() prior >> to re-entering the guest. >> >> MTF currently works by virtue of KVM's hack that calls >> kvm_check_nested_events() from kvm_vcpu_running(), but that hack will >> be removed in the near future. Until that call is removed, the patch >> introduces no functional change. >> >> Fixes: 5ef8acbdd687 ("KVM: nVMX: Emulate MTF when performing instruction emulation") >> Cc: stable@vger.kernel.org >> Signed-off-by: Sean Christopherson >> Reviewed-by: Maxim Levitsky >> Signed-off-by: Paolo Bonzini >> --- > What happens if live migration occurs before the KVM_REQ_EVENT is processed? Good point, this must be squashed in: diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index ab135f9ef52f..a703b71d675d 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -6481,6 +6481,8 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu, if (ret) goto error_guest_mode; + if (vmx->nested.mtf_pending) + kvm_make_request(KVM_REQ_EVENT, vcpu); return 0; error_guest_mode: so that the other side restores the request. Paolo