This series patches fix the incorrect trace record for empty arguments
events and add correspondent selftests.
V3:
Improve modification descriptions to maintain consistent formatting
v2:
Change "i->count" to "i->count !=0 " to prevent compiler optimization
Add correspondent selftests
sunliming (4):
tracing/user_events: Fix the incorrect trace record for empty
arguments events
selftests/user_events: Add ftrace self-test for empty arguments events
selftests/user_events: Clear the events after perf self-test
selftests/user_events: Add perf self-test for empty arguments events
kernel/trace/trace_events_user.c | 4 +-
.../selftests/user_events/ftrace_test.c | 33 ++++++++
.../testing/selftests/user_events/perf_test.c | 82 +++++++++++++++++++
3 files changed, 117 insertions(+), 2 deletions(-)
--
2.25.1
When the self test is completed, perf self-test left the user events not to
be cleared. Clear the events by unregister and delete the event.
Signed-off-by: sunliming <[email protected]>
---
.../testing/selftests/user_events/perf_test.c | 29 +++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/tools/testing/selftests/user_events/perf_test.c b/tools/testing/selftests/user_events/perf_test.c
index a070258d4449..e97f24ab6e2f 100644
--- a/tools/testing/selftests/user_events/perf_test.c
+++ b/tools/testing/selftests/user_events/perf_test.c
@@ -81,6 +81,32 @@ static int get_offset(void)
return offset;
}
+static int clear(int *check)
+{
+ struct user_unreg unreg = {0};
+
+ unreg.size = sizeof(unreg);
+ unreg.disable_bit = 31;
+ unreg.disable_addr = (__u64)check;
+
+ int fd = open(data_file, O_RDWR);
+
+ if (fd == -1)
+ return -1;
+
+ if (ioctl(fd, DIAG_IOCSUNREG, &unreg) == -1)
+ if (errno != ENOENT)
+ return -1;
+
+ if (ioctl(fd, DIAG_IOCSDEL, "__test_event") == -1)
+ if (errno != ENOENT)
+ return -1;
+
+ close(fd);
+
+ return 0;
+}
+
FIXTURE(user) {
int data_fd;
int check;
@@ -93,6 +119,9 @@ FIXTURE_SETUP(user) {
FIXTURE_TEARDOWN(user) {
close(self->data_fd);
+
+ if (clear(&self->check) != 0)
+ printf("WARNING: Clear didn't work!\n");
}
TEST_F(user, perf_write) {
--
2.25.1
On Tue, Jun 06, 2023 at 02:20:23PM +0800, sunliming wrote:
> This series patches fix the incorrect trace record for empty arguments
> events and add correspondent selftests.
>
> V3:
> Improve modification descriptions to maintain consistent formatting
>
> v2:
> Change "i->count" to "i->count !=0 " to prevent compiler optimization
> Add correspondent selftests
>
> sunliming (4):
> tracing/user_events: Fix the incorrect trace record for empty
> arguments events
> selftests/user_events: Add ftrace self-test for empty arguments events
> selftests/user_events: Clear the events after perf self-test
> selftests/user_events: Add perf self-test for empty arguments events
>
> kernel/trace/trace_events_user.c | 4 +-
> .../selftests/user_events/ftrace_test.c | 33 ++++++++
> .../testing/selftests/user_events/perf_test.c | 82 +++++++++++++++++++
> 3 files changed, 117 insertions(+), 2 deletions(-)
>
> --
> 2.25.1
Thank you, this series looks good to me.
Acked-by: Beau Belgrave <[email protected]>
Thanks,
-Beau
On Tue, 6 Jun 2023 14:20:23 +0800
sunliming <[email protected]> wrote:
> This series patches fix the incorrect trace record for empty arguments
> events and add correspondent selftests.
Looks good for me.
Acked-by: Masami Hiramatsu (Google) <[email protected]>
for the series.
>
> V3:
> Improve modification descriptions to maintain consistent formatting
>
> v2:
> Change "i->count" to "i->count !=0 " to prevent compiler optimization
> Add correspondent selftests
>
> sunliming (4):
> tracing/user_events: Fix the incorrect trace record for empty
> arguments events
> selftests/user_events: Add ftrace self-test for empty arguments events
> selftests/user_events: Clear the events after perf self-test
> selftests/user_events: Add perf self-test for empty arguments events
>
> kernel/trace/trace_events_user.c | 4 +-
> .../selftests/user_events/ftrace_test.c | 33 ++++++++
> .../testing/selftests/user_events/perf_test.c | 82 +++++++++++++++++++
> 3 files changed, 117 insertions(+), 2 deletions(-)
>
> --
> 2.25.1
>
--
Masami Hiramatsu (Google) <[email protected]>