From nobody Mon Apr 6 22:15:24 2026 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D1753E5ED6 for ; Tue, 17 Mar 2026 15:39:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773761964; cv=none; b=tdFUWxSv/h8VLznCEKMkeZcIBe0uvw42aeyD9u9OMjSAzugJVpzuOk+QOXMO1rJpf9lLEiUWPPhysep/7sMHCEbW5QV+XpeMpxeEahzwP3HHJ2tJnhr4QFkz37q1zNdlJW/CZPUPuiflvUQ8abhWQVFHMuD3cu3/wki+sr7eP7E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773761964; c=relaxed/simple; bh=6cWn416EBt/Equz53a0WTwlw8W2X10yKgX8A4O9mkrQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KjaT4VlMMpb3H7s/d4AkchHfJJTJbXIH4gv21d2eXMibJVD3qgJYfvW1yEh4NdgV/TfMUsU0S5zGcdtz/uySzakdB1uKr4PBvAWHu6VHu0l/yBLKDGqqty0iQu5lHsHvC9ygppqVm7Rjeb7iGHqH/26h+Xte0JyuKvgHRUljd0Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bnrFKpEA; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bnrFKpEA" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-43b41b545d9so3126854f8f.2 for ; Tue, 17 Mar 2026 08:39:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773761960; x=1774366760; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zGDw3mCOpCc6cSFLVeGgVYfFjgSH1lkUmCd0o6DcLPc=; b=bnrFKpEALkBKreOxY2gHsfU0BYuzGl1CC49p7SQY+v5kRPJEAezXK4B/u8rWduQOrs eze4DmteJZbAZ1PQIFy/b/yLZI5sosb/rODejFpUWYbXmhIbBevE4g86rPZKHpqqig2Y WbhvGlmGIpKPjNoJd65x8rpNRoGUwJVVh34SLhjSDbqG6LixvbBdVP9CU9elVZWd6wEw QElkt3WCydzgzQXJXZhrO3U7XkHiwc3AhSXWCMXzaMvSAzhVVc2vaIE++qbs+RBQYevK Faw8mRI4XI1s8m6+L+mcPnRHIcEx2gEVdPAVt+II4p4FZJmxvxVSTQU3OuOFBJPV9v89 Z8OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773761960; x=1774366760; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=zGDw3mCOpCc6cSFLVeGgVYfFjgSH1lkUmCd0o6DcLPc=; b=K60zWsS9Etnrv+1lgDlvbJcJ8r7MdKbon1JuY6gMc+5cLKWpN+/ACCivHH1CAkC0O3 QpmVCoaQTGwdY2Cwe+eyquVrxCfMwbOnL750cMIFg+7fSZNbqQR68M/CLmoUUEKoyHJA 49qJ9A0zfbQ9mhVF5G9Oo4QS+6hWM04Sq+x3P0JpK3t/PnWKey/Nk4PRIjojVlfQ/UBp roZHdGU6rzWD4gZp3gLM8rpsE83IB9o08usen8FIOfVO27CFEAeAq3qmmQxUBnwGBXmZ lwNE2TRluinuBqsmgOcbdc+qLi846IMGf6xsCOpvxk8dx98Ivbda00RbHYbK2oHuPl/A LBoA== X-Gm-Message-State: AOJu0YzVD6KxNPGp30dIBKhaCUujiD7bRnpKUumMnr2EfmkKPaPYj+Rz LkB9YR9U5dwG0n0J3dhem58uJkDIj8hSXNW+QolI/Kr+9nyXWQVycTBg X-Gm-Gg: ATEYQzyG9kaeZ0xIDfqbYkPNChY+/4CxM1/O+aZ6WHEuhCSfESlo3y5l0jYfSAmBNjd KQokSQWvk1U6g3kxSjxAAevipsVxFjZqef5KPkLc275CLFGWwaO6qmhZWjcS/aFW24t48fMfhvk frlT6CtQYH1U5fWWVYdAGj8GL5Cmh++HojSVNY53q2M3CiUp5VugVVl4UJNLqdahlj9283JZvqq sYaDGeA/EPViUW9irvSzs9R+CH8p4QnCGYj6ka85bQwLz2CjR2THoasQXJCaRgmhKVGnhYg+Xxk hW0Znr6CDwJEJu9MGtm4tOYPBRuYj4VTSN6LGiFV39n12+WmAaQaDRkdNeOufYT3Gt7gHoh2xE4 Wd2NaTBGjEX+54VeE0Yw9GlpNbDhFmi+pYOYTlCJ31YfAIOjyzXZkpbhhyl85uYY0rD0QmpIfQk 36ZZ14zLAXOw5lA0gyZns/FbpkxzX6Egn8tQEoFX8rf7ou5FtL/mxrnuy1ngfh3MNzbLO4fLpBo OsIsJCnqmYq X-Received: by 2002:a05:6000:310d:b0:439:c42f:10c4 with SMTP id ffacd0b85a97d-43a04d8c249mr32706990f8f.15.1773761959547; Tue, 17 Mar 2026 08:39:19 -0700 (PDT) Received: from dohko.chello.ie (188-141-5-72.dynamic.upc.ie. [188.141.5.72]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43b51805291sm361316f8f.0.2026.03.17.08.39.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2026 08:39:19 -0700 (PDT) From: David Carlier To: Andrew Morton , Mathieu Desnoyers , Josh Law , Mark Brown Cc: linux-kernel@vger.kernel.org, David Carlier Subject: [PATCH] lib: skip percpu_counter_tree boundary kunit tests on single-CPU Date: Tue, 17 Mar 2026 15:39:15 +0000 Message-ID: <20260317153915.43559-1-devnexen@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260317150638.37438-1-devnexen@gmail.com> References: <20260317150638.37438-1-devnexen@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On single-CPU topologies, accuracy_multiplier is zero, making both approx_accuracy_range.under and .over zero. The boundary tests in hpcc_test_compare_value_boundaries and hpcc_test_compare_counter_boundaries then degenerate to comparing 0 vs 0, which correctly returns 0 (equal) but the tests expect nonzero results. Skip these boundary tests with kunit_skip() when accuracy is zero, since approximation boundaries are meaningless without multi-CPU carry propagation. Use percpu_counter_tree_items_size() as the topology check before any allocations to avoid leaking memory on skip. Fixes: ebc1ff504f55 ("lib: add kunit boundary tests for percpu_counter_tree= comparisons") Signed-off-by: David Carlier Reviewed-by: Mark Brown Reviewed-by: Mathieu Desnoyers --- lib/tests/percpu_counter_tree_kunit.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/tests/percpu_counter_tree_kunit.c b/lib/tests/percpu_count= er_tree_kunit.c index 4d058bc78f7d..b773d20867d4 100644 --- a/lib/tests/percpu_counter_tree_kunit.c +++ b/lib/tests/percpu_counter_tree_kunit.c @@ -93,6 +93,9 @@ static void hpcc_test_compare_value_boundaries(struct kun= it *test) unsigned long under =3D 0, over =3D 0; int ret; =20 + if (!percpu_counter_tree_items_size()) + kunit_skip(test, "no approximation accuracy on single-CPU topology"); + counter_items =3D kzalloc(percpu_counter_tree_items_size(), GFP_KERNEL); KUNIT_ASSERT_PTR_NE(test, counter_items, NULL); ret =3D percpu_counter_tree_init(&pct, counter_items, 32, GFP_KERNEL); @@ -197,6 +200,9 @@ static void hpcc_test_compare_counter_boundaries(struct= kunit *test) unsigned long combined; int ret; =20 + if (!percpu_counter_tree_items_size()) + kunit_skip(test, "no approximation accuracy on single-CPU topology"); + counter_items =3D kzalloc(percpu_counter_tree_items_size() * 2, GFP_KERNEL); KUNIT_ASSERT_PTR_NE(test, counter_items, NULL); --=20 2.53.0