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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9BF17C30653 for ; Thu, 4 Jul 2024 14:09:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=pBcZ2tbcC19fz6FdTwlB6CJslPZOeHxqQ237EZlnxzo=; b=J9cCLWI+nKURiDRKqkMXce7MYT gwpODkb8F1WvacbuecK6nttVK18Vr5go4Q8iY5RHMWD2L418tkoyraMsv/oezo/4jYc5mhXYhSE7A 3/xqkrOc+bz/B5Q2H1l3z9JM5+3HWhTDIqqHxNi24EFXgdCxD7GBNvW0jLWUGMV6Fy15ZHJ86p+8L Mu9kLvkUvVO9WVYb5dn2P1rFL2vfFtSJPYdXX+86F7cU6UCZKOH/iU8uNZOqhoWGD/xL2pHDhnZOJ XSnAWSVA2ZHowfLHVtr0jzY0835zgova/WOURixglVeNZnwBzzLMLnoUxTrUJlTj2gpDIV84+6HJd Oc13CfBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPN96-0000000DOK1-1U6d; Thu, 04 Jul 2024 14:09:12 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPN8s-0000000DOHT-3hqf for linux-arm-kernel@lists.infradead.org; Thu, 04 Jul 2024 14:09:00 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 95D0A62644; Thu, 4 Jul 2024 14:08:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A75B8C3277B; Thu, 4 Jul 2024 14:08:55 +0000 (UTC) Date: Thu, 4 Jul 2024 15:08:53 +0100 From: Catalin Marinas To: Anshuman Khandual Cc: D Scott Phillips , linux-arm-kernel@lists.infradead.org, Will Deacon , Andrew Morton , "Kirill A. Shutemov" , linux-kernel@vger.kernel.org, patches@amperecomputing.com Subject: Re: [PATCH] arm64: limit MAX_PHYSMEM_BITS based on vmemmap Message-ID: References: <20240703210707.1986816-1-scott@os.amperecomputing.com> <7d7134fe-f97d-453d-b90d-fb81008fff40@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7d7134fe-f97d-453d-b90d-fb81008fff40@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240704_070859_071823_6FBEC395 X-CRM114-Status: GOOD ( 13.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jul 04, 2024 at 08:42:52AM +0530, Anshuman Khandual wrote: > On 7/4/24 02:37, D Scott Phillips wrote: > > diff --git a/arch/arm64/include/asm/sparsemem.h b/arch/arm64/include/asm/sparsemem.h > > index 8a8acc220371c..8387301f2e206 100644 > > --- a/arch/arm64/include/asm/sparsemem.h > > +++ b/arch/arm64/include/asm/sparsemem.h > > @@ -5,7 +5,7 @@ > > #ifndef __ASM_SPARSEMEM_H > > #define __ASM_SPARSEMEM_H > > > > -#define MAX_PHYSMEM_BITS CONFIG_ARM64_PA_BITS > > +#define MAX_PHYSMEM_BITS ilog2(VMEMMAP_RANGE) > > Just wondering if there is another method, which avoids selecting physical > memory ranges not backed with vmemmap. Also will reducing MAX_PHYSMEM_BITS > below ARM64_PA_BITS have other side effects ? Do other platforms have this > exact same co-relation between MAX_PHYSMEM_BITS and vmemmap range ? That's indeed a pretty weird workaround. MAX_PHYSMEM_BITS, as the name implies, is about the physical bits supported for memory while VMEMMAP_RANGE tells us the virtual address range. There is a correlation between them but they are different things conceptually. The memory hotplug code uses arch_get_mappable_range(). This should be called from the amdgpu code rather than changing MAX_PHYSMEM_BITS. -- Catalin