linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vincent Donnefort <vdonnefort@google.com>
To: rostedt@goodmis.org
Cc: mhiramat@kernel.org, linux-kernel@vger.kernel.org,
	 linux-trace-kernel@vger.kernel.org, kernel-team@android.com,
	 Vincent Donnefort <vdonnefort@google.com>,
	Shuah Khan <skhan@linuxfoundation.org>,
	 linux-kselftest@vger.kernel.org
Subject: [PATCH RESEND 1/2] ring-buffer/selftest: Verify the entire meta-page padding
Date: Tue, 10 Sep 2024 17:23:34 +0100	[thread overview]
Message-ID: <20240910162335.2993310-2-vdonnefort@google.com> (raw)
In-Reply-To: <20240910162335.2993310-1-vdonnefort@google.com>

Improve the ring-buffer meta-page test coverage by checking for the
entire padding region to be 0 instead of just looking at the first 4
bytes.

Cc: Shuah Khan <skhan@linuxfoundation.org>
Cc: linux-kselftest@vger.kernel.org
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>

diff --git a/tools/testing/selftests/ring-buffer/map_test.c b/tools/testing/selftests/ring-buffer/map_test.c
index 4bb0192e43f3..ba12fd31de87 100644
--- a/tools/testing/selftests/ring-buffer/map_test.c
+++ b/tools/testing/selftests/ring-buffer/map_test.c
@@ -231,15 +231,15 @@ TEST_F(map, data_mmap)
 
 	/* Verify meta-page padding */
 	if (desc->meta->meta_page_size > getpagesize()) {
-		void *addr;
-
 		data_len = desc->meta->meta_page_size;
 		data = mmap(NULL, data_len,
 			    PROT_READ, MAP_SHARED, desc->cpu_fd, 0);
 		ASSERT_NE(data, MAP_FAILED);
 
-		addr = (void *)((unsigned long)data + getpagesize());
-		ASSERT_EQ(*((int *)addr), 0);
+		for (int i = desc->meta->meta_struct_len;
+		     i < desc->meta->meta_page_size; i += sizeof(int))
+			ASSERT_EQ(*(int *)(data + i), 0);
+
 		munmap(data, data_len);
 	}
 }
-- 
2.46.0.598.g6f2099f65c-goog


  reply	other threads:[~2024-09-10 16:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-10 16:23 [PATCH RESEND 0/2] ring-buffer/selftest: Meta-page testing improvements Vincent Donnefort
2024-09-10 16:23 ` Vincent Donnefort [this message]
2024-09-10 16:45   ` [PATCH RESEND 1/2] ring-buffer/selftest: Verify the entire meta-page padding Steven Rostedt
2024-09-10 18:49     ` Shuah Khan
2024-09-11  7:52       ` Vincent Donnefort
2024-09-11 16:05         ` Shuah Khan
2024-09-11 16:20         ` Steven Rostedt
2024-09-10 16:23 ` [PATCH RESEND 2/2] ring-buffer/selftest: Handle meta-page bigger than the system Vincent Donnefort
2024-09-10 16:45   ` Steven Rostedt
2024-09-10 18:50     ` Shuah Khan
2024-09-11 16:07       ` Shuah Khan
2024-09-11 16:21         ` Steven Rostedt
2024-09-10 16:44 ` [PATCH RESEND 0/2] ring-buffer/selftest: Meta-page testing improvements Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240910162335.2993310-2-vdonnefort@google.com \
    --to=vdonnefort@google.com \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).