Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4407444imw; Thu, 7 Jul 2022 18:58:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vW15W9OStBOSqCZVlcg3qukGE1NQNOBOWunqftb3Y/YyWc8fK032g+OOe3L3kQIIiXTU9W X-Received: by 2002:a17:903:32c4:b0:16a:6b37:7cbe with SMTP id i4-20020a17090332c400b0016a6b377cbemr1118806plr.30.1657245488776; Thu, 07 Jul 2022 18:58:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657245488; cv=none; d=google.com; s=arc-20160816; b=kLpGy5YmPGJP6CCSTh4XhE9qvq/qoJNpJnlUJfm8xt9ez4NBZMXXMJO2g3b9cHIa6G i18Dsv9jcTAAV7Z2GDDXSEp5fWjGKHGPPdKQVXQV5fZEVw6DOrDzAB/koVkpG2ko0SLA XBMQjpK64rUWSrykZZbxjbeUDTKLlHYwdl/AQynSLS1SG8XGxYDHC9DfK8zdgm9+P41S UO/m1BPJQBX2HoafvL4rCLG7xrwPbo20Hhx8RHZbYUoFJzFH6Zf56XB9y0+j+zxuQIia wjPoBCGodSEV1zs3tE7r67OjEkGZZKF6YZgcBAlukHn1aIZNncG/OYzn1Ao9PDaMsOoJ meBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=eqGGNBXdHeAxVU6/dfQwQdk8bVUjS5GOaneuTOCMi1U=; b=dU1siNqhmpGC+T0zyRJGtk5c+fEoiWN7l5tcVqGbqChlrn8MG2+Jz4Pihoe2bz5PDf H0yCU6pzrkeQC6Lvmaef2v2fu3e3yvjXQx47FsS/l6i8FhobucoIvH+57+D7xNOsYyy6 Nk7xRzLEsXuRLsIHynDswSVOwKSaCGY9DkxdLrZGN6MysFoOdyhAhp3nVQCzM4n0e4/7 ME6hmSZl2qA+J5oncET+gknO30+9tr6/FpxoaVbfq/C95EF9Wii8Sd7JYgK0ew546J// Q/sTwMfRZN6el5NQOzo9myLkz4jxPexs2LyhrWjsKu18zaeaYkCenyS4YvwNy3dW/7Ss EcIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EgI9kvda; 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=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w23-20020a17090a461700b001efc839b577si659940pjg.45.2022.07.07.18.57.56; Thu, 07 Jul 2022 18:58:08 -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=@intel.com header.s=Intel header.b=EgI9kvda; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237001AbiGHBeb (ORCPT + 99 others); Thu, 7 Jul 2022 21:34:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236978AbiGHBea (ORCPT ); Thu, 7 Jul 2022 21:34:30 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6EF572EEE; Thu, 7 Jul 2022 18:34:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657244069; x=1688780069; h=message-id:subject:from:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=Q0hvsnX7RVkuwvneu2Zqjjl/dVg/+ONMLULG1th9+jg=; b=EgI9kvdaA3IoRAGFuuZs8MS/41LkwidzKmT1DEfS+maBU2vTpjPFUMOq tEVQytJI7r+4uobRu5yxjG1OJU4A94qLB0LbsuA97DEbKWG5L75mRIm+8 aFFxtRpBzKtny5Tna1sswjIn3nvaURkl2qEuV1PUSeGY6ww/EKbRtzR1p zNnS3nJ/xYXIw3EEP6Z0Kd8mcNl/rVsFrd56T8JliaeC9bfKUEUBSE+5L Y34YYjx7I356dgt5jE2UZ3Hpr3BYkDw/UfTd/Oa7/6mVdVzp70HWUTy8a Aw42fA0qGuP69DT/kBiyytPVBGTj7Xw5MgR1RvuyIYl4rZYucSpBxmWlS Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10401"; a="348146469" X-IronPort-AV: E=Sophos;i="5.92,254,1650956400"; d="scan'208";a="348146469" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2022 18:34:29 -0700 X-IronPort-AV: E=Sophos;i="5.92,254,1650956400"; d="scan'208";a="920816315" Received: from pantones-mobl1.amr.corp.intel.com (HELO khuang2-desk.gar.corp.intel.com) ([10.212.54.208]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2022 18:34:23 -0700 Message-ID: <7f27a51961d212c17933b39ea0b5b884c2939ff9.camel@intel.com> Subject: Re: [PATCH v7 101/102] Documentation/virtual/kvm: Document on Trust Domain Extensions(TDX) From: Kai Huang To: isaku.yamahata@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: isaku.yamahata@gmail.com, Paolo Bonzini Date: Fri, 08 Jul 2022 13:34:20 +1200 In-Reply-To: <9e54fa1ac03df3cd2fb7a2e64d3cffc35d4f097e.1656366338.git.isaku.yamahata@intel.com> References: <9e54fa1ac03df3cd2fb7a2e64d3cffc35d4f097e.1656366338.git.isaku.yamahata@intel.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.2 (3.44.2-1.fc36) MIME-Version: 1.0 X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 > + > +- Wrapping kvm x86_ops: The current choice > + Introduce dedicated file for arch/x86/kvm/vmx/main.c (the name, > + main.c, is just chosen to show main entry points for callbacks.) and > + wrapper functions around all the callbacks with > + "if (is-tdx) tdx-callback() else vmx-callback()". > + > + Pros: > + - No major change in common x86 KVM code. The change is (mostly) > + contained under arch/x86/kvm/vmx/. > + - When TDX is disabled(CONFIG_INTEL_TDX_HOST=3Dn), the overhead is > + optimized out. > + - Micro optimization by avoiding function pointer. > + Cons: > + - Many boiler plates in arch/x86/kvm/vmx/main.c. > + > +Alternative: > +- Introduce another callback layer under arch/x86/kvm/vmx. > + Pros: > + - No major change in common x86 KVM code. The change is (mostly) > + contained under arch/x86/kvm/vmx/. > + - clear separation on callbacks. > + Cons: > + - overhead in VMX even when TDX is disabled(CONFIG_INTEL_TDX_HOST=3Dn)= . > + Why putting "Alternative" in the documentation? You may put it to the cove= r letter so people can judge whether the design is reasonable, but it should = not be in the documentation. --=20 Thanks, -Kai