Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1606389rwe; Fri, 2 Sep 2022 00:03:44 -0700 (PDT) X-Google-Smtp-Source: AA6agR6qM1+BQX4jD+F5Kk9nq2scRqP2TeZbXKW8P8siVTEtnlg4yPUwZx4JvcDwqtXwUJpVAfuL X-Received: by 2002:a17:906:5a68:b0:73d:d354:f2c8 with SMTP id my40-20020a1709065a6800b0073dd354f2c8mr26330995ejc.509.1662102224187; Fri, 02 Sep 2022 00:03:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662102224; cv=none; d=google.com; s=arc-20160816; b=cjR+UMI5YTShsAr33hH/OYQqrTdIm7fq6VHbyt2a1vWYaO+ayTwp2Dy7Xfjm3KhS2r e3OOhpTSqxIZMW1RcrH55MRbIH3MYvQFfoI2yME5iDfZHo5sL4prWcl2tPWWJWkG+df5 X84hw8nJRzHklqkHfNAV2NOGNTKjGNdNyu1BEfZ+U1/SJWLrDo7gUIy0r5CNgZskond6 cv79p4nUKCN7sUXHFkvBsn3oi6TUMvR360KBUMkyQPqVKqOOqa9SujW8u5f6VYcO7l9I Zwq5Z6iHafvCvHe1W/LO4GqCslxGzpoICSEHGxBYZvd+JWhSEdUanpXVT25TyeRsVz+g TmzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9kUEs2/T4DMChAR3xShTyboJxKta70IsCXwvaVK3RJY=; b=gw3SY9zGRY2Ol9QJ+yYU/c25gjK1xZ4S9/8cbUiEj51o+LQ8jYjQ4FbLBmupIDr33g IcLDTmuewAK8gTMpb8YPogZ6CJPt/A9BHWNt32jCSTjccnf9HwTONCDbBhJalbRw24sq 46+Uc4l0FlM28tw3Bd5CAkINFuvIhaukUpJDWPFCUcZKAS0ISEs/woIOz94MzhO9HjkU AtIp4eeXdD2moVy35NX8RLCIo8sVVZyakLHRlwXj+p6ywk6J6DRYEOzldZmjTBtYzJUS gkw4xsEfdp5sraVuxoiAqniKR86EKxGXaxGHw3pOTxdV8NtayqQqC65XCYLV8PIn0zeY QhSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=YkYEER3f; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh8-20020a1709076e8800b0073136f95cccsi1410862ejc.582.2022.09.02.00.03.12; Fri, 02 Sep 2022 00:03:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=YkYEER3f; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235552AbiIBGwH (ORCPT + 99 others); Fri, 2 Sep 2022 02:52:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235539AbiIBGwF (ORCPT ); Fri, 2 Sep 2022 02:52:05 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F91FA1D3D; Thu, 1 Sep 2022 23:52:03 -0700 (PDT) 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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