Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp4207453ioo; Wed, 25 May 2022 18:27:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynMlNsfZeLYNGVxb8ceDqsG0L11QOKHXCouBikkV81x/CMU2zELfyyeLTE94TSe6PrAupL X-Received: by 2002:a17:906:b7d6:b0:6fe:a34a:a813 with SMTP id fy22-20020a170906b7d600b006fea34aa813mr26422178ejb.551.1653528429429; Wed, 25 May 2022 18:27:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653528429; cv=none; d=google.com; s=arc-20160816; b=KfN7nyLwE4Oa6gQsR/Oy/dwjBeqM+MRq1UA8kyR5vyunbMkcYUh17oEVzchpIQxeW8 x48Pz5ZDC6Xk2MTGwDNKu6X5R5hkBLVJ/cAVrthDZnsmn1V85wuD5bCrv/7Hp0VCjw9U pnndLtNEvEzFYmu6mIMBV3Q/M3J7d7PpGyHwrCO7S9Bg6re0bsYBCC1OqtoUs/L4kV/3 Zqm9x7Ou9HQfTiS9PGBTMHF/1s9ueBDONCqkCaV/dnrHPWGMNC662zb4Pfv5OQobZefl oI1W8MrlTWF0ESVnYKxvrv3roPtqerDW7+gtewenW9Lp69AxIODtQkZST3Q+P1ggyYlV D8hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=fY0pwDasrq+hRjmATMcQojEaPrvpzo0c/cewYgdoFdE=; b=bBcwc6ffK5pmyT06YVNx5huKfPN2WXBl2+3jGx3yGIcCeyKumb3FaccWE+dBEBM2gT g6sViUh9F3WM3tH/tQpeyZUe8nUP4hYuD7WmriCL7vkT6e6E44V22axBq9heoBhQNYWb hpXeZcq+0osRAi0+3jsYnuvAfc//tdmwQ1+1lY6r6XAnQKJEqoXzgH+Hnrlit0W6eCqt 0xUDPbsjBPp6Y2S55rMt10iPOszFUpgpV9ywoFads329nQ8ctZ4NJHH0iHS4O559W1zB ebC0asZy79hiXuILQpTWmwsV9lnS/Dcb8y3MjMXl8ng2YkGRYJB09N7lY+OlCYFV8zNd pZgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="qfofRs/e"; 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 d13-20020a170906344d00b006f39874cf75si163020ejb.647.2022.05.25.18.26.41; Wed, 25 May 2022 18:27:09 -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="qfofRs/e"; 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 S1344705AbiEZAmk (ORCPT + 99 others); Wed, 25 May 2022 20:42:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244531AbiEZAmh (ORCPT ); Wed, 25 May 2022 20:42:37 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EF359EB44 for ; Wed, 25 May 2022 17:42:35 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id p8so393530pfh.8 for ; Wed, 25 May 2022 17:42:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=fY0pwDasrq+hRjmATMcQojEaPrvpzo0c/cewYgdoFdE=; b=qfofRs/eTHswEF/1OKt1RhCOxZEdZqsH/dQ3Ah/C2NHat9+ya5Ayyh0qXuBlF7Ogjx 1Nt98Q52DvJZ50eNZPp4DpX0gJscVDO1Orhwb436nk14jX0gc077JunMqH88pMj89RBP 2rRumAOf1JLNuTBPN6K1VykuiVeweWdhUooobJ/6lQy/UVAKbn7wrDfyOHGpmGpal+Zh LqIXOgC4EGaTvjPFvulFGuDA27pBHajIKsgh2Ogx/1wGmL9U45B96hnU2OIZIfykcbdU BtYIAlB2gpzRZl/i9LI77kEROHhy6n3lCaHU+1kpqWDU5MuXeg8CQl5ejk/aUv4oWAmZ fseA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=fY0pwDasrq+hRjmATMcQojEaPrvpzo0c/cewYgdoFdE=; b=qKiKVhmuktxY15LaGUbQXA7oHga2504DOSvZW5Pj6TxHa5iivRpB8dp0xF5O6nzHyp Kl2NU04fmoe3E6huDLortLxFbmd3Y59gvClaeB1ki37NSKScWsuWH4CQI85LwqZf+ZCg YbsNKznw67PWpgp0UxI0aIh0CmKUJBQDfwFZ9Z8heWyKldZ5dwHmBHyqwcSlU/EsNv4Q C4abZ/9JHC5ayAWPNGZmKmzs/9y94gPrJmKCObccpRzVkETqzBnvrZQTRo7nOHNG8J68 nBynk9a/DiC/sBpXLP/u+warLShH0uhylfZOnuhnAR6QvGZjC9PcOrIuoVmGdWBa4byZ FJbQ== X-Gm-Message-State: AOAM533HrsjURab7KqDmt4j71c27TOLyo6yqZxR1W9l2PXLHBnBMN4xk a82ImqnYYt3lrBBQdFrGCWOpQw== X-Received: by 2002:a63:dc42:0:b0:3c5:e187:572 with SMTP id f2-20020a63dc42000000b003c5e1870572mr30940215pgj.82.1653525754866; Wed, 25 May 2022 17:42:34 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id a10-20020a63e84a000000b003c5e836eddasm123780pgk.94.2022.05.25.17.42.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 May 2022 17:42:34 -0700 (PDT) Date: Thu, 26 May 2022 00:42:31 +0000 From: Sean Christopherson To: Yuan Yao Cc: Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Chenyi Qiang , Lei Wang Subject: Re: [PATCH 1/2] KVM: VMX: Sanitize VM-Entry/VM-Exit control pairs at kvm_intel load time Message-ID: References: <20220525210447.2758436-1-seanjc@google.com> <20220525210447.2758436-2-seanjc@google.com> <20220525232744.e6g77merw7pita3s@yy-desk-7060> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220525232744.e6g77merw7pita3s@yy-desk-7060> 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=ham 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 Thu, May 26, 2022, Yuan Yao wrote: > On Wed, May 25, 2022 at 09:04:46PM +0000, Sean Christopherson wrote: > > @@ -2614,6 +2635,20 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf, > > &_vmentry_control) < 0) > > return -EIO; > > > > + for (i = 0; i < ARRAY_SIZE(vmcs_entry_exit_pairs); i++) { > > + u32 n_ctrl = vmcs_entry_exit_pairs[i].entry_control; > > + u32 x_ctrl = vmcs_entry_exit_pairs[i].exit_control; > > + > > + if (!(_vmentry_control & n_ctrl) == !(_vmexit_control & x_ctrl)) > > + continue; > > + > > + pr_warn_once("Inconsistent VM-Entry/VM-Exit pair, entry = %x, exit = %x\n", > > + _vmentry_control & n_ctrl, _vmexit_control & x_ctrl); > > How about "n_ctrl, x_ctrl);" ? In 0/1 or 1/0 case this > outputs all information of real inconsistent bits but not 0. I thought about adding the stringified control name to the output (yay macros), but opted for the simplest approach because this should be a very, very rare event. All the necessary info is there, it just takes a bit of leg work to get from a single control bit to the related control name and finally to its pair. I'm not totally against printing more info, but if we're going to bother doing so, my vote is to print names instead of numbers.