From nobody Sat Feb 7 23:23:02 2026 Received: from pdx-out-010.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-010.esa.us-west-2.outbound.mail-perimeter.amazon.com [52.12.53.23]) (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 01C6086250 for ; Fri, 16 Jan 2026 11:27:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=52.12.53.23 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768562882; cv=none; b=IXYhNK+/oNTgKMZiyEn0yHqTfyq0rW3ptrDIq3YSpYaYf+M1XJc4Ad3vuF+vbHdVXYB0jMGJsB3hVWCE/dRKH6w7suPYnCOnPY0efD3FffA2cBNWvOivkkaT/MohQw8aXs07TdDjqkL6qdLYu/0562AI/Yrxfx4hjy3UPwwwmOE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768562882; c=relaxed/simple; bh=cYlgwHNt/l8t4iKlYirPWzaN2SK00tksJiCVXZUAmHY=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=W48yc+Gvebt6WpMm2auX5MYV72R9lCHCHtYlAhKMDXtYlVzZnsJu8wo7wbUPr0OgkgI3XCFRp5TTGkUqplQ8ydghJB+cU82mPBWdURmUAsyCEaJzA9WWN4FBK0cLb7kHonkWz2tL4ur5ZsxKzX4uXDNieqP8S8hG5Fgw/Z9SmRQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.de; spf=pass smtp.mailfrom=amazon.de; dkim=pass (2048-bit key) header.d=amazon.de header.i=@amazon.de header.b=Y/AeMyhN; arc=none smtp.client-ip=52.12.53.23 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.de header.i=@amazon.de header.b="Y/AeMyhN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazoncorp2; t=1768562878; x=1800098878; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=qG4MzEbXGT3z4AyiZSiGB/Kf0T7fme7tElgC/AQRTv4=; b=Y/AeMyhNBwN1WyAnmihqtg3exphu870gfF4dESKthFbYC/qQKt8lVWHX L+Qhp2DJW5zuRasRs3fJhhC4y5I6bQzQle8Vpp1pR+ZEswHbeL9llSsPL Hvnbk1KAg9Craawl+N271ZM0AJSkh0gaI+ANoKvu0q2zb24cKNsH+xGJF AJziPhMyI5ioxpVPp/dlY0mSiqFXR/FQSo84HhRzZd7F1w+udA5xVD60k HORigfMnH9eOqvoKA2P60zccoxSYqZfPI6vCmx4mqrlz7mDMp+TU2/Fi8 a8NzN8CNG5ll1MDeBeiTH43o5NrdEJVoYUviz95ph0P43zHxsSmLjrgIL g==; X-CSE-ConnectionGUID: kYRm3ihZSdOkaD7jQUuX3A== X-CSE-MsgGUID: CLKyTbR+QlGW1oobF33dUw== X-IronPort-AV: E=Sophos;i="6.21,230,1763424000"; d="scan'208";a="10862801" Received: from ip-10-5-0-115.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.0.115]) by internal-pdx-out-010.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2026 11:27:55 +0000 Received: from EX19MTAUWC001.ant.amazon.com [205.251.233.105:5994] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.60.191:2525] with esmtp (Farcaster) id a6631774-5337-46bf-80a0-011e601a8a40; Fri, 16 Jan 2026 11:27:54 +0000 (UTC) X-Farcaster-Flow-ID: a6631774-5337-46bf-80a0-011e601a8a40 Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWC001.ant.amazon.com (10.250.64.174) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Fri, 16 Jan 2026 11:27:54 +0000 Received: from dev-dsk-epetron-1c-1d4d9719.eu-west-1.amazon.com (10.253.109.105) by EX19D001UWA001.ant.amazon.com (10.13.138.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Fri, 16 Jan 2026 11:27:52 +0000 From: Evangelos Petrongonas To: Mike Rapoport CC: Evangelos Petrongonas , Pasha Tatashin , Pratyush Yadav , "Alexander Graf" , Jason Miu , , , , Subject: [PATCH] kho: skip memoryless NUMA nodes when reserving scratch areas Date: Fri, 16 Jan 2026 11:26:35 +0000 Message-ID: <20260116112640.64900-1-epetron@amazon.de> X-Mailer: git-send-email 2.47.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: EX19D043UWC002.ant.amazon.com (10.13.139.222) To EX19D001UWA001.ant.amazon.com (10.13.138.214) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" kho_reserve_scratch() iterates over all online NUMA nodes to allocate per-node scratch memory. On systems with memoryless NUMA nodes (nodes that have CPUs but no memory), memblock_alloc_range_nid() fails because there is no memory available on that node. This causes KHO initialization to fail and kho_enable to be set to false. Some ARM64 systems have NUMA topologies where certain nodes contain only CPUs without any associated memory. These configurations are valid and should not prevent KHO from functioning. Fix this by introducing kho_mem_nodes_count() which counts only nodes that have memory (N_MEMORY state), and skip memoryless nodes in the per-node scratch allocation loop. Signed-off-by: Evangelos Petrongonas --- kernel/liveupdate/kexec_handover.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_h= andover.c index 9dc51fab604f..c970ed08b477 100644 --- a/kernel/liveupdate/kexec_handover.c +++ b/kernel/liveupdate/kexec_handover.c @@ -623,6 +623,23 @@ static phys_addr_t __init scratch_size_node(int nid) return round_up(size, CMA_MIN_ALIGNMENT_BYTES); } =20 +/* + * Count online NUMA nodes that have memory. Memoryless nodes cannot have + * scratch memory and should be excluded. + */ +static unsigned int __init kho_mem_nodes_count(void) +{ + unsigned int cnt =3D 0; + int nid; + + for_each_online_node(nid) { + if (node_state(nid, N_MEMORY)) + cnt++; + } + + return cnt; +} + /** * kho_reserve_scratch - Reserve a contiguous chunk of memory for kexec * @@ -643,7 +660,7 @@ static void __init kho_reserve_scratch(void) scratch_size_update(); =20 /* FIXME: deal with node hot-plug/remove */ - kho_scratch_cnt =3D num_online_nodes() + 2; + kho_scratch_cnt =3D kho_mem_nodes_count() + 2; size =3D kho_scratch_cnt * sizeof(*kho_scratch); kho_scratch =3D memblock_alloc(size, PAGE_SIZE); if (!kho_scratch) @@ -674,6 +691,10 @@ static void __init kho_reserve_scratch(void) i++; =20 for_each_online_node(nid) { + /* Skip memoryless nodes - we cannot allocate scratch memory there */ + if (!node_state(nid, N_MEMORY)) + continue; + size =3D scratch_size_node(nid); addr =3D memblock_alloc_range_nid(size, CMA_MIN_ALIGNMENT_BYTES, 0, MEMBLOCK_ALLOC_ACCESSIBLE, --=20 2.43.0 Amazon Web Services Development Center Germany GmbH Tamara-Danz-Str. 13 10243 Berlin Geschaeftsfuehrung: Christof Hellmis, Andreas Stieger Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B Sitz: Berlin Ust-ID: DE 365 538 597