From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796396677; b=MPYTBMi2CqIAvwvAUbCPjmf8TnZ67nfHNM4XA+rJSKjKpIo436czi8uj9zpqnqtGyhMe KK+goQch/5K1NLpOF3zeQSrnwaNF21bJVbSsGgOuHzt5L0r8xNlv6wuj7DbYGO+7F+iMS 6tAfGhG2aoas1UerAo+4W5hP/TmgxQoUCjlgUArAzz2X4Pwv5Kk7YBxBzirNsJG4DTJa7 QSTVIeGuR9KiQWm4kyQISXOT1lU9PP4QIIZ3lVq8l8kA26MRLG2z5GqcPcf+NqZ5RoWPj W6UnEM6xFLhwQehrQGl7j5+K27QTzevSkBXY0oe9cPY/xCqunA3PusBof9V0ORNGPZg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796396677; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=Xbezpu7tt92B0am7MmpoYMCeCjCzcqStUdlcbyKrDIs=; b=AwN2k0Weavo723E+lymBM8vvkbHL71gpmxC7s/tSzP1mYY1MTuObEqTMPbEmSn9DMzJX 611+VxI8d7I1fNTfAgSh298wcgywXkJ7gWKf2t2DUhNKPQwgzhQBv0pBdBXX+JEUVTO2h pvqQqkih0W6aLqaMXSHdC8BkPT8mIjDOfeUS9yd8aHW85thdsG4PUhjUMglnUfLJ+WKB6 eCgm2iLL72X2Y0NQPxnr7Ydle7+1HSkywkfTi1VKadSmqNik0aiSjWPGTkpDZPZrvo7hk eyfGC95KxM6Yq70+qVJ1T+qVEILiHLHBJ1W8R2h7rhF0OVbd9lQPr1cZbasQPizWFVQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Dz5ZOiBX; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 431AE606A322 for ; Fri, 4 Dec 2026 15:04:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Dz5ZOiBX Received: by smtp.kernel.org (Postfix) with ESMTPSA id 104DB1F000C2; Fri, 4 Dec 2026 15:04:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796396677; bh=Xbezpu7tt92B0am7MmpoYMCeCjCzcqStUdlcbyKrDIs=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Dz5ZOiBXbIYMBajglBhOk1MCKGDsCL68dcDZOZRKT0jIMJHSUiyDLeEqrCC81vkuY XhN83n26gN1sy5/vWwIgcpNvCu4sNZyuluEzOvK8PHWw55U/qvSq54O6U9khrdRQjE MSXtTtahkeUaEtv/gnTMGfn54gUhP4dYgEYG5UNgcwAxw7U/kxAikfn0/ZwmXizpaT FJe9bAHuZBt62B4pzORBnrT50XfUwHsAtLFSGPGndiFc24aq+HfniuBi56S+OHkS9B cD8w1XdQkXi/SnlU4XmjS6q1Hjuggvi5HL5+g8f/m6sJtzJ7GXvv4pE0EnIRbvcX3W F9copDu8QwQuQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] hwmon: (coretemp) Fix missing sensors with uneven core counts Reply-To: sashiko-reviews@lists.linux.dev To: "Aveline Noir" Cc: linux-hwmon@vger.kernel.org In-Reply-To: <20261205-coretemp-core-limit-v1-1-a7020e0e4208@gmail.com> References: <20261205-coretemp-core-limit-v1-1-a7020e0e4208@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 15:04:36 +0000 X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] hwmon: (coretemp) oversized contiguous core_data array in init_temp_data() -- commit b4264371dd35960dd3d06c662f4625da35ac4376 Author: Aveline Noir hwmon: (coretemp) Fix missing sensors with uneven core counts This commit changes init_temp_data() to size the per-zone pdata->core_data array using num_possible_cpus() instead of topology_num_cores_per_package(), so packages with more cores than the first package do not run out of sensor slots. > diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c > index 96d57fe12de6d..2353d2d096e7c 100644 > --- a/drivers/hwmon/coretemp.c > +++ b/drivers/hwmon/coretemp.c > @@ -491,7 +491,8 @@ init_temp_data(struct platform_data *pdata, unsigned = int cpu, int pkg_flag) > struct temp_data *tdata; > =20 > if (!pdata->core_data) { > - int nr_cores =3D topology_num_cores_per_package(); > + /* Packages can have different numbers of cores */ > + int nr_cores =3D num_possible_cpus(); > =20 > pdata->core_data =3D kzalloc_objs(struct temp_data *, nr_cores); > if (!pdata->core_data) [Severity: Medium] Can sizing pdata->core_data to num_possible_cpus() cause high-order allocation failures and excessive per-zone memory use? On x86_64 systems with more than 4096 possible CPUs (up to 8192 under CONFIG_CPUMASK_OFFSTACK), kzalloc_objs(struct temp_data *, nr_cores) requests an order-4 contiguous allocation (up to 64 KiB), exceeding PAGE_ALLOC_COSTLY_ORDER. Because destroy_temp_data() frees pdata->core_data when all housekeeping CPUs in a zone go offline, re-onlining a CPU or loading coretemp on fragmented memory can stall compaction or fail with -ENOMEM, leaving cores without temperature sensors. coretemp_init() creates one zone per package and die, so every zone now allocates slots for all packages, dies, and SMT siblings, scaling total memory as O(max_zones * num_possible_cpus()). get_temp_data() also linearly scans all pdata->nr_cores entries on every coretemp_cpu_offline() call, so misses on isolated CPUs skipped by coretemp_cpu_online() scan all num_possible_cpus() mostly-NULL slots. Since pdata->core_data is only used internally for lookup in get_temp_data(), replacing the fixed array and pdata->ida with a list_head or xarray (or at minimum using kvzalloc_objs()/kvfree()) would avoid the costly-order allocation and per-zone over-sizing. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205-coretemp-c= ore-limit-v1-1-a7020e0e4208@gmail.com?part=3D1