Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp759723lqp; Thu, 21 Mar 2024 15:00:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWHW9Cnm3Mafcou7HpckbilXLP4vtOMV3NDTuNwDqdU2Squ1KE143HD51Ea+UgFp+N2Ihd4R8t+ZY6LjnZGwFWCQZNkFN1MCcm8vMhbaA== X-Google-Smtp-Source: AGHT+IFP9Og/FM9I3zalDZUoi+0EkBbous0ULyfIVYTXAIAeKRQg/RIpHO7di4cRK7tGIIewbzta X-Received: by 2002:a50:aad3:0:b0:568:a30c:2db5 with SMTP id r19-20020a50aad3000000b00568a30c2db5mr250772edc.40.1711058408648; Thu, 21 Mar 2024 15:00:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711058408; cv=pass; d=google.com; s=arc-20160816; b=za9NQCrU1FKVsAVI1QFxMog+SzwrxpeS1YyJebBRGDQiM8bkzqRQO9fz3ueoP+3ncC i04HzcPYlPnUieR8n+SBmh/e8bVXVxkJVQa0WB6cqZd+pcZJsfm2olBlKas2/TWyt//2 3t1+4RKCVAMwTAlqVkzLdNpsxBr8GFzq2q0XhFX+aHoYW9fnAKFVTu1ykE0/x4UWzHL1 a4g3dl0SZAbaUrF3RCsMCxAQv9VcimFdr1Tx5p156lmRpJO7vozE+ePHvJMHHuLP23tL VrcWvGsNIUYbO5czlE5LApKAS5anh7clpRvwhcF2VE1nP4zaS7U12ggxg76VLeMzSnMm mKhQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=7C5DsfKCqT1eT+4524ST2bkLZymUfaVlFWDnVD0O+zc=; fh=Vj5trRVmnU8XdLFcSV47Z6Q81f2aWcrI0gBACy/KTKk=; b=d7f+W68N+utw8oRe+33pESsn/pIXF42OktdCx35/hdcc5V0ZWyIAUc/WY6BTX0kgJx u6X0r6lR+wO9ikfJQ8lHypEJQge1lo804z4zPNFj6UzaiEvzRmTojcYMWzuF3XXkGRde faaY+9wjxDw56Bt70G6jRVXb6SdyIqu023Cuh7wJaFbbj4ynuQZ45l5yfaCKgRbBg0MH qZlzG7ut0Vxirs8sHL/HtagtDeOvZtBS9AG1gpnx528KreB2VD/ak8nJRKOMroK6/az8 0i8bref+ggz3w+u9DheQZrg3SsRxBecBr/8XsK7nrNGhDPTPJEO12jWthLwxKDhoQ8gZ JSoA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PS+GeD6Z; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-110713-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110713-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ee51-20020a056402293300b005686b16a8d4si260584edb.588.2024.03.21.15.00.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 15:00:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-110713-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PS+GeD6Z; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-110713-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110713-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 536781F22778 for ; Thu, 21 Mar 2024 22:00:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB30913666B; Thu, 21 Mar 2024 21:59:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PS+GeD6Z" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E49C4133998; Thu, 21 Mar 2024 21:59:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711058399; cv=none; b=kYCo30pOj+ftBdy9yP3aJy5/nw3wMzDCo+aFDl+nfbXX7Pp4Nc6gkfxPgvzD4x3hz5TbnQnCg6Au3cyY2+fFrlCLbzeCwXN/feeOjbp9i9r++pTEuhsV5Gq/LTP1LGkUZo+BUtc2sUWjmQAMGpXSqCpQNnwNJLnv0j9WayBehxU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711058399; c=relaxed/simple; bh=lcQ5MuMgTWIwGQDRcTtRCXnB2iq3G/thV1UuRGB+LLk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bnx3NP7l4raGTFpbvp7rqkjNoi/lrcAYZlLHbyYrprvKp/CbpJSMea3DZ4VcdfY5u5WauHzSJCcRY6YGKUUFD8Euo1G7KWZVH1cQaBsmd0sMW/HVRAMPSHPir7xDfXcY//FKwG9DiTjr613f5JanUfT0uyWP9dzv9tafY8+SIr4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=PS+GeD6Z; arc=none smtp.client-ip=198.175.65.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711058397; x=1742594397; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=lcQ5MuMgTWIwGQDRcTtRCXnB2iq3G/thV1UuRGB+LLk=; b=PS+GeD6ZWaxFDxElonmlAuPwRU3pGqt+pfqmHy6uLdVdtL0z32gK/tka joJf8LW2xZoWJBXv/bAB2szqBF+cxoDLErP76Fll12jup8Fzmw1WIMhrj LCpFX2SW/l+0lTJ9kFsBIb1pldGDBaLlpswYDYdEX6/lu9gsMT6uA/Bz0 nijn1STVYPq1IWvp2s2+PwZB0sl5Gct9moVmvmDoJGeJjjOEFJQWQhIaC EUUwQCdF8sFl1PHiRtYFIlI+/97apc9UdjlxM49aa/KcQuyEZYPc4tCEv tuqBHfZ8X+yPCSJ/b7SJVNQFGyJkYBlzXqkh8MdJem+RWRsDtLvjuw1xq w==; X-IronPort-AV: E=McAfee;i="6600,9927,11020"; a="17233534" X-IronPort-AV: E=Sophos;i="6.07,144,1708416000"; d="scan'208";a="17233534" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2024 14:59:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,144,1708416000"; d="scan'208";a="15068356" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2024 14:59:57 -0700 Date: Thu, 21 Mar 2024 14:59:55 -0700 From: Isaku Yamahata To: "Edgecombe, Rick P" Cc: "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Yamahata, Isaku" , "Zhang, Tina" , "seanjc@google.com" , "Yuan, Hang" , "Huang, Kai" , "Chen, Bo2" , "sagis@google.com" , "isaku.yamahata@gmail.com" , "Aktas, Erdem" , "pbonzini@redhat.com" , isaku.yamahata@linux.intel.com Subject: Re: [PATCH v19 057/130] KVM: x86/mmu: Add a new is_private member for union kvm_mmu_page_role Message-ID: <20240321215955.GS1994522@ls.amr.corp.intel.com> References: <3692118f525c21cbe3670e1c20b1bbbf3be2b4ba.1708933498.git.isaku.yamahata@intel.com> <875eb07773836bf1d5668a4f28a696869e3291c2.camel@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <875eb07773836bf1d5668a4f28a696869e3291c2.camel@intel.com> On Thu, Mar 21, 2024 at 12:18:47AM +0000, "Edgecombe, Rick P" wrote: > On Mon, 2024-02-26 at 00:25 -0800, isaku.yamahata@intel.com wrote: > > From: Isaku Yamahata > > > > Because TDX support introduces private mapping, add a new member in > > union > > kvm_mmu_page_role with access functions to check the member. > > I guess we should have a role bit for private like in this patch, but > just barely. AFAICT we have a gfn and struct kvm in every place where > it is checked (assuming my proposal in patch 56 holds water). So we > could have > bool is_private = !(gfn & kvm_gfn_shared_mask(kvm)); Yes, we can use such combination. or !!sp->private_spt or something. Originally we didn't use role.is_private and passed around private parameter. > But there are extra bits available in the role, so we can skip the > extra step. Can you think of any more reasons? I want to try to write a > log for this one. It's very short. There are several places to compare role and shared<->private. For example, kvm_tdp_mmu_alloc_root(). role.is_private simplifies such comparison. -- Isaku Yamahata