From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9726C189B9D; Wed, 16 Apr 2025 07:51:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744789919; cv=none; b=Nkl8+HoFcB8bMqDo0iS+It4gIAgoebvBOEK9ST3KpsLZAdeO95GkWfrsQlgrKN7L43wtO34mQgmVdG8sWqj8OBaz2upxBpi/7S2o0r1Gq7nlQzkMLibBhQBnkfz/Ns7r+YlvwW3BAaakYknZFUnw0vWj7Srzt1pUnIBDz9koZt0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744789919; c=relaxed/simple; bh=iLOvCfHAlkl2qqlJ2x0ADYafFrSh4AKEbA4z06zylDk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JT2SlWTkFl+7Z0e1tsU29H9NyjwxLvJLCzq1TiB0cptbf0RTKxE09tUtoQ7jhigW2vrYYcLicjN1cXq2dqRCnXtsbFRTTwMYgodeIMKILxQ3eZSI8cgdzavrHeqSHhYuDIzFbq1VxsKZgfVnadni693y0qrm1Lz/rBj4WKrU9gA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=V6ESEMQL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="V6ESEMQL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16D5EC4CEE9; Wed, 16 Apr 2025 07:51:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744789919; bh=iLOvCfHAlkl2qqlJ2x0ADYafFrSh4AKEbA4z06zylDk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=V6ESEMQLt+0taO4/Ie3NZ0+cQyX6mhGocswhyaFyACEDvXDIzhQGzVKIZFdWfr+54 AJYH/jMu7t1K5H1Ajgo7XDOjV/lITEXcrzttJagShpyrQSXK4ZkH2XZDcAX5SFOcbU 2+HZpqxN9gyfWKnxqyS6+7H3XwjPSQOTHcpa87GFIoFaCgBO5t3UDuUdouG3REE93g x+cd/NSh3FQAFdx4K+xqqj7syyG9js7QC2QUmmeH1eAus8LE3JGvICdMkZ6W5vQt+y ztoellq8oR4pUh2xuhvYn0MGroaTPgpbRoUbvmnlNkxrJAO4m1bZL+hcOFv8rfGIVQ 2PAw602YCZq7w== Date: Wed, 16 Apr 2025 09:51:53 +0200 From: Ingo Molnar To: Dave Hansen Cc: Mike Rapoport , linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org, Arnd Bergmann , Andy Shevchenko , Arnd Bergmann , Davide Ciminaghi , "H. Peter Anvin" , Linus Torvalds , Matthew Wilcox , Paolo Bonzini , Sean Christopherson , kvm@vger.kernel.org, x86@kernel.org Subject: Re: [tip: x86/urgent] x86/e820: Discard high memory that can't be addressed by 32-bit systems Message-ID: References: <20250413080858.743221-1-rppt@kernel.org> <174453620439.31282.5525507256376485910.tip-bot2@tip-bot2> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: * Ingo Molnar wrote: > > * Dave Hansen wrote: > > > On 4/15/25 00:18, Mike Rapoport wrote: > > >> How about we reuse 'MAX_NONPAE_PFN' like this: > > >> > > >> if (IS_ENABLED(CONFIG_X86_32)) > > >> memblock_remove(PFN_PHYS(MAX_NONPAE_PFN), -1); > > >> > > >> Would that make the connection more obvious? > > > Yes, that's better. Here's the updated patch: > > > > Looks, great. Thanks for the update and the quick turnaround on the > > first one after the bug report! > > > > Tested-by: Dave Hansen > > Acked-by: Dave Hansen > > I've amended the fix in tip:x86/urgent accordingly and added your tags, > thanks! So I had to apply the fix below as well, due to this build failure on x86-defconfig: arch/x86/kernel/e820.c:1307:42: error: ‘MAX_NONPAE_PFN’ undeclared (first use in this function); did you mean ‘MAX_DMA_PFN’? IS_ENABLED(CONFIG_X86_32) can only be used when the code is syntactically correct on !CONFIG_X86_32 kernels too - which it wasn't. So I went for the straightforward #ifdef block instead. Thanks, Ingo ===========> arch/x86/kernel/e820.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index de6238886cb2..c984be8ee060 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -1299,13 +1299,14 @@ void __init e820__memblock_setup(void) memblock_add(entry->addr, entry->size); } +#ifdef CONFIG_X86_32 /* * Discard memory above 4GB because 32-bit systems are limited to 4GB * of memory even with HIGHMEM. */ - if (IS_ENABLED(CONFIG_X86_32)) - memblock_remove(PFN_PHYS(MAX_NONPAE_PFN), -1); + memblock_remove(PFN_PHYS(MAX_NONPAE_PFN), -1); +#endif /* Throw away partial pages: */ memblock_trim_memory(PAGE_SIZE);