From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) (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 A485D7E for ; Fri, 2 Sep 2022 06:52:03 +0000 (UTC) Received: from nazgul.tnic (dynamic-089-204-154-243.89.204.154.pool.telefonica.de [89.204.154.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 36E0E1EC068D; Fri, 2 Sep 2022 08:51:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1662101517; h=from:from: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:in-reply-to:in-reply-to: references:references; bh=9kUEs2/T4DMChAR3xShTyboJxKta70IsCXwvaVK3RJY=; b=YkYEER3f0hCMiu2oU1TYSJf3dywL4jvCMYwGQXlfBVN7MC+mkZWQP/M/Ng/Ihpcsob87+o OTFSotKbnlSyf4Yepl+Yk9g2NYxVbVQp8sAg7K/BZSk4FZiAg31UuTN5gBp6/1ylaNkW0p ZfisbV5h5VcrBtsUA117bTyfqibeZg4= Date: Fri, 2 Sep 2022 08:52:02 +0200 From: Borislav Petkov To: "Kalra, Ashish" Cc: "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "linux-coco@lists.linux.dev" , "linux-mm@kvack.org" , "linux-crypto@vger.kernel.org" , "tglx@linutronix.de" , "mingo@redhat.com" , "jroedel@suse.de" , "Lendacky, Thomas" , "hpa@zytor.com" , "ardb@kernel.org" , "pbonzini@redhat.com" , "seanjc@google.com" , "vkuznets@redhat.com" , "jmattson@google.com" , "luto@kernel.org" , "dave.hansen@linux.intel.com" , "slp@redhat.com" , "pgonda@google.com" , "peterz@infradead.org" , "srinivas.pandruvada@linux.intel.com" , "rientjes@google.com" , "dovmurik@linux.ibm.com" , "tobin@ibm.com" , "Roth, Michael" , "vbabka@suse.cz" , "kirill@shutemov.name" , "ak@linux.intel.com" , "tony.luck@intel.com" , "marcorr@google.com" , "sathyanarayanan.kuppuswamy@linux.intel.com" , "alpergun@google.com" , "dgilbert@redhat.com" , "jarkko@kernel.org" Subject: Re: [PATCH Part2 v6 09/49] x86/fault: Add support to handle the RMP fault for user address Message-ID: References: <0ecb0a4781be933fcadeb56a85070818ef3566e7.1655761627.git.ashish.kalra@amd.com> Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Thu, Sep 01, 2022 at 08:32:35PM +0000, Kalra, Ashish wrote: > As I mentioned earlier, this is computing an index into a 4K page > within a hugepage mapping, therefore, though pte_index() works for 2M > pages, but pmd_index() will not work for 1G pages. Why not? What exactly do you need to get here? So the way I understand it is, you want to map the faulting address to a RMP entry. And that is either the 2M PMD entry when the page is a 1G one and the 4K PTE entry when the page is a 2M one? Why doesn't pmd_index() work? Also, why isn't the lookup function's signature: int snp_lookup_rmpentry(unsigned long address, int *level) and all that logic to do the conversion to a PFN also not in it? Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette