Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2408961imw; Wed, 6 Jul 2022 05:34:03 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v6JVQPACzFD3n6po4d+G1lzx+lTBXklqRUtGDRI2hrye7yX8MohbNvM6MVHa5oSDDdx9UO X-Received: by 2002:a17:90a:9401:b0:1ee:e31f:7523 with SMTP id r1-20020a17090a940100b001eee31f7523mr47582090pjo.175.1657110843163; Wed, 06 Jul 2022 05:34:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657110843; cv=none; d=google.com; s=arc-20160816; b=nPQqs9CRTVOl2/skwWO5pgLOnJNpRmJJp9wWKjDiVTpMHh3qJ2udw0C3K69o0WrPwK Ya44l0r7bkDOf0pmRTBCenFmocIrG9RzZbsj0OUbeHJSs5N54rC0rfeuLNhpHSns2stJ o3CHFfHkXKDskYQTGH9z6DzBL89uLvEGeJDHuJRq7DPfjP4OmtaN+DWvks4IHKg5XyVt IPGGrfvKGoJldQ/GQdbQIVcRGwjUY9GaV//PzrN8A3wDgYy8bzmhUEGT/qc3PfaokxY7 Lj/CzGezWno5ui6UzK9F5l+r4t6wBWH2UBb8L1RutL817hn/Kuwf83YUtHnO8R7evx+Z GH9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=pCQdanV41Z2AnlO+nBFS2QF5nGx7EX2TDRux07LhMKc=; b=Umk1lWNkco1aWsIZ8plfb6HfIplatF+8YVtkUVyXFqiw+SL9dgoSmtdEcQsz0Fha55 HVlDLdsJs74n4AyHJ3z/rY2mBwmMmoh5elf5R4NTpAAtdFEnfnLKtH0+jheG5SaXq0nC WpH1cc+WLQBxtyr2E7p3gdUI7oc0KfnqX01HmwE6/ujvKOOYJHgW4BKQNn4LoICOICCY nB/mZ4+xx4Mp8aY0CsRHa/AT7URCG+qAFLgqF4Nmff0TpFp7Fw8Nw7wI/Sxu+LG1EhY7 72HH9nTvbGURfGmHfX+8iqYgXw3FlFNHE/8uY9y30SFNjpuxH0jUdvaxrx7+BTMf3ZRS PY3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SrTjbFd7; 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 z12-20020a170902708c00b0016b96b23285si29006894plk.501.2022.07.06.05.33.51; Wed, 06 Jul 2022 05:34:03 -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=SrTjbFd7; 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 S233471AbiGFMQc (ORCPT + 99 others); Wed, 6 Jul 2022 08:16:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233514AbiGFMQ2 (ORCPT ); Wed, 6 Jul 2022 08:16:28 -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 ESMTP id 36BB81EC57 for ; Wed, 6 Jul 2022 05:16:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657109787; 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=pCQdanV41Z2AnlO+nBFS2QF5nGx7EX2TDRux07LhMKc=; b=SrTjbFd7HEWqnz4Y+wybiFZqHNZndAD9gT5o/R8bz2J8BeGZJq0rwpN9AYPMetfMWytwAR 3PZhfpb5OPK/Y07EVlg/osUwwrCbc0ZAcf23LPtYRTrDrzUIkDs3veCQyMBgiNcbmXcNPT 5N+I2uB93lkrI/OVbegiy1426iGXJTw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-587-um9W2-pnM-KGxMcSr1nuwA-1; Wed, 06 Jul 2022 08:16:24 -0400 X-MC-Unique: um9W2-pnM-KGxMcSr1nuwA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BFF55805BDB; Wed, 6 Jul 2022 12:16:23 +0000 (UTC) Received: from starship (unknown [10.40.194.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F8DD492C3B; Wed, 6 Jul 2022 12:16:21 +0000 (UTC) Message-ID: Subject: Re: [PATCH v2 18/21] KVM: x86: Treat pending TRIPLE_FAULT requests as pending exceptions From: Maxim Levitsky To: Sean Christopherson , Paolo Bonzini Cc: Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Oliver Upton , Peter Shier Date: Wed, 06 Jul 2022 15:16:20 +0300 In-Reply-To: <20220614204730.3359543-19-seanjc@google.com> References: <20220614204730.3359543-1-seanjc@google.com> <20220614204730.3359543-19-seanjc@google.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Tue, 2022-06-14 at 20:47 +0000, Sean Christopherson wrote: > Treat pending TRIPLE_FAULTS as pending exceptions. A triple fault is an > exception for all intents and purposes, it's just not tracked as such > because there's no vector associated the exception. E.g. if userspace > were to set vcpu->request_interrupt_window while running L2 and L2 hit a > triple fault, a triple fault nested VM-Exit should be synthesized to L1 > before exiting to userspace with KVM_EXIT_IRQ_WINDOW_OPEN. > > Link: https://lore.kernel.org/all/YoVHAIGcFgJit1qp@google.com > Signed-off-by: Sean Christopherson > --- > arch/x86/kvm/x86.c | 3 --- > arch/x86/kvm/x86.h | 3 ++- > 2 files changed, 2 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 63ee79da50df..8e54a074b7ff 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -12477,9 +12477,6 @@ static inline bool kvm_vcpu_has_events(struct kvm_vcpu *vcpu) > if (kvm_xen_has_pending_events(vcpu)) > return true; > > - if (kvm_test_request(KVM_REQ_TRIPLE_FAULT, vcpu)) > - return true; > - > return false; > } > > diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h > index eee259e387d3..078765287ec6 100644 > --- a/arch/x86/kvm/x86.h > +++ b/arch/x86/kvm/x86.h > @@ -85,7 +85,8 @@ int kvm_check_nested_events(struct kvm_vcpu *vcpu); > static inline bool kvm_is_exception_pending(struct kvm_vcpu *vcpu) > { > return vcpu->arch.exception.pending || > - vcpu->arch.exception_vmexit.pending; > + vcpu->arch.exception_vmexit.pending || > + kvm_test_request(KVM_REQ_TRIPLE_FAULT, vcpu); > } > > static inline void kvm_clear_exception_queue(struct kvm_vcpu *vcpu) Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky