From nobody Sun Feb 8 18:21:14 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 D211C213226; Fri, 21 Feb 2025 15:29:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740151761; cv=none; b=HPS/zHPIvRdDi/Ysijnz9pbs3wByQUHCvM9D4WOVgvx+BPOp1U74ZhTE+MEm0WpgXWURAbFHFCV+ECpwnNquFM0HSwQBTGt44HSEvota5lIqxPitRsP5hGAd/RSzmHaIjQF1mi/xvbnuBxWANwQsjbc/tPX2BCEa35CWkx1hVJI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740151761; c=relaxed/simple; bh=gvPE8ycjeYSXnQS/h4/vFc9oPAIaybODWv+nW2SUJKs=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=kvXj7WeRT1F3yvjil4lBM6kjrUjfb9aYJ8xCoF1R036cV4mxhFFlQKxrN0swLlfb7vavLC3XXWvPEs0w3EMe6Xzc3HphLTyqVqvNaKlGJWtuUlmGWKXhakvyIIiJG4i/QoG6gowA+lNR7euNCFY0hlsGbLLDAN2KVGGil+0qya8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=gLFHHitJ; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=qfdbHsmw; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="gLFHHitJ"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="qfdbHsmw" Date: Fri, 21 Feb 2025 15:29:16 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1740151757; h=from:from:sender:sender:reply-to: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HmANWdnkLmAL8VMFwvfKur2p1nIr8KH1hojie2SY8Kk=; b=gLFHHitJfksEOBTJD+utvKQm7TBgQCLHwH+h+7AIKY2cLIlQ1lbOilFjktOuGjg/dUy9OA hVAYftaHFs+jQx83mNM0B2QYvX1hILtuQfaXAZPbGI75ixSLlyvrf6JBan0uunMQLoFErb kCmEPlHOQRirZ+IccsAfrSboyrfSo/TiSKSOJ98pmiRt3XQ/BKltiWHZTPqq8eDgychZoD fSkAyAatKUoJyaoo9oruWnED89h5pRRW7WV+Q1QKlx7X3Q6bgPzuvI/0UX6iNoMJAT29ac YvrNH3iOIcYLxniJYPDNif5VIl1JiaW4s0/II/rO8vf+gZlxsNfJ0KLKPFzjyA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1740151757; h=from:from:sender:sender:reply-to: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HmANWdnkLmAL8VMFwvfKur2p1nIr8KH1hojie2SY8Kk=; b=qfdbHsmwuNJd/yvV/LEPost8ZMVV0lb6cDpVew4CF+qOxMlwVVOxzO0yi4iEY0aYpu/lzi EFi2h+af0xQfAJCQ== From: "tip-bot2 for Mike Rapoport (Microsoft)" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/boot] x86/boot: Move setting of memblock parameters to e820__memblock_setup() Cc: "Mike Rapoport (Microsoft)" , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20250214090651.3331663-2-rppt@kernel.org> References: <20250214090651.3331663-2-rppt@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <174015175614.10177.6726520992334916379.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the x86/boot branch of tip: Commit-ID: 2d6bff31399b2443aba230cd20f120acb2d4eeb1 Gitweb: https://git.kernel.org/tip/2d6bff31399b2443aba230cd20f120acb= 2d4eeb1 Author: Mike Rapoport (Microsoft) AuthorDate: Fri, 14 Feb 2025 11:06:48 +02:00 Committer: Ingo Molnar CommitterDate: Fri, 21 Feb 2025 16:05:00 +01:00 x86/boot: Move setting of memblock parameters to e820__memblock_setup() Changing memblock parameters, namely bottom_up and allocation upper limit does not have any effect before memblock initialization in e820__memblock_setup(). Move the calls to memblock_set_bottom_up() and memblock_set_current_limit() to e820__memblock_setup() to group all the memblock initial setup and make setup_arch() more readable. No functional changes. Signed-off-by: Mike Rapoport (Microsoft) Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20250214090651.3331663-2-rppt@kernel.org --- arch/x86/kernel/e820.c | 30 ++++++++++++++++++++++++++++++ arch/x86/kernel/setup.c | 25 ------------------------- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 82b96ed..8d8bd03 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -1302,6 +1302,36 @@ void __init e820__memblock_setup(void) int i; u64 end; =20 +#ifdef CONFIG_MEMORY_HOTPLUG + /* + * Memory used by the kernel cannot be hot-removed because Linux + * cannot migrate the kernel pages. When memory hotplug is + * enabled, we should prevent memblock from allocating memory + * for the kernel. + * + * ACPI SRAT records all hotpluggable memory ranges. But before + * SRAT is parsed, we don't know about it. + * + * The kernel image is loaded into memory at very early time. We + * cannot prevent this anyway. So on NUMA system, we set any + * node the kernel resides in as un-hotpluggable. + * + * Since on modern servers, one node could have double-digit + * gigabytes memory, we can assume the memory around the kernel + * image is also un-hotpluggable. So before SRAT is parsed, just + * allocate memory near the kernel image to try the best to keep + * the kernel away from hotpluggable memory. + */ + if (movable_node_is_enabled()) + memblock_set_bottom_up(true); +#endif + + /* + * At this point only the first megabyte is mapped for sure, the + * rest of the memory cannot be used for memblock resizing + */ + memblock_set_current_limit(ISA_END_ADDRESS); + /* * The bootstrap memblock region count maximum is 128 entries * (INIT_MEMBLOCK_REGIONS), but EFI might pass us more E820 entries diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index cebee31..4baadea 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -866,30 +866,6 @@ void __init setup_arch(char **cmdline_p) if (efi_enabled(EFI_BOOT)) efi_memblock_x86_reserve_range(); =20 -#ifdef CONFIG_MEMORY_HOTPLUG - /* - * Memory used by the kernel cannot be hot-removed because Linux - * cannot migrate the kernel pages. When memory hotplug is - * enabled, we should prevent memblock from allocating memory - * for the kernel. - * - * ACPI SRAT records all hotpluggable memory ranges. But before - * SRAT is parsed, we don't know about it. - * - * The kernel image is loaded into memory at very early time. We - * cannot prevent this anyway. So on NUMA system, we set any - * node the kernel resides in as un-hotpluggable. - * - * Since on modern servers, one node could have double-digit - * gigabytes memory, we can assume the memory around the kernel - * image is also un-hotpluggable. So before SRAT is parsed, just - * allocate memory near the kernel image to try the best to keep - * the kernel away from hotpluggable memory. - */ - if (movable_node_is_enabled()) - memblock_set_bottom_up(true); -#endif - x86_report_nx(); =20 apic_setup_apic_calls(); @@ -990,7 +966,6 @@ void __init setup_arch(char **cmdline_p) =20 cleanup_highmap(); =20 - memblock_set_current_limit(ISA_END_ADDRESS); e820__memblock_setup(); =20 /*