Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2812795rdb; Mon, 12 Feb 2024 18:58:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IFSw7V/xKNoX8xFgTs2kvZ7fc6X3prwGIWj6SmGUvvBsVBdkLkxk8YL8mhwic/PsqwmVCWE X-Received: by 2002:a05:6214:4189:b0:68c:ca48:3171 with SMTP id ld9-20020a056214418900b0068cca483171mr2216372qvb.15.1707793084393; Mon, 12 Feb 2024 18:58:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707793084; cv=pass; d=google.com; s=arc-20160816; b=H+aWaVhkjoxB80VvDelDbhjAwWrwDlAJRlpmEW13Na9vxJ/NDTeLKqdmN1QD2Mih4i fSb4+dAhIV4wuqgMzvShWRGy2AGIYFYjWcKtPK4Hurgvvdu187N4tv0dsrlCPSdFfAR3 gX6YZPkbV2++jV5IVWeN6ci5JhOQrxTBhYmF2U91Ayy/6RxRQ4XGMIpJo83cBpRjV8yu 8zQ+Ub0Rgi8ILL/XHbpeALlMkoFBD4i964TyThlCDtV9KS7fla1iLO2mqweXED1TsD+3 Kef14FZyYV+cYe6AiLXL/VAQlXf3J/LPAbtapjryXvbqAyOL1LJqGaf8qO/6B8fjBj0w qL3w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :in-reply-to:date:dkim-signature; bh=8VHA+kbZQmNH0KfmyjD++Vx8goDUnnVPYFFFCFvDlx0=; fh=CsLYBf3GNFowg3mLPqiy5rLhFsfhBOOkblBYzth8lq0=; b=AHQIrtr5ny4vuRTIPNhmhOGHDaVuX2eg0uftsCN92tdk0/S35iJEyzru77zBefwrwp W2Xj8jCOu2l12OVGLr+dzTqp7Eez1cXNgY/S61C94MH9UT92DFIo18PwxbA8QjJyyWfV kvM6/tudlNAPw2Rwj59XjW4QGL6VyFc8bvxTtEXm9AqfCSKzX/Wl62wPkXoRvUIW+qik U6HT/0cRW5RR6cHQS/B7LJ4mcPvnIMKVhmxvXOBlfWrYB7bVe9clvCtFyQyMYtLiZgU1 coLBjz3z0eYdTMh2YsIq7njkydAEM3YywIfh+/2Mk+TEJg2e3i/rMH7upnjIQdd/B74P URtw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=EmtYwMSo; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-62894-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62894-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCVORpM8B1+S/OjEHhpibNwohpcd/LaCgU3wjDUsT+QtFu17djlrDMrB+tlXD12CQclkK840KCVFkTRVYGyjmDKRZ8a4G/cI9edDbW/qQw== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id jf15-20020a0562142a4f00b0068c515ce1cbsi1877824qvb.293.2024.02.12.18.58.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 18:58:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62894-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=EmtYwMSo; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-62894-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62894-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 23B451C23389 for ; Tue, 13 Feb 2024 02:58:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D72E0A939; Tue, 13 Feb 2024 02:57:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="EmtYwMSo" Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C241E8F45 for ; Tue, 13 Feb 2024 02:57:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707793073; cv=none; b=I7kZnVouovzlIWfuZ1ezTBWHDvCuvh7BCWvKQZkRRoNZCE38U0YvwQku2rYUdfpRqvfXBYGuKuz/Sxh/T82upfqxeXtoet6seic3EX/HFEaLT0vRwv1h+u/sHOv5EU80WCDqoz1D+4n7Fr6lGXzNWwnOvF2O9oBirSemJWfy6qQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707793073; c=relaxed/simple; bh=gKJFfu63jwMr2L/Cxwzv3BXvXjhYSn8OnEebVEApyZw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=fqjVpus+YlKjHq0FX95ppWTZNprAkE/HRbWIkFH2fCHDpeZf2iy+fwpxTR/z+2NoCchlIsjAa275BDXPmEVB7rtrcl7b9TTr9KpR7kj9SNB4t4V18oKne/lzPQC0EugG7mdCPv+yW3BGygP9X8WfDsqUO2TPd6A72Z/qe8cQhcQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=EmtYwMSo; arc=none smtp.client-ip=209.85.216.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-2966a804063so1955279a91.0 for ; Mon, 12 Feb 2024 18:57:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707793071; x=1708397871; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=8VHA+kbZQmNH0KfmyjD++Vx8goDUnnVPYFFFCFvDlx0=; b=EmtYwMSo48x7+THuTePd9B5/UR0VH/0UMYMc0kAnVXWkgwt+zO7jFHUMO/Etn+gxRA LigI8U6qSoOVydhdrMgfq1C5t7IWUqZfHEzbKcUkjlFgsPF4DNIQr2Bo6oCtqV6MPBMu FdfBnZWG5y8CImgy6dukTUJSrK0lHPt8uOUiaIRD/Z886FvVc/DFQqtJc8fSczR6aOgJ vdWrYxDnWFxo46S2c5P2aAANUvUbv2Yf5QC0DcLO8wDMil64Ycc3Nw9PSZrnZzsDoOy1 7tUZg5WqS9eHoGzcjT2LsPoqCXS/iy6uF5AFO9ZWcyofSzZ0aINuUhKZDdYUYdBOV5RH 37yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707793071; x=1708397871; h=content-transfer-encoding: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=8VHA+kbZQmNH0KfmyjD++Vx8goDUnnVPYFFFCFvDlx0=; b=QLHQHZkcxuqezYUilEco7qBm9pHAlw7RjkEP1tQEBnvidDsJLcLmaYRT+tasTHlVtp igKr5jltJu7eL3mGDpW30KypWGNKkjIQy4s8CZkVaBRcq2afEDuHN1beNizahtXFT9eq fMHChIrF/ku+rTd19SYwX8+F3rqEH3d2jKX3p2E4U5mEkLeilBSTD13OEz4q4dXc0MBf AljilAWZapkpzg8BevNqnVvhyVV9UBYR5fFaJLfmPQUMq/THAcdiEe0525Rz0FewDkKk PSgm/gEJacMHc43IACL27sFZ7JZNaSFgGnAHe2XNiZRZWdpeSbx3vTRBfyqGCfhiTyMB +lNQ== X-Gm-Message-State: AOJu0Yz0sNiQNGZFbjVABWqkZTkD2DI4xbMCSlz4rwKhphUSYky+BalZ fEFipzF7zBnZID7OiuYT3jwzEoZr55w7JDc6t1Py+fvnhz2sxwxhJfKcoajOOg669iME/or+URK FJg== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:90b:35c3:b0:296:d696:a5ac with SMTP id nb3-20020a17090b35c300b00296d696a5acmr56630pjb.5.1707793071021; Mon, 12 Feb 2024 18:57:51 -0800 (PST) Date: Mon, 12 Feb 2024 18:57:49 -0800 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <591420ca62f0a9ac2478c2715181201c23f8acf0.1705965635.git.isaku.yamahata@intel.com> Message-ID: Subject: Re: [PATCH v18 032/121] KVM: x86/mmu: introduce config for PRIVATE KVM MMU From: Sean Christopherson To: Paolo Bonzini Cc: isaku.yamahata@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, isaku.yamahata@gmail.com, erdemaktas@google.com, Sagi Shahar , Kai Huang , chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Mon, Feb 12, 2024, Paolo Bonzini wrote: > On Tue, Jan 23, 2024 at 12:55=E2=80=AFAM wrote= : > > > > From: Isaku Yamahata > > > > To keep the case of non TDX intact, introduce a new config option for > > private KVM MMU support. At the moment, this is synonym for > > CONFIG_INTEL_TDX_HOST && CONFIG_KVM_INTEL. The config makes it clear > > that the config is only for x86 KVM MMU. >=20 > Better, just put this as: >=20 > config KVM_MMU_PRIVATE > bool >=20 > but also add a reverse dependency to KVM_INTEL: >=20 > config KVM_INTEL > tristate "KVM for Intel (and compatible) processors support" > depends on KVM && IA32_FEAT_CTL > select KVM_MMU_PRIVATE if INTEL_TDX_HOST > ... >=20 > This matches the usage of kvm-intel-$(INTEL_TDX_HOST) in the Makefile. But why even bother with a Kconfig in the first place? Saving the is_priva= te bit in the role adds no value whatsoever. In fact, it's probably a big net negative because it necessitates this ugly code: if (private) kvm_mmu_page_role_set_private(&role); which really should just be role.private =3D private; Ditto for kvm_mmu_page.private_spt. The only thing that even so much as approaches being a hot path is kvm_gfn_shared_mask(), and if that needs to be optimized, then we'd probabl= y be better off with a static_key, a la kvm_has_noapic_vcpu (though I'm *extreme= ly* skeptical that that adds any measurable benefit).