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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAB1BC433F5 for ; Thu, 26 May 2022 00:42:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234524AbiEZAml (ORCPT ); Wed, 25 May 2022 20:42:41 -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-Google-Smtp-Source: ABdhPJwv37XxWZcWzFsMuo9RiXyWU/ZE5BuaGahcNSly21GjZTmQLec1BMusc0kymiEH1SQWHwAwfw== 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> 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.