Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp2746218rwa; Mon, 22 Aug 2022 12:58:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR4Bo+SPwyNofW6Nzj/nwK/zw0TuIWrJ1RXHWUxngixdedgvOihaFg6nL68L8yrq1zbUDcc9 X-Received: by 2002:a17:90b:4b0d:b0:1fa:e712:dd53 with SMTP id lx13-20020a17090b4b0d00b001fae712dd53mr24621pjb.10.1661198339511; Mon, 22 Aug 2022 12:58:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661198339; cv=none; d=google.com; s=arc-20160816; b=d1NolMgw/wa42UuTfIcV7XsEWGvloap6GnEJMTYJNBrwpWYhwznyGa40m+maXiQXB1 Qspx8NrslcYhW4JOZYtfptWyf1+VH4pM4E3VmudvN1XyehpseVoL02evQnWUW8LeHJvm e5lxIgB1O110epBVtFVUHnCuID6wZod2+36FBgAIuVnL/gl6UtbqgKoPALIxehEVCWFR lEBfZE735alUQTUG/jrl/fHjbU5nLnSG7KWrGWqez+7s9WdoY7PnFYpNJ2e4FsCMlE5T lw1VhN7CyfziClTjktPDMMEE9Wy9Ou+hQTJaM57m9Rm9nIOMZPK8iJXursjUpljiL53j FHXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=PrW6FQ33VHjaFPww6I50ua2R22m09A1ZPI8tkRBeC24=; b=doy9ZlIwnH2qoWPesaDrgS1bo0jRV1s+tUYeAJYVferYrI9s02pAIW7/gUCNQ9RGn/ busqWCgeQuUdW2sy3e4LLpG0IVqnGb81JzGdHHFIxo9WLvDmtG64awuXRxF1g9LVKM6I C9F1QJoFN3MXBFo+jRoKTb6p0Zxq+m7qS0mcwPd1vhMb01Sfu9+Cp83BYdUTylINrmr3 sedPDLdLMIj0CQE5dUcdV5r1dQaX95EkId5A+VmyORfLrpmzRLCMIkMDa+FK0O42txfS 1HUJngz9k3+3X8YqWvOulHWHT1YbXfpGUfU68I4rZtEac8fXtU8jz3XarmGevYWpVr+K c6rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gcx7Msun; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x8-20020a1709029a4800b0016ef08c1e69si20800plv.169.2022.08.22.12.58.48; Mon, 22 Aug 2022 12:58:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gcx7Msun; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S238497AbiHVTkS (ORCPT + 99 others); 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-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 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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