Bala-Vignesh-Reddy
e6fbd1759c
selftests: complete kselftest include centralization
...
This follow-up patch completes centralization of kselftest.h and
ksefltest_harness.h includes in remaining seltests files, replacing all
relative paths with a non-relative paths using shared -I include path in
lib.mk
Tested with gcc-13.3 and clang-18.1, and cross-compiled successfully on
riscv, arm64, x86_64 and powerpc arch.
[reddybalavignesh9979@gmail.com: add selftests include path for kselftest.h]
Link: https://lkml.kernel.org/r/20251017090201.317521-1-reddybalavignesh9979@gmail.com
Link: https://lkml.kernel.org/r/20251016104409.68985-1-reddybalavignesh9979@gmail.com
Signed-off-by: Bala-Vignesh-Reddy <reddybalavignesh9979@gmail.com >
Suggested-by: Andrew Morton <akpm@linux-foundation.org >
Link: https://lore.kernel.org/lkml/20250820143954.33d95635e504e94df01930d0@linux-foundation.org/
Reviewed-by: Wei Yang <richard.weiyang@gmail.com >
Cc: David Hildenbrand <david@redhat.com >
Cc: David S. Miller <davem@davemloft.net >
Cc: Eric Dumazet <edumazet@google.com >
Cc: Günther Noack <gnoack@google.com >
Cc: Jakub Kacinski <kuba@kernel.org >
Cc: Liam Howlett <liam.howlett@oracle.com >
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Mickael Salaun <mic@digikod.net >
Cc: Ming Lei <ming.lei@redhat.com >
Cc: Paolo Abeni <pabeni@redhat.com >
Cc: Shuah Khan <shuah@kernel.org >
Cc: Simon Horman <horms@kernel.org >
Cc: Suren Baghdasaryan <surenb@google.com >
Cc: Vlastimil Babka <vbabka@suse.cz >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2025-11-27 14:24:31 -08:00
Ankit Khushwaha
216158f063
selftests/user_events: fix type cast for write_index packed member in perf_test
...
Accessing 'reg.write_index' directly triggers a -Waddress-of-packed-member
warning due to potential unaligned pointer access:
perf_test.c:239:38: warning: taking address of packed member 'write_index'
of class or structure 'user_reg' may result in an unaligned pointer value
[-Waddress-of-packed-member]
239 | ASSERT_NE(-1, write(self->data_fd, ®.write_index,
| ^~~~~~~~~~~~~~~
Since write(2) works with any alignment. Casting '®.write_index'
explicitly to 'void *' to suppress this warning.
Link: https://lkml.kernel.org/r/20251106095532.15185-1-ankitkhushwaha.linux@gmail.com
Fixes: 42187bdc3c ("selftests/user_events: Add perf self-test for empty arguments events")
Signed-off-by: Ankit Khushwaha <ankitkhushwaha.linux@gmail.com >
Cc: Beau Belgrave <beaub@linux.microsoft.com >
Cc: "Masami Hiramatsu (Google)" <mhiramat@kernel.org >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: sunliming <sunliming@kylinos.cn >
Cc: Wei Yang <richard.weiyang@gmail.com >
Cc: Shuah Khan <shuah@kernel.org >
Cc: <stable@vger.kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2025-11-15 10:52:02 -08:00
Beau Belgrave
8ed99af4a2
selftests/user_events: Fix to unmount tracefs when test created mount
...
Fix to unmount tracefs if the self-test mounted it to allow testing.
If tracefs was already mounted, this does nothing.
Suggested-by: Mark Brown <broonie@kernel.org >
Link: https://lore.kernel.org/all/29fce076-746c-4650-8358-b4e0fa215cf7@sirena.org.uk/
Fixes: a06023a8f7 ("selftests/user_events: Fix failures when user_events is not installed")
Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com >
Reviewed-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org >
2023-09-18 11:04:52 -06:00
Beau Belgrave
a06023a8f7
selftests/user_events: Fix failures when user_events is not installed
...
When user_events is not installed the self tests currently fail. Now
that these self tests run by default we need to ensure they don't fail
when user_events was not enabled for the kernel being tested.
Add common methods to detect if tracefs and user_events is enabled. If
either is not enabled skip the test. If tracefs is enabled, but is not
mounted, mount tracefs and fail if there were any errors. Fail if not
run as root.
Fixes: 68b4d2d583 ("selftests/user_events: Reenable build")
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org >
Link: https://lore.kernel.org/all/CA+G9fYuugZ0OMeS6HvpSS4nuf_A3s455ecipGBvER0LJHojKZg@mail.gmail.com/
Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com >
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org >
2023-09-11 17:04:11 -06:00
sunliming
42187bdc3c
selftests/user_events: Add perf self-test for empty arguments events
...
Tests to ensure events that has empty arguments can input trace record
correctly when using perf.
Link: https://lkml.kernel.org/r/20230606062027.1008398-5-sunliming@kylinos.cn
Acked-by: Beau Belgrave <beaub@linux.microsoft.com >
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org >
Signed-off-by: sunliming <sunliming@kylinos.cn >
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org >
2023-06-14 12:41:53 -04:00
sunliming
4b56c21b11
selftests/user_events: Clear the events after perf self-test
...
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.
Link: https://lkml.kernel.org/r/20230606062027.1008398-4-sunliming@kylinos.cn
Acked-by: Beau Belgrave <beaub@linux.microsoft.com >
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org >
Signed-off-by: sunliming <sunliming@kylinos.cn >
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org >
2023-06-14 12:41:53 -04:00
Beau Belgrave
0d309f04f8
tracing/user_events: Update self-tests to write ABI
...
ABI has been changed to remote writes, update existing test cases to use
this new ABI to ensure existing functionality continues to work.
Link: https://lkml.kernel.org/r/20230328235219.203-7-beaub@linux.microsoft.com
Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com >
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org >
2023-03-29 06:52:08 -04:00
Ross Zwisler
4336cc15b9
selftests: use canonical ftrace path
...
The canonical location for the tracefs filesystem is at /sys/kernel/tracing.
But, from Documentation/trace/ftrace.rst:
Before 4.1, all ftrace tracing control files were within the debugfs
file system, which is typically located at /sys/kernel/debug/tracing.
For backward compatibility, when mounting the debugfs file system,
the tracefs file system will be automatically mounted at:
/sys/kernel/debug/tracing
A few spots in tools/testing/selftests still refer to this older debugfs
path, so let's update them to avoid confusion.
Link: https://lkml.kernel.org/r/20230313211746.1541525-1-zwisler@kernel.org
Cc: "Tobin C. Harding" <me@tobin.cc >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Shuah Khan <shuah@kernel.org >
Cc: Tycho Andersen <tycho@tycho.pizza >
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org >
Reviewed-by: Mukesh Ojha <quic_mojha@quicinc.com >
Signed-off-by: Ross Zwisler <zwisler@google.com >
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org >
2023-03-29 06:52:07 -04:00
Beau Belgrave
39d6d08b2e
tracing/user_events: Use bits vs bytes for enabled status page data
...
User processes may require many events and when they do the cache
performance of a byte index status check is less ideal than a bit index.
The previous event limit per-page was 4096, the new limit is 32,768.
This change adds a bitwise index to the user_reg struct. Programs check
that the bit at status_bit has a bit set within the status page(s).
Link: https://lkml.kernel.org/r/20220728233309.1896-6-beaub@linux.microsoft.com
Link: https://lore.kernel.org/all/2059213643.196683.1648499088753.JavaMail.zimbra@efficios.com/
Suggested-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com >
Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com >
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org >
2022-09-29 10:17:37 -04:00
Beau Belgrave
3a6163893a
user_events: Add self-test for perf_event integration
...
Tests perf can be attached to and written out correctly. Ensures attach
updates status bits in user programs.
Link: https://lkml.kernel.org/r/20220118204326.2169-10-beaub@linux.microsoft.com
Acked-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com >
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org >
2022-02-10 22:37:59 -05:00