Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2128146lqt; Mon, 22 Apr 2024 02:09:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW2Y1ZF0GQf9crAU2Z2LZsrYyIjZqu3dF4An5WHqrWZgUxIowcpg4e8ZkKxeRhEu+uP4ptSW11jpqzsB4MQWPrH4M5OGEni9G+Op9LaSQ== X-Google-Smtp-Source: AGHT+IHrGU6dvC8jn0vNbPx4TFnjHLQm35aHpWcQVdgfSAZXZXqQlmGj3gdWkFMc0RMB2y1wQfTB X-Received: by 2002:a17:90a:1bcf:b0:2ad:f92b:946 with SMTP id r15-20020a17090a1bcf00b002adf92b0946mr1693593pjr.46.1713776987101; Mon, 22 Apr 2024 02:09:47 -0700 (PDT) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id e19-20020a17090a9a9300b002a480e4bef6si7533394pjp.110.2024.04.22.02.09.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 02:09:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-153061-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=b9iY7g4D; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-153061-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153061-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B6012280D34 for ; Mon, 22 Apr 2024 09:09:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 956AA5490A; Mon, 22 Apr 2024 09:09:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=intel.com header.i=@intel.com header.b="b9iY7g4D" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 4BA4B4C602; Mon, 22 Apr 2024 09:09:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=192.198.163.10 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713776946; cv=fail; b=PUM5vAhCZIuaok/H95Zn+VjIKXNqrKgUVrIffXc5pQEjD3A74YqLEpJb7yBqHnKs4S4bEiaoRvqV2FcUDKSC15vHNg9VCnzub9+my3t3fVJ2yntA+0z+DiC6/kCXzZ1gyrEiTCRtPmQ9v9WPxmZQ8Dk0anUy3KWo1QakKoKIWWA= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713776946; c=relaxed/simple; bh=j+ay19Csb4XfGcVnBgT5chdbldPi91+rLn1w6PuP4Sg=; h=Date:From:To:CC:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=eh3DQhD3FbSjnvmmPN8BAnFrlb4i8DWlCSqIycSuy4LlAr661monrjY0C15GJ7lES8a4K8jiLvg/68h0TRH20eHnFBsn//enqLz89Dv0/pkPK3oNCM8gMWPcq9qka9bR9SwFHQI4NDEs8rxfR+1XP+YskTsQ54vGRidIuUAEprA= ARC-Authentication-Results:i=2; 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=b9iY7g4D; arc=fail smtp.client-ip=192.198.163.10 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=1713776944; x=1745312944; h=date:from:to:cc:subject:message-id:reply-to:references: in-reply-to:mime-version; bh=j+ay19Csb4XfGcVnBgT5chdbldPi91+rLn1w6PuP4Sg=; b=b9iY7g4DJhGeEg2VIW2ueJi6lIJmRXL9dRvjyBCCbbJ9x7DWuoPPj/uB CHgwEFhHKuyyY6JNaAeJHsAp7sUi9UfZKr7FASBhLz2RcePPD50+EdY7/ 1Zj6d7MSvW1/uFt1HEOVhhEcp6eSqxZS19N8R8RNzb2dKJJHkMkV03DP8 9+1hQB5SZhTB9kst5995LX560/iiTrwWjnmJ6xLtd8+Bf8IGNGmaalsY1 0V60c8HwdjCPtKXLr8FAyalbQ0gT7ypa72P3jQJaIuGkflGv/HmtM/ZFj 79nML09XGEnwhCNTKbs3FdU+uz7gjkJ28z9aaKCvyCu6RyTPLh5wksCzC g==; X-CSE-ConnectionGUID: n7oldEE+TGmdmcXffMG1uA== X-CSE-MsgGUID: XYY3TxHdS6Wjudc1Dwcm6A== X-IronPort-AV: E=McAfee;i="6600,9927,11051"; a="20706362" X-IronPort-AV: E=Sophos;i="6.07,220,1708416000"; d="scan'208";a="20706362" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2024 02:08:51 -0700 X-CSE-ConnectionGUID: zvdw5uPnQtaTIl8iGeXRSQ== X-CSE-MsgGUID: //P2jaN0Q6WN6Q7EtUPB3Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,220,1708416000"; d="scan'208";a="28463418" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmviesa003.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 22 Apr 2024 02:08:51 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 22 Apr 2024 02:08:50 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 22 Apr 2024 02:08:49 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 22 Apr 2024 02:08:49 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.169) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 22 Apr 2024 02:08:49 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eMCAR+NBOGYZDfygbHzNu8cO8AMi4AnToQ1JiHi4gHEkdmWtfUojEdZdvU2goyLY5nig6+UT23c3TDbbPrF8lxXhd3fHydUtJrkeJUF7XxhJzDUd4Jlks3W5QhI99Q+VyPKkRCYDji6LVRiztmh/TDYEs9wd2lrhbcxGj+mMyXyy8lxCTDSALLfVQRj5C/xq3o3ouZqNe6x5BrLe8DUgRPZ25JK0Z3+4n7kpvCpmMglEB6qk5MSxaedu9SBUC2adMfTdtw3SuGlbh83dBpBBruf92GGRza/Z5mSTXDKHxc/qoYha+1DygGs2xHkSA06VeiVpxAN6db3LPdNGVPdI8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4SukwFLw6Z09vzxqhl2NLCi2N+6eKYuEGOeZumxCYyE=; b=Xz8LezflcEEkRZyi+Cc9jgQ+1w/y3Dpc5R6KUdGY4uJk6MfBAK93bxZD46GjbNmOI86ZTTYS7hIcHVriag2kxsZKnELg8z7XRehm8dOxvlDIy8o8nmL6hNVPrt91SWLFqAQCP0OMPadbH52o6UlCjRdqWI+/ZRamPEBGsSyB10pB3ud+dTB6XbYuEcO2p4JXxZEdzmde++yOzUAapPSRYRf8rNrKA1LtfiuOP/HjZOrW/TepmTz1MvQD2eItm1heeuK2JsyI3xWL4NxpVdF3RySQuT/5ykwQWZ6sX9LECV2Nr8RMiCG8QY3gP5Ph6w3CzcDZKjIMokwMvc2l/1kdQA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS7PR11MB5966.namprd11.prod.outlook.com (2603:10b6:8:71::6) by DS0PR11MB7214.namprd11.prod.outlook.com (2603:10b6:8:139::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.12; Mon, 22 Apr 2024 09:08:46 +0000 Received: from DS7PR11MB5966.namprd11.prod.outlook.com ([fe80::f62c:98e2:37af:8073]) by DS7PR11MB5966.namprd11.prod.outlook.com ([fe80::f62c:98e2:37af:8073%7]) with mapi id 15.20.7519.018; Mon, 22 Apr 2024 09:08:46 +0000 Date: Mon, 22 Apr 2024 17:08:14 +0800 From: Yan Zhao To: CC: , , , Paolo Bonzini , , Sean Christopherson , Sagi Shahar , Kai Huang , , , Subject: Re: [PATCH v19 062/130] KVM: x86/tdp_mmu: Support TDX private mapping for TDP MMU Message-ID: Reply-To: Yan Zhao References: Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: SI2PR02CA0050.apcprd02.prod.outlook.com (2603:1096:4:196::11) To DS7PR11MB5966.namprd11.prod.outlook.com (2603:10b6:8:71::6) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR11MB5966:EE_|DS0PR11MB7214:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a5ea0c6-0fc8-4bce-2e23-08dc62abd0f7 X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|376005|1800799015; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?pAC2ACtKKLg0EaNGb/RnSrYCjj09fg8duhx2e3yb6/fhTzizVxdxVW7UGeyP?= =?us-ascii?Q?vFrtvCEZklO9bQgisSG6WuTdvgvntratnlFPXBp/oBsqNR1LN+m4uUZH49HF?= =?us-ascii?Q?UxgkOPOKiNjjwqZJQXE3xsN6C5OvLZNgmnEZ9s3OZDNlw9ETZ0lFfJOt2MeE?= =?us-ascii?Q?wQ8va8nBvIdr2uZOGdx8WMkMmv+R21Ceq9p0Mq8TkqGPjgEtflnAAtoNJWSK?= =?us-ascii?Q?O7A2U6i5kCrPA5vgaIAVs7HFMwzuW2l3fIMSWbeW3aThmeQx5gRQ3hoVJ0JR?= =?us-ascii?Q?mpbt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sdqkk/FqwAt2FYK?= =?us-ascii?Q?Kzg+iNf+uBQ2r0DJNwY4BwJnPzkINenh2eRN2Oobk7IsK3/iyBtqO0eTWqcM?= =?us-ascii?Q?5D+qw2cM8iXFiXIOajkzycDH0K1uk4tx5PcJ2M2TfQ=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR11MB5966.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(376005)(1800799015);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?WWnlkxAcEDzl0kWtsP2mgGxj5oUoaZ+3daqPsai8wN3CNf/7Ii/EUTwOL/2/?= =?us-ascii?Q?tqCKpj8MUwSpoY7zwCdWWqVjv859AMYaMyGRM07rE4SNMP+/iHimlMBxviy9?= =?us-ascii?Q?Jw9dLcrA9cLmkynYe383g9+df15BsRXl0EaJrVRHqffUtTaqEOQwlTwi+YR+?= =?us-ascii?Q?83y57kwe5cwV9A2tTIQovavqRumByp+1mmQviEn7AsNSSsyu6gJjldn5zWHM?= =?us-ascii?Q?CeT0cUlhK1igxzct4YPX9B3VgJDZm/PV0SdkvgMnLznF1QxPEMqgTC9cw6TB?= =?us-ascii?Q?hZAHqgy7ybFif0mZ8419i/UHnaDFTLl1tRzvVIN7HXnopZfa7m0A1d85WVTj?= =?us-ascii?Q?PveUeGgTbLxEv9zJFd+5+wedM1RZK2QDzXm3UyAvCzBh81Q8grZVMK6IyF40?= =?us-ascii?Q?XNHm/Ij1efayciUYkJO0W/AhUjbTkg+LfNt7purnDxWXlI4xHuT2iLgttfo9?= =?us-ascii?Q?Z9y3/JZrRaNVUUV6WZaqKJAtkr8gZh1LSK7BwL7FD75YKAVXoBBfF0E07+LX?= =?us-ascii?Q?Tg/3ts34KSxaRaSAMjSFeuMn7k1lCHk10smD8vB+e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BBV3274IfNFPyYdvXqUNa8sRz9p/Tvw/7k73A4pT6elEb8FKaR?= =?us-ascii?Q?z+q7r09ISXYoTWYjytnQ0k7/wleEzD6RyKLoZL4FDLOc2cAO/07er/hRXr7H?= =?us-ascii?Q?vMq34H4YrYic/8eohcT/m3eN03l5YK0YarF7XWDX?= X-MS-Exchange-CrossTenant-Network-Message-Id: 4a5ea0c6-0fc8-4bce-2e23-08dc62abd0f7 X-MS-Exchange-CrossTenant-AuthSource: DS7PR11MB5966.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2024 09:08:46.6118 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: A27/+k1QrBfHe85gzZWdRPEXyWBudYffW8sZkEm8Ownno0/q+wrEEGVW7gMyxXgLJ7ybMX403Fc9S9nwQbHBVA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR11MB7214 X-OriginatorOrg: intel.com On Mon, Feb 26, 2024 at 12:26:04AM -0800, isaku.yamahata@intel.com wrote: > From: Isaku Yamahata > > @@ -1041,6 +1255,8 @@ int kvm_tdp_mmu_map(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault) > struct kvm *kvm = vcpu->kvm; > struct tdp_iter iter; > struct kvm_mmu_page *sp; > + gfn_t raw_gfn; > + bool is_private = fault->is_private && kvm_gfn_shared_mask(kvm); Why not put the checking of kvm_gfn_shared_mask() earlier before determining fault->is_private? e.g. in kvm_mmu_page_fault(). > int ret = RET_PF_RETRY; > > kvm_mmu_hugepage_adjust(vcpu, fault); > @@ -1049,7 +1265,17 @@ int kvm_tdp_mmu_map(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault) > > rcu_read_lock(); > > - tdp_mmu_for_each_pte(iter, mmu, fault->gfn, fault->gfn + 1) { > + raw_gfn = gpa_to_gfn(fault->addr); > + > + if (is_error_noslot_pfn(fault->pfn) || The checking for noslot pfn is not required after this cleanup series [1] from Sean, right? > + !kvm_pfn_to_refcounted_page(fault->pfn)) { What's the purpose of rejecting non-refcounted page (which is useful for trusted IO)? Besides, looks pages are allocated via kvm_faultin_pfn_private() if fault->is_private, so where is the non-refcounted page from? > + if (is_private) { > + rcu_read_unlock(); > + return -EFAULT; > + } > + } [1] https://lore.kernel.org/all/20240228024147.41573-1-seanjc@google.com/ > + tdp_mmu_for_each_pte(iter, mmu, is_private, raw_gfn, raw_gfn + 1) { > int r; > > if (fault->nx_huge_page_workaround_enabled) .. > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index d399009ef1d7..e27c22449d85 100644 > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -201,6 +201,7 @@ struct page *kvm_pfn_to_refcounted_page(kvm_pfn_t pfn) > > return NULL; > } > +EXPORT_SYMBOL_GPL(kvm_pfn_to_refcounted_page); > > /* > * Switches to specified vcpu, until a matching vcpu_put() > -- > 2.25.1 > >