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 X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C93FC12002 for ; Mon, 19 Jul 2021 09:32:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 76B6A6108B for ; Mon, 19 Jul 2021 09:32:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235527AbhGSIvU (ORCPT ); Mon, 19 Jul 2021 04:51:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:55716 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235651AbhGSIvT (ORCPT ); Mon, 19 Jul 2021 04:51:19 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BF7AC6115B; Mon, 19 Jul 2021 09:31:59 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1m5Pcz-00EAx7-Pg; Mon, 19 Jul 2021 10:31:57 +0100 Date: Mon, 19 Jul 2021 10:31:51 +0100 Message-ID: <87o8ayk5tk.wl-maz@kernel.org> From: Marc Zyngier To: Paolo Bonzini Cc: linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-mm@kvack.org, Sean Christopherson , Matthew Wilcox , Will Deacon , Quentin Perret , James Morse , Suzuki K Poulose , Alexandru Elisei , kernel-team@android.com Subject: Re: [PATCH 1/5] KVM: arm64: Walk userspace page tables to compute the THP mapping size In-Reply-To: References: <20210717095541.1486210-1-maz@kernel.org> <20210717095541.1486210-2-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: pbonzini@redhat.com, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-mm@kvack.org, seanjc@google.com, willy@infradead.org, will@kernel.org, qperret@google.com, james.morse@arm.com, suzuki.poulose@arm.com, alexandru.elisei@arm.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Mon, 19 Jul 2021 07:31:30 +0100, Paolo Bonzini wrote: > > On 17/07/21 11:55, Marc Zyngier wrote: > > We currently rely on the kvm_is_transparent_hugepage() helper to > > discover whether a given page has the potential to be mapped as > > a block mapping. > > > > However, this API doesn't really give un everything we want: > > - we don't get the size: this is not crucial today as we only > > support PMD-sized THPs, but we'd like to have larger sizes > > in the future > > - we're the only user left of the API, and there is a will > > to remove it altogether > > > > To address the above, implement a simple walker using the existing > > page table infrastructure, and plumb it into transparent_hugepage_adjust(). > > No new page sizes are supported in the process. > > > > Signed-off-by: Marc Zyngier > > If it's okay for you to reuse the KVM page walker that's fine of > course, but the arch/x86/mm functions lookup_address_in_{mm,pgd} are > mostly machine-independent and it may make sense to move them to mm/. > > That would also allow reusing the x86 function host_pfn_mapping_level. That could work to some extent, but the way the x86 code equates level to mapping size is a bit at odds with the multiple page sizes that arm64 deals with. We're also trying to move away from the whole P*D abstraction, because this isn't something we want to deal with in the self-contained EL2 object. Thanks, M. -- Without deviation from the norm, progress is not possible.