Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp467261pxb; Thu, 24 Mar 2022 00:00:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZmHEn1rXNPq64qM8ka5Cgx3B7iHTgpB2WWX/GJkzeb93H5enW5EGp60MBzSgNqNqvoUm5 X-Received: by 2002:a17:907:6e03:b0:6e0:15ce:77ba with SMTP id sd3-20020a1709076e0300b006e015ce77bamr4076733ejc.67.1648105199851; Wed, 23 Mar 2022 23:59:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648105199; cv=none; d=google.com; s=arc-20160816; b=SfqSwuiGZMm0Ab8Ox4zWJdAuYobbnvY6EPYyZF+YMGoubtYKJ3XeaUYhAGzFSNtd9U q1vGxR2vNyFb41nstmnQM6LW07evhlG8h8KN+fX55ZsLUrBLZZbr09SaPRYk9txFdK9C Z/7DbyTG6ujoEl/O0xqw+QJElmEMztnOrP4YaKELOD9Rbp1EsfPkPx6V3tGoES0Ovn+o fKlZVRX/Gqwcry3soBiUGPZFuX4Jv5MrNabs2AmGx4CJOd3/+Ohg9bh+0dJS7kMwPogR M7VVpLhutU0szbYyq5FV91NZrcX8fr7+so3D3h3IRWLVYLKaMScwEsZATjKq1fQTnOqd S2Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=0ltQEm4jkJpPFO26laIPZcGY83DKyfBZ1sw0JUywVss=; b=rpbn61Fxlys6U7hPPbfDsRWUt8MBlRZ3JQCygLhB7pReuPoGHdmyS+oLqf1p8osAiH Mm6QXKLIUsEnYqcO35ByJpIjVYs0Fekbxt/Nl5pyWgMXN59e0FSvWop2gx3g9SFSJ0Lw NP9I8D5zbI7pZO1eSjF120IxtbrQ22Wpxjfv87OTIWaNwwpyic6YXnrYVH0fJXCkJJns iZHVs39SfZ5IVaSSNiMHgotoPNzPOEFhgMB7L9u5DATd9beNlVlZqDG7xa4rIkqM31EX Hn6H3IjFCIxJhE1B+30BbaEPGK9rRfzr7c8ylbfXq8AcpJRxmQgSa3QRuGdIv9PnjwPT 6Qwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Yuz2n+O8; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j18-20020a170906535200b006e021f4c201si9821006ejo.271.2022.03.23.23.59.34; Wed, 23 Mar 2022 23:59: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=@google.com header.s=20210112 header.b=Yuz2n+O8; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244242AbiCWUHM (ORCPT + 99 others); Wed, 23 Mar 2022 16:07:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242564AbiCWUHL (ORCPT ); Wed, 23 Mar 2022 16:07:11 -0400 Received: from mail-yw1-x1130.google.com (mail-yw1-x1130.google.com [IPv6:2607:f8b0:4864:20::1130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7E1C89CEC for ; Wed, 23 Mar 2022 13:05:39 -0700 (PDT) Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-2db2add4516so30342707b3.1 for ; Wed, 23 Mar 2022 13:05:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0ltQEm4jkJpPFO26laIPZcGY83DKyfBZ1sw0JUywVss=; b=Yuz2n+O88bMGFiLvP9JQxndEu9C7Bjz6BlwPzjdaGBLhQqxtKjxKwgQzPGtuW6RBpA fLSqBttEmGFiP58M7lAc+Cbl+gPbR/8iiTR/B8SuFYIXOxo3I11NNt8XN5PqBDwtvUSI TBEiBrieiwW1BfhbgQOc+eWIJfqUk6hlDxl+FxNVQjPTFAcqN7aGFtn82h5SOCBwTmyk B5EcSifU3q45VDJG0gz7lGIgg9C4z+Wk24+xgjoCChJPqnHmECF8iMbDGmLCKGHN4ty1 eWXHa5DjNcpfK2fCwYGIA8ioxzhGm33Vz1l4GcXlZz6hpdIwWMeNSxtRD+g1SVfrMQNt DTyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0ltQEm4jkJpPFO26laIPZcGY83DKyfBZ1sw0JUywVss=; b=2/6DlPAusMXVGCPFLBGlxTLck7oDcixmDhqSwcv01yrRGCCfCFDBxycDPdOIwbFK7v TDGDOoelhg/7UuX7n+zBwWiVquNH+PgPF9HJiYymGnOX9DrLYLH+LnsXeRXldDDjn4sd vG/EYlnatxSQLNo3Y4sMRa5g2NjD5wZyw0qylib71uDlHQjDmwgGcaM+scj6gVqLktB/ /qVe/oJMSSbXEji6XVAPzoNifo1eexjvhtQFgGXy7Pl6jnsGm/FBttganFD1+kSTAG0t SzOYnZqwYnxGZd2u+zZ31EYNmUv9EGbqVtpnMNfSQPgpdujjLteWvzNNpZxdsy3XczQT I0Ww== X-Gm-Message-State: AOAM533g11EqwTUW+05gZc7VEDC0/krUswobRwPU2PalAc/es3km+rco MgL0i+gLZIH/6Ygjo0H7ChX0AwsOqHwjB7l6Bzry6Q== X-Received: by 2002:a0d:e80e:0:b0:2e5:ba68:80bc with SMTP id r14-20020a0de80e000000b002e5ba6880bcmr1771295ywe.350.1648065938422; Wed, 23 Mar 2022 13:05:38 -0700 (PDT) MIME-Version: 1.0 References: <20220323175552.GG1964605@ls.amr.corp.intel.com> In-Reply-To: <20220323175552.GG1964605@ls.amr.corp.intel.com> From: Erdem Aktas Date: Wed, 23 Mar 2022 13:05:27 -0700 Message-ID: Subject: Re: [RFC PATCH v5 064/104] KVM: TDX: Implement TDX vcpu enter/exit path To: Isaku Yamahata Cc: "Yamahata, Isaku" , "open list:KERNEL VIRTUAL MACHINE (KVM)" , open list , Paolo Bonzini , Jim Mattson , Connor Kuehl , Sean Christopherson Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 Wed, Mar 23, 2022 at 10:55 AM Isaku Yamahata wrote: > > On Tue, Mar 22, 2022 at 10:28:42AM -0700, > Erdem Aktas wrote: > > > On Fri, Mar 4, 2022 at 11:50 AM wrote: > > > @@ -509,6 +512,37 @@ void tdx_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) > > > vcpu->kvm->vm_bugged = true; > > > } > > > > > > +u64 __tdx_vcpu_run(hpa_t tdvpr, void *regs, u32 regs_mask); > > > + > > > +static noinstr void tdx_vcpu_enter_exit(struct kvm_vcpu *vcpu, > > > + struct vcpu_tdx *tdx) > > > +{ > > > + guest_enter_irqoff(); > > > + tdx->exit_reason.full = __tdx_vcpu_run(tdx->tdvpr.pa, vcpu->arch.regs, 0); > > > + guest_exit_irqoff(); > > > +} > > > + > > > +fastpath_t tdx_vcpu_run(struct kvm_vcpu *vcpu) > > > +{ > > > + struct vcpu_tdx *tdx = to_tdx(vcpu); > > > + > > > + if (unlikely(vcpu->kvm->vm_bugged)) { > > > + tdx->exit_reason.full = TDX_NON_RECOVERABLE_VCPU; > > > + return EXIT_FASTPATH_NONE; > > > + } > > > + > > > + trace_kvm_entry(vcpu); > > > + > > > + tdx_vcpu_enter_exit(vcpu, tdx); > > > + > > > + vcpu->arch.regs_avail &= ~VMX_REGS_LAZY_LOAD_SET; > > > + trace_kvm_exit(vcpu, KVM_ISA_VMX); > > > + > > > + if (tdx->exit_reason.error || tdx->exit_reason.non_recoverable) > > > + return EXIT_FASTPATH_NONE; > > > > Looks like the above if statement has no effect. Just checking if this > > is intentional. > > I'm not sure if I get your point. tdx->exit_reason is updated by the above > tdx_cpu_enter_exit(). So it makes sense to check .error or .non_recoverable. > -- > Isaku Yamahata What I mean is, if there is an error, it returns EXIT_FASTPATH_NONE but if there is no error, it still returns EXIT_FASTPATH_NONE. The code is like below, the if-statement might be there as a placeholder to check errors but it has no impact on what is returned from this function. if (tdx->exit_reason.error || tdx->exit_reason.non_recoverable) return EXIT_FASTPATH_NONE; return EXIT_FASTPATH_NONE;