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=-10.4 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 8F0B0C2D0A3 for ; Mon, 26 Oct 2020 05:31:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 540112085B for ; Mon, 26 Oct 2020 05:31:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1768797AbgJZFbc (ORCPT ); Mon, 26 Oct 2020 01:31:32 -0400 Received: from mga06.intel.com ([134.134.136.31]:20356 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1768759AbgJZFbb (ORCPT ); Mon, 26 Oct 2020 01:31:31 -0400 IronPort-SDR: o9OC74CbH9MdownG5zJsjvi/ywkZcOj7sTgoyI89c/s0saeBNCGjesthziTiyV597j3SyjNFX/ ZEfNGOK6PYBQ== X-IronPort-AV: E=McAfee;i="6000,8403,9785"; a="229513258" X-IronPort-AV: E=Sophos;i="5.77,417,1596524400"; d="scan'208";a="229513258" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2020 22:31:27 -0700 IronPort-SDR: 4azQy4ttURtpUTFedYK+Vd55ONGatSITkNcYg8JSoLWcH1N0wti4GrvqD7aToobM2WNcfaS2n4 zIuSPOkXgKTg== X-IronPort-AV: E=Sophos;i="5.77,417,1596524400"; d="scan'208";a="535232981" Received: from cqiang-mobl.ccr.corp.intel.com (HELO [10.238.0.131]) ([10.238.0.131]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2020 22:31:24 -0700 Subject: Re: [RESEND v4 1/2] KVM: VMX: Convert vcpu_vmx.exit_reason to a union To: Sean Christopherson Cc: Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , "Li, Xiaoyao" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <20201012033542.4696-1-chenyi.qiang@intel.com> <20201012033542.4696-2-chenyi.qiang@intel.com> <20201020220158.GA9031@linux.intel.com> From: Chenyi Qiang Message-ID: Date: Mon, 26 Oct 2020 13:31:06 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <20201020220158.GA9031@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/21/2020 6:01 AM, Sean Christopherson wrote: > On Mon, Oct 12, 2020 at 11:35:41AM +0800, Chenyi Qiang wrote: >> From: Sean Christopherson >> >> Convert vcpu_vmx.exit_reason from a u32 to a union (of size u32). The >> full VM_EXIT_REASON field is comprised of a 16-bit basic exit reason in >> bits 15:0, and single-bit modifiers in bits 31:16. >> >> Historically, KVM has only had to worry about handling the "failed >> VM-Entry" modifier, which could only be set in very specific flows and >> required dedicated handling. I.e. manually stripping the FAILED_VMENTRY >> bit was a somewhat viable approach. But even with only a single bit to >> worry about, KVM has had several bugs related to comparing a basic exit >> reason against the full exit reason store in vcpu_vmx. >> >> Upcoming Intel features, e.g. SGX, will add new modifier bits that can >> be set on more or less any VM-Exit, as opposed to the significantly more >> restricted FAILED_VMENTRY, i.e. correctly handling everything in one-off >> flows isn't scalable. Tracking exit reason in a union forces code to >> explicitly choose between consuming the full exit reason and the basic >> exit, and is a convenient way to document and access the modifiers. >> >> No functional change intended. >> >> Cc: Xiaoyao Li >> Signed-off-by: Sean Christopherson > > This needs your SOB since you are involved in the handling of the patch. Sorry for the late response, my mailbox encountered some issues... Will add the SOB here. >