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 X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA992C433E0 for ; Thu, 7 Jan 2021 18:00:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C1AD2233FD for ; Thu, 7 Jan 2021 18:00:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729088AbhAGSAn (ORCPT ); Thu, 7 Jan 2021 13:00:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728273AbhAGSAn (ORCPT ); Thu, 7 Jan 2021 13:00:43 -0500 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB232C0612F6; Thu, 7 Jan 2021 10:00:02 -0800 (PST) Received: by mail-ed1-x530.google.com with SMTP id dk8so8674302edb.1; Thu, 07 Jan 2021 10:00:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:references:subject:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=MjU7hC1ZlO0b74jFg9ZywySOI1ZO5CsVl4MzCXVYPGc=; b=EF7jAUH7PG+AWd63ehZRfFnTZzTfZC6ou5iHsCaFFQvzbQo0JdzfCFGNlJYik9tevJ 8WiggIiJ+W18sG9SpoZUpXLru5GQeYLZYfdyhoD4bjDxul75cc+Ace9kSvZuYuflAgIb RG9t6mzqBphTlXYx4wyuCo9WhyiU+zwAh2f9OTOxrkpeumJ7qLi2UnKd+EidtmRoqJdi Bs8tNB10lGI8U6L3xPho5HOI3u75Ll9aRvxzD08BFUlQbPEn+Ssu70LDEwzsicM7cEQs qMacDkEke/XGivPNgYEgPlmYZZgh53uYTVrIxvzBJe7hBC9/9pkR3pkdwMDN0AcLGqFo +6LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:references:subject:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=MjU7hC1ZlO0b74jFg9ZywySOI1ZO5CsVl4MzCXVYPGc=; b=OrsTpZhlMsJ3I+t8cSdq2N8HpstRmbcdncwfSv+mcbUaxr+U/au20YnoO9TDnVtyV/ QHTnoxpq7cmTuXB0PDeObbX13W13cg6gDMff+OWrYl9KhlFCQRX6ERJ7LgncNhbB+Dsa fvYTIKr4diWJOo2IklNqcaY4ni3mFHKNIbOmbiwIdJ2YzVDvM8OeHdO6BtAANfu19EPh ruPujBOpOjkAXqD+05ZHwbmUqoUWZQRT0ApAZCcfufQNmPn/a0D1Z6KXxNke5IVCRSJP b6qJGbKW1sUYSZKpsui2jME2VAEk0h4CT5OAXkAohbZlgHGBZ/ZAYy7te0eALPHeQadG vM4A== X-Gm-Message-State: AOAM532NhqbbmWdiFXndiWm2BHWc8zsJNM4pF/+KhfyPFGcbkR8/3m17 GFR8TYTkoRaX1giX9UQs6xo= X-Google-Smtp-Source: ABdhPJwaX379R6wTIVqh/ItvPrM/BvfiylTPwkuFTHPpTQDeNQLlLG6o65dTmhJFmdcC8OyfAacKow== X-Received: by 2002:a50:fc13:: with SMTP id i19mr2594263edr.281.1610042401515; Thu, 07 Jan 2021 10:00:01 -0800 (PST) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.googlemail.com with ESMTPSA id pk19sm2739022ejb.32.2021.01.07.10.00.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Jan 2021 10:00:00 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini To: Sean Christopherson , Maxim Levitsky Cc: kvm@vger.kernel.org, Vitaly Kuznetsov , "H. Peter Anvin" , Sean Christopherson , Borislav Petkov , Thomas Gleixner , linux-kernel@vger.kernel.org, "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Ingo Molnar , Wanpeng Li , Joerg Roedel , Jim Mattson References: <20210107093854.882483-1-mlevitsk@redhat.com> <20210107093854.882483-2-mlevitsk@redhat.com> <6d7bac03-2270-e908-2e66-1cc4f9425294@redhat.com> Subject: Re: [PATCH v2 1/4] KVM: nSVM: cancel KVM_REQ_GET_NESTED_STATE_PAGES on nested vmexit Message-ID: <28958ec1-5ca4-f4a7-e8d7-189e87235cff@redhat.com> Date: Thu, 7 Jan 2021 18:59:59 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <6d7bac03-2270-e908-2e66-1cc4f9425294@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On 07/01/21 18:51, Paolo Bonzini wrote: > On 07/01/21 18:00, Sean Christopherson wrote: >> Ugh, I assume this is due to one of the "premature" >> nested_ops->check_events() >> calls that are necessitated by the event mess?  I'm guessing >> kvm_vcpu_running() >> is the culprit? >> >> If my assumption is correct, this bug affects nVMX as well. > > Yes, though it may be latent.  For SVM it was until we started > allocating svm->nested on demand. > >> Rather than clear the request blindly on any nested VM-Exit, what >> about something like the following? > > I think your patch is overkill, KVM_REQ_GET_NESTED_STATE_PAGES is only > set from KVM_SET_NESTED_STATE so it cannot happen while the VM runs. ... and when leaving SMM. But in either case, there cannot be something else causing a nested vmexit before the request is set, because SMM does not support VMX operation. So I still don't think that it justifies the extra code and indirection. Paolo