From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1E360218AAB; Mon, 18 Aug 2025 13:04:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755522264; cv=none; b=QMNMo1cKhaewDNKEjMwyzFPuQzHCYYn80eXl5ppjx4Jh9O+iYLkIgTccWKF5FXrhnl/GFmBRdA06mpwt0H7jnafI79Tw/1v726sARQTSN4pMd+h00lWVKZx++jX9Km2+77lp/EB70qW+cd/SIz8ku0Q9w31pr7JKODkdxcO1Fqc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755522264; c=relaxed/simple; bh=L5ZDbNfwWlpF8ZqkwBMqPgbs6QltwPtOVMU2WSCRMmI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C8Q3SFtpXvo3f9dIML8jC5kmFInk4JL+A7SzGaY8mvQZg7i9d2+9UyuriwKQSbvfM5gwqVUP2Qzgdhm0ObrH+S7AQNpfVesjboLhGbfEPdIAUZL3fG8PtWg7UbVz/KUz9FIoJ247p+YS5beYSH/kmyDrKV1P1khxa5DIFtxPUcQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=gsZRLLUB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="gsZRLLUB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35F0FC4CEEB; Mon, 18 Aug 2025 13:04:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1755522263; bh=L5ZDbNfwWlpF8ZqkwBMqPgbs6QltwPtOVMU2WSCRMmI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gsZRLLUB/fN6VYT6h16ZpgeQAkJ6Ji9FX7lXQXf4rEo8/CmS1UC+YoBPVGQ7GFdlF GFEpQ4WTLdbNsfTcyYJy2xtpKVoMlGdGlmUVGRPX1Anebk+p6Tj0x9K/CKI/CqDgf6 yjMqn4FmQknZGTb3vWlVccqbCFMijTTeHmzuOe7U= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yonghong Song , Alexei Starovoitov , Sasha Levin Subject: [PATCH 6.12 265/444] selftests/bpf: Fix a user_ringbuf failure with arm64 64KB page size Date: Mon, 18 Aug 2025 14:44:51 +0200 Message-ID: <20250818124458.760032497@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250818124448.879659024@linuxfoundation.org> References: <20250818124448.879659024@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yonghong Song [ Upstream commit bbc7bd658ddc662083639b9e9a280b90225ecd9a ] The ringbuf max_entries must be PAGE_ALIGNED. See kernel function ringbuf_map_alloc(). So for arm64 64KB page size, adjust max_entries properly. Signed-off-by: Yonghong Song Link: https://lore.kernel.org/r/20250607013626.1553001-1-yonghong.song@linux.dev Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin --- tools/testing/selftests/bpf/prog_tests/user_ringbuf.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c b/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c index d424e7ecbd12..9fd3ae987321 100644 --- a/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c +++ b/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c @@ -21,8 +21,7 @@ #include "../progs/test_user_ringbuf.h" static const long c_sample_size = sizeof(struct sample) + BPF_RINGBUF_HDR_SZ; -static const long c_ringbuf_size = 1 << 12; /* 1 small page */ -static const long c_max_entries = c_ringbuf_size / c_sample_size; +static long c_ringbuf_size, c_max_entries; static void drain_current_samples(void) { @@ -424,7 +423,9 @@ static void test_user_ringbuf_loop(void) uint32_t remaining_samples = total_samples; int err; - BUILD_BUG_ON(total_samples <= c_max_entries); + if (!ASSERT_LT(c_max_entries, total_samples, "compare_c_max_entries")) + return; + err = load_skel_create_user_ringbuf(&skel, &ringbuf); if (err) return; @@ -686,6 +687,9 @@ void test_user_ringbuf(void) { int i; + c_ringbuf_size = getpagesize(); /* 1 page */ + c_max_entries = c_ringbuf_size / c_sample_size; + for (i = 0; i < ARRAY_SIZE(success_tests); i++) { if (!test__start_subtest(success_tests[i].test_name)) continue; -- 2.39.5