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=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham 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 76232C10F14 for ; Wed, 10 Apr 2019 17:55:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4FB622063F for ; Wed, 10 Apr 2019 17:55:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730716AbfDJRzc (ORCPT ); Wed, 10 Apr 2019 13:55:32 -0400 Received: from mga02.intel.com ([134.134.136.20]:22635 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728900AbfDJRzb (ORCPT ); Wed, 10 Apr 2019 13:55:31 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Apr 2019 10:55:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,334,1549958400"; d="scan'208";a="335595184" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.181]) by fmsmga006.fm.intel.com with ESMTP; 10 Apr 2019 10:55:30 -0700 Date: Wed, 10 Apr 2019 10:55:30 -0700 From: Sean Christopherson To: Paolo Bonzini Cc: Krish Sadhukhan , kvm@vger.kernel.org, rkrcmar@redhat.com, jmattson@google.com Subject: Re: [PATCH 5/6 v5][KVM nVMX]: nested_vmx_check_vmentry_postreqs() should return VMX_EXIT_REASONS_FAILED_VMENTRY | EXIT_REASON_INVALID_STATE for error conditions Message-ID: <20190410175530.GA27893@linux.intel.com> References: <20190408213516.17966-1-krish.sadhukhan@oracle.com> <20190408213516.17966-6-krish.sadhukhan@oracle.com> <15d3f7f7-f377-1295-55a7-5651d7d44349@redhat.com> <20190410160825.GA26808@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Wed, Apr 10, 2019 at 07:05:30PM +0200, Paolo Bonzini wrote: > On 10/04/19 18:08, Sean Christopherson wrote: > > Good point, though IMO it'd be better to go one step further and actually > > consume the return value in nested_vmx_enter_non_root_mode(). For me, > > having the exit reason in nested_vmx_check_vmentry_postreqs() is a nice > > mental reminder that "postreqs" is referring to checks that happen once > > the CPU has "committed" to VM-Enter. > > It's certainly better if you don't have to return > VMX_EXIT_REASONS_FAILED_VMENTRY. However, I think it still complicates > things a bit, after all the result is always EXIT_REASON_INVALID_STATE. > > The SDM says "VM-entry failure due to invalid guest state. A VM entry > failed one of the checks identified in Section 26.3.1" so the bool (or > 0/-EINVAL) return code is a nice reminder that the function covers a > subset of 26.3.1. Heh, for me, returning EXIT_REASON_INVALID_STATE is the reminder that the function covers 26.3.1. What if we rename the function to nested_vmx_check_vmentry_guest_state()? My desire to return the exit reason mostly stems from the name "postreqs" since I tend to forget what "postreqs" is referring to. And it'd be more appropriate since the MSR load checks are handled elsewhere and really should be considered "postreqs" as well.