From nobody Sat Feb 7 15:21:44 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 A5D9333AD83 for ; Tue, 20 Jan 2026 17:59:26 +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=1768931971; cv=none; b=SQjqyeya/ADohExP00HHmpDXXIQW0Bb24O7YIllLfFnMf0omby/71m5IcOvpxXFgMVjDlStbzhT23RFmjIMYiqiT3VudstfVt5fvTd/PjAFR4O41pmjNGDHKTtjKUuOiPGfk/1N7nf9mWTC6MvBzaW+SgVCvFI1ySZ3M06VZ+iM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768931971; c=relaxed/simple; bh=U3MpzNP6YgduTukqcZU7rU05IUlCSSO+ckR8MSuz9WY=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Nrf8liELvGCCqWuAqNB37Iap0eh+kpZ98DA8fNnY4vi2MyCwBReRDjtNTzK+PEm9ypx35snSHjbRqx/BfWSEoGbwoCfl/7C35PWI8O1GNTv5TIT4VNtjE7mb61xGhkgZyr8kz+0+0gY9cZf7S6dAwTkTs5iu8D0OIwjJiTb74jQ= 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=qYdLuCgk; 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="qYdLuCgk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazoncorp2; t=1768931966; x=1800467966; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=jwrVgQu8T1zQqFt9YAueQy5DCsjrQY33U9ppp5mocfU=; b=qYdLuCgka0daV6uQuk6KoKHxwviQQAWnt6r83UrcRG3owQYxpuC5QqwK rUUoYmkCK/7vj30cFAKxkNMONOXpdsDUGD5rYoHFp1btj4KEGeDIOS8C0 kDIEx3Raih8Tt2hAgdGPOqTa8fgoRk5Qz9bDpJDdICVrxBJK8z7Oxf9oC 8jfdf8g8sTjM28gaNe01l4750/Z4R7ywr9tD1quOFIa8Kb6C93tlppJQE ysYU1ajMXyOaZF2xsYYMN3ZolyYG2EqkAHh6DGgv3lbRMPNL54vHmYAHk hm23WnyqbwH5UXt2a955nfEr5Km8wpagIHaPK1TS+1/ikCygfAxNmR418 w==; X-CSE-ConnectionGUID: DOz3H3uJRdeGXpuxql/bYw== X-CSE-MsgGUID: h62isw/sQbqrB5itx0IYpw== X-IronPort-AV: E=Sophos;i="6.21,241,1763424000"; d="scan'208";a="11095148" Received: from ip-10-5-6-203.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.6.203]) by internal-pdx-out-010.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jan 2026 17:59:23 +0000 Received: from EX19MTAUWA001.ant.amazon.com [205.251.233.236:10556] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.14.244:2525] with esmtp (Farcaster) id 1f2c0798-ec03-4bf6-a1ae-8006272cbe1b; Tue, 20 Jan 2026 17:59:23 +0000 (UTC) X-Farcaster-Flow-ID: 1f2c0798-ec03-4bf6-a1ae-8006272cbe1b Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWA001.ant.amazon.com (10.250.64.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Tue, 20 Jan 2026 17:59:23 +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; Tue, 20 Jan 2026 17:59:21 +0000 From: Evangelos Petrongonas To: Mike Rapoport CC: Evangelos Petrongonas , Pasha Tatashin , Pratyush Yadav , "Alexander Graf" , Jason Miu , , , , Subject: [PATCH v2] kho: skip memoryless NUMA nodes when reserving scratch areas Date: Tue, 20 Jan 2026 17:59:11 +0000 Message-ID: <20260120175913.34368-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: EX19D036UWB002.ant.amazon.com (10.13.139.139) 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 only counting nodes that have memory (N_MEMORY state) and skip memoryless nodes in the per-node scratch allocation loop. Signed-off-by: Evangelos Petrongonas Reviewed-by: Mike Rapoport (Microsoft) Reviewed-by: Pasha Tatashin Reviewed-by: Pratyush Yadav --- v2: - Removed kho_mem_nodes_count in favour of nodes_weight(nodes_state[N_MEMOR= Y]) - Use for_each_node_state(nid, N_MEMORY) to loop over nodes that are both online and have memory. TIL: Nodes in N_MEMORY are a subset of those that are online. Thanks Mike :) kernel/liveupdate/kexec_handover.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_h= andover.c index 9dc51fab604f..979ebaf015bf 100644 --- a/kernel/liveupdate/kexec_handover.c +++ b/kernel/liveupdate/kexec_handover.c @@ -643,7 +643,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 nodes_weight(node_states[N_MEMORY]) + 2; size =3D kho_scratch_cnt * sizeof(*kho_scratch); kho_scratch =3D memblock_alloc(size, PAGE_SIZE); if (!kho_scratch) @@ -673,7 +673,11 @@ static void __init kho_reserve_scratch(void) kho_scratch[i].size =3D size; i++; =20 - for_each_online_node(nid) { + /* + * Loop over nodes that have both memory and are online. Skip + * memoryless nodes, as we can not allocate scratch areas there. + */ + for_each_node_state(nid, N_MEMORY) { 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