From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 019C6C47088 for ; Fri, 2 Dec 2022 17:26:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 805BE6B0071; Fri, 2 Dec 2022 12:26:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B5EE6B0073; Fri, 2 Dec 2022 12:26:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 656586B0074; Fri, 2 Dec 2022 12:26:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 56FF16B0071 for ; Fri, 2 Dec 2022 12:26:01 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 30FE381282 for ; Fri, 2 Dec 2022 17:26:01 +0000 (UTC) X-FDA: 80198044122.21.02DD267 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by imf27.hostedemail.com (Postfix) with ESMTP id 49CD740011 for ; Fri, 2 Dec 2022 17:25:59 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=ck0HEm4k; spf=pass (imf27.hostedemail.com: domain of dave.hansen@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=dave.hansen@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1670001960; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=HEJjqcmlCHU/B7vO/08fUvt2qIFYiSzD5QJbbNTL810=; b=hhmRWaXt4MErTG4HrGGIZ/nFhANcxb1aBHoDZm5F4fQ31FvaDmNmFb6hrCIvrZBv9/E78+ UiuoeL5Zgypcu/shfdY5m4yBYlusTsshp1BoI6AVPbkUFOY1Avr3SUFLlJoEEwWXX4mOGw 6ehg2gfbWamVzKgqy9nRaJ0uWHy116Q= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=ck0HEm4k; spf=pass (imf27.hostedemail.com: domain of dave.hansen@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=dave.hansen@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1670001960; a=rsa-sha256; cv=none; b=jP8im+/XYHr9aGpSGNhllxJtxu9brxAMJ1ivnHsGmN1UBTadjXVVVzMLY7cstybQ3hqcuW /cxG6xj2w4puq61YtrvHxgnHwmvGHCq4QalvGf+jCFYoGqjFpYjKB+SOJiOXUMrI5YuGYF JfycFo0P10cBV87GwhYVR9DuaHTp2Ew= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670001959; x=1701537959; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=UAxenKvkDH4wwIwcRyi4RJ3isQRBDPM97pG5KlxBFRI=; b=ck0HEm4kowac+CZ18MpZn2drlWNFkgM5w//lVZ63Ngc66xRvAGX2IWV1 1xu+gm36rgwoJICjh+ehKCkRGdoX/1xONSsd3hSl2seiCbWPp/eTZmiXG T6l0yumoAAaeLrdWqGNgyj+1/dU3bjkDjX49BfenQk44mbDDtezoAbnMj mvhMVD6wHBPLYVri1rpyIZ2+07DMCoQdl79xczf3I1aZlP2CFC3zAkdjx PIL3CP2wxii+YXdrF1UzwTOBqcMvDgNUpqBWV81C+GteP4sRG751XM0dD qIlCsy2Hbv6TETxceNUVJShMymzUqnBEplwzlXyEzsrhoB9Wb3DseUyde Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10548"; a="402282412" X-IronPort-AV: E=Sophos;i="5.96,213,1665471600"; d="scan'208";a="402282412" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2022 09:25:57 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10548"; a="638813719" X-IronPort-AV: E=Sophos;i="5.96,213,1665471600"; d="scan'208";a="638813719" Received: from rsnyder-mobl.amr.corp.intel.com (HELO [10.209.68.71]) ([10.209.68.71]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2022 09:25:56 -0800 Message-ID: <0decd051-a247-3f92-2df7-c7684ed18c75@intel.com> Date: Fri, 2 Dec 2022 09:25:56 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH v7 09/20] x86/virt/tdx: Get information about TDX module and TDX-capable memory Content-Language: en-US To: "Huang, Kai" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" Cc: "Luck, Tony" , "bagasdotme@gmail.com" , "ak@linux.intel.com" , "Wysocki, Rafael J" , "kirill.shutemov@linux.intel.com" , "Christopherson,, Sean" , "Chatre, Reinette" , "pbonzini@redhat.com" , "linux-mm@kvack.org" , "Yamahata, Isaku" , "peterz@infradead.org" , "imammedo@redhat.com" , "Gao, Chao" , "Brown, Len" , "Shahar, Sagi" , "sathyanarayanan.kuppuswamy@linux.intel.com" , "Huang, Ying" , "Williams, Dan J" References: <850e0899-d54e-6a49-851e-56f4d353905c@intel.com> <57af0b96f8a827828b1d64031774962972bfb060.camel@intel.com> <1c6580f7-3abb-03ba-dd98-367ddb9bf23b@intel.com> <7be59cd82bc3f3c26e835980eb74a8d92c6d67d6.camel@intel.com> From: Dave Hansen In-Reply-To: <7be59cd82bc3f3c26e835980eb74a8d92c6d67d6.camel@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 49CD740011 X-Stat-Signature: dwyui6uaps8paci6tt3fs3w8yy4hd4zn X-Rspam-User: X-Spamd-Result: default: False [-0.94 / 9.00]; DMARC_POLICY_ALLOW(-0.50)[intel.com,none]; R_SPF_ALLOW(-0.20)[+ip4:192.55.52.43/32]; R_DKIM_ALLOW(-0.20)[intel.com:s=Intel]; MIME_GOOD(-0.10)[text/plain]; RCVD_NO_TLS_LAST(0.10)[]; BAYES_HAM(-0.04)[52.57%]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; RCPT_COUNT_TWELVE(0.00)[21]; DKIM_TRACE(0.00)[intel.com:+]; RCVD_COUNT_THREE(0.00)[3]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_SIGNED(0.00)[hostedemail.com:s=arc-20220608:i=1]; TO_DN_SOME(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[] X-Rspamd-Server: rspam08 X-HE-Tag: 1670001959-671219 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 12/2/22 03:19, Huang, Kai wrote: > Probably I forgot to mention the "r9" in practice always returns 32, so there > will be empty CMRs at the tail of the cmr_array[]. Right, so the r9 value is basically useless. I bet the code gets simpler if you just ignore it. >> But we can also do nothing here, but just skip empty CMRs when comparing the >> memory region to it (in next patch). >> >> Or, we don't even need to explicitly check memory region against CMRs. If the >> memory regions that we provided in the TDMR doesn't fall into CMR, then >> TDH.SYS.CONFIG will fail. We can just depend on the SEAMCALL to do that. > > Sorry to ping, but do you have any comments here? > > How about we just don't do any check of TDX memory regions against CMRs, but > just let the TDH.SYS.CONFIG SEAMCALL to determine? Right, if we screw it up TDH.SYS.CONFIG SEAMCALL will fail. We don't need to add more code to detect that failure ourselves. TDX is screwed either way.