Received: by 2002:a05:7412:b92:b0:f4:e171:4568 with SMTP id v18csp583516rdh; Wed, 29 Nov 2023 17:24:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IEU+q+Li/zuuRN3o+HumKFc+023wLGqD7iVuzGL70mJbZIC/MShRZ8MWCDxwu4AptzFhO54 X-Received: by 2002:a17:90b:1287:b0:285:9e6f:5cc9 with SMTP id fw7-20020a17090b128700b002859e6f5cc9mr17322766pjb.13.1701307494012; Wed, 29 Nov 2023 17:24:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701307493; cv=none; d=google.com; s=arc-20160816; b=UeQcYt+Tei92OKCHypLBn9n1UXgD+JfJNMRE6CU6qKAxA/radZlo1y1/kfRNnbFRkE OfhJj262wJSWvHnokmadfp4KsWUFzU0XRSDaHf3Pjz1UxDB12uzxmPJedwla1hDoQnFn isnq3w1ST5exs3ZsSbxBPHt3TxBB7JvqyuF9ysynAHJEVPTCOkB8zsZ1c0rAA+BCP0FN /tXwq5B7BtF6eLihBMAf61S2xppSYm79HcAreyoCskqFej5K0dA+qzJEi4pP7NTTOeIH yMGXd1rH7Zab7mTrixMqyfCYmTXARBZmQ6VUYQWeMCHUYo/V9yuIH8ye2Rd+WnlMGVCB b7gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=FijcW7Tw2HqDQY+nVc3aasjWLlfqxmExsIveTz02HjQ=; fh=B/f62ZS7YuyACZEPgZdOBtbLN3mPW/WBMExrn2UcgVM=; b=iyGqhWC6czgfdQfjBsA2PEXjKvk7VjedYaVzATDYGPAhutQM/bHcS5gvYxgw9WKLJG NELjDZXZiUM/SQoQjBlQxclbn4CAbPBudQxQRmnh0hP5IgtbDM2RMuFb4yemzcCS5t52 1qGD4ijUJDKGLgar8hQW1yAAJWpR03VZTwaH7GrHuZ9QFWqR7mdB9dr7uetxst5PpJDT ePrljRl/SZ/e6oZU4VYNoIEuQ6wV7mlQJCGmeI5AKhoYcLEFZMXkikkwkTU5ctz38fms VZHQCzvHA+sFz5hY+s0NUEdQfZFhvnLTlLA9f/nJ0eVgrb43gnEjqUgaPdFjyGRu+Bt3 hS8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=DAu88USZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id c19-20020a17090ad91300b00285b937aebdsi180777pjv.74.2023.11.29.17.24.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 17:24:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=DAu88USZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 25560804BC0C; Wed, 29 Nov 2023 17:24:51 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231547AbjK3BYf (ORCPT + 99 others); Wed, 29 Nov 2023 20:24:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229658AbjK3BYe (ORCPT ); Wed, 29 Nov 2023 20:24:34 -0500 Received: from mail-pl1-x64a.google.com (mail-pl1-x64a.google.com [IPv6:2607:f8b0:4864:20::64a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 854A110C6 for ; Wed, 29 Nov 2023 17:24:40 -0800 (PST) Received: by mail-pl1-x64a.google.com with SMTP id d9443c01a7336-1cfb5471cd4so4229185ad.3 for ; Wed, 29 Nov 2023 17:24:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701307480; x=1701912280; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=FijcW7Tw2HqDQY+nVc3aasjWLlfqxmExsIveTz02HjQ=; b=DAu88USZFrzw4PSECulnLd2jUUwFwZwOsCY4pcGqtfspPfpDHNumJFt+idmYSn7FZp yJSXFY0tmuNm7JaHTP/Iblxtntfq/RR34MC2uY2E8yXx8fFI+kFN30fA+uLyY+ENL0fs Zmd+PTV6TSazIcdRxmsYql0iUTGbdPDwBTG37uMwuolQwwn2SuMuEyAe1uxzO/S0X/VV 0VFQwOITblsf9DEifX3jXUimear9er80RKBd+1FwEmizr+abr9FTgCIkVlyMmVkDGrcW t7fJqdCMtI74myGF6JXCWIIIO+K8zqFwG1oGtsvTnmn5SkW205QO6VO1jH/oeQESTiuc mduA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701307480; x=1701912280; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FijcW7Tw2HqDQY+nVc3aasjWLlfqxmExsIveTz02HjQ=; b=I32H28tOSDVIdaoed6ecaEnuBNwsQxQcIYkFwZRqob2OfZjV/X1wt8/BYHKBPlrood AnPgL37Jv7T6RYRnw2/8Ptbm6qJTBnVZPa6wlZapGNIiKJ+AQU5+V9vDKJ+AH94fap1k kxifbo3tb/xyDwtg7Qr4/URpgb9eNz1LyQBf3ylQyTdA/86PlabfbX0N3RiDB1r8nBeE HgiVkejh9jS/M2UDpdKj8UKHDrx7OdIzglsJHiqGUBXwfyD5X7tHvdekkeYomR0LUL2N u8kkIjKFzTFfSjnp03/jyfCfiOhGxo96sG1ynxvrYOl/B1Da008UweSo41e0wdrJ3Plk jhDA== X-Gm-Message-State: AOJu0YxN7zuXPMADDl1Uscv+fl8bBfMTG/JijxiZbndp80Fwdsml95An +mK34+hV5O3PSQAsLGW7viu5HHJwR00= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:903:25cf:b0:1cf:d52a:2255 with SMTP id jc15-20020a17090325cf00b001cfd52a2255mr2256433plb.11.1701307480068; Wed, 29 Nov 2023 17:24:40 -0800 (PST) Date: Wed, 29 Nov 2023 17:24:38 -0800 In-Reply-To: <20231025152406.1879274-12-vkuznets@redhat.com> Mime-Version: 1.0 References: <20231025152406.1879274-1-vkuznets@redhat.com> <20231025152406.1879274-12-vkuznets@redhat.com> Message-ID: Subject: Re: [PATCH 11/14] KVM: nVMX: hyper-v: Introduce nested_vmx_evmptr12() and nested_vmx_is_evmptr12_valid() helpers From: Sean Christopherson To: Vitaly Kuznetsov Cc: kvm@vger.kernel.org, Paolo Bonzini , Maxim Levitsky , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 29 Nov 2023 17:24:51 -0800 (PST) On Wed, Oct 25, 2023, Vitaly Kuznetsov wrote: > 'vmx->nested.hv_evmcs_vmptr' accesses are all over the place so hiding > 'hv_evmcs_vmptr' under 'ifdef CONFIG_KVM_HYPERV' would take a lot of > ifdefs. Introduce 'nested_vmx_evmptr12()' accessor and > 'nested_vmx_is_evmptr12_valid()' checker instead. Note, several explicit > > nested_vmx_evmptr12(vmx) != EVMPTR_INVALID > > comparisons exist for a reson: 'nested_vmx_is_evmptr12_valid()' also checks > against 'EVMPTR_MAP_PENDING' and in these places this is undesireable. It > is possible to e.g. introduce 'nested_vmx_is_evmptr12_invalid()' and turn > these sites into > > !nested_vmx_is_evmptr12_invalid(vmx) > > eliminating the need for 'nested_vmx_evmptr12()' but this seems to create > even more confusion. > > No functional change intended. > > Signed-off-by: Vitaly Kuznetsov > --- > arch/x86/kvm/vmx/hyperv.h | 10 +++++++++ > arch/x86/kvm/vmx/nested.c | 44 +++++++++++++++++++-------------------- > arch/x86/kvm/vmx/nested.h | 2 +- > 3 files changed, 33 insertions(+), 23 deletions(-) > > diff --git a/arch/x86/kvm/vmx/hyperv.h b/arch/x86/kvm/vmx/hyperv.h > index 933ef6cad5e6..ba1a95ea72b7 100644 > --- a/arch/x86/kvm/vmx/hyperv.h > +++ b/arch/x86/kvm/vmx/hyperv.h > @@ -4,6 +4,7 @@ > > #include > #include "vmcs12.h" > +#include "vmx.h" > > #define EVMPTR_INVALID (-1ULL) > #define EVMPTR_MAP_PENDING (-2ULL) > @@ -20,7 +21,14 @@ enum nested_evmptrld_status { > EVMPTRLD_ERROR, > }; > > +struct vcpu_vmx; This forward declaration should be unnecessary as it's defined by vmx.h, which is included above.