|
Revision tags: v6.15, v6.15-rc7, v6.15-rc6, v6.15-rc5, v6.15-rc4, v6.15-rc3, v6.15-rc2, v6.15-rc1, v6.14, v6.14-rc7, v6.14-rc6, v6.14-rc5 |
|
| #
2158599a |
| 25-Feb-2025 |
Masami Hiramatsu (Google) <[email protected]> |
samples: add hung_task detector mutex blocking sample
Add a hung_task detector mutex blocking test sample code.
This module will create a dummy file on the debugfs. That file will cause the read p
samples: add hung_task detector mutex blocking sample
Add a hung_task detector mutex blocking test sample code.
This module will create a dummy file on the debugfs. That file will cause the read process to sleep for enough long time (256 seconds) while holding a mutex. As a result, the second process will wait on the mutex for a prolonged duration and be detected by the hung_task detector.
Usage is;
> cd /sys/kernel/debug/hung_task > cat mutex & cat mutex
and wait for hung_task message.
[[email protected]: make `hung_task_dir' static] Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Link: https://lkml.kernel.org/r/174046696281.2194069.4567490148001547311.stgit@mhiramat.tok.corp.google.com Signed-off-by: Masami Hiramatsu (Google) <[email protected]> Cc: Anna Schumaker <[email protected]> Cc: Boqun Feng <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Joel Granados <[email protected]> Cc: Kent Overstreet <[email protected]> Cc: Lance Yang <[email protected]> Cc: Sergey Senozhatsky <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Tomasz Figa <[email protected]> Cc: Waiman Long <[email protected]> Cc: Will Deacon <[email protected]> Cc: Yongliang Gao <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
show more ...
|
|
Revision tags: v6.14-rc4, v6.14-rc3, v6.14-rc2, v6.14-rc1, v6.13, v6.13-rc7, v6.13-rc6, v6.13-rc5, v6.13-rc4, v6.13-rc3 |
|
| #
2aca2546 |
| 10-Dec-2024 |
SeongJae Park <[email protected]> |
samples/damon: introduce a skeleton of a smaple DAMON module for proactive reclamation
DAMON is not only for monitoring of access patterns, but also for access-aware system operations. For the syst
samples/damon: introduce a skeleton of a smaple DAMON module for proactive reclamation
DAMON is not only for monitoring of access patterns, but also for access-aware system operations. For the system operations, DAMON provides a feature called DAMOS (Data Access Monitoring-based Operation Schemes). There is no sample API usage of DAMOS, though. Copy the working set size estimation sample modules with changed names of the module and symbols, to use it as a skeleton for a sample module showing the DAMOS API usage. The following commit will make it proactively reclaim cold memory of the given process, using DAMOS.
Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: SeongJae Park <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
show more ...
|
| #
19d7c3ad |
| 10-Dec-2024 |
SeongJae Park <[email protected]> |
samples: add a skeleton of a sample DAMON module for working set size estimation
Patch series "mm/damon: add sample modules".
Implement a proactive cold memory regions reclaiming logic of prcl samp
samples: add a skeleton of a sample DAMON module for working set size estimation
Patch series "mm/damon: add sample modules".
Implement a proactive cold memory regions reclaiming logic of prcl sample module using DAMOS. The logic treats memory regions that not accessed at all for five or more seconds as cold, and reclaim those as soon as found.
This patch (of 5):
Add a skeleton for a sample DAMON static module that can be used for estimating working set size of a given process. Note that it is a static module since DAMON is not exporting symbols to loadable modules for now. It exposes two module parameters, namely 'pid' and 'enable'. 'pid' will specify the process that the module will estimate the working set size of. 'enable' will receive whether to start or stop the estimation. Because this is just a skeleton, the parameters do nothing, though. The functionalities will be implemented by following commits.
Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: SeongJae Park <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
show more ...
|
| #
faf2d88e |
| 12-Dec-2024 |
Mickaël Salaün <[email protected]> |
samples/check-exec: Add set-exec
Add a simple tool to set SECBIT_EXEC_RESTRICT_FILE or SECBIT_EXEC_DENY_INTERACTIVE before executing a command. This is useful to easily test against enlighten scrip
samples/check-exec: Add set-exec
Add a simple tool to set SECBIT_EXEC_RESTRICT_FILE or SECBIT_EXEC_DENY_INTERACTIVE before executing a command. This is useful to easily test against enlighten script interpreters.
Cc: Al Viro <[email protected]> Cc: Christian Brauner <[email protected]> Cc: Kees Cook <[email protected]> Cc: Paul Moore <[email protected]> Cc: Serge Hallyn <[email protected]> Signed-off-by: Mickaël Salaün <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
show more ...
|
|
Revision tags: v6.13-rc2, v6.13-rc1, v6.12, v6.12-rc7, v6.12-rc6, v6.12-rc5, v6.12-rc4, v6.12-rc3, v6.12-rc2, v6.12-rc1, v6.11, v6.11-rc7, v6.11-rc6, v6.11-rc5, v6.11-rc4, v6.11-rc3, v6.11-rc2, v6.11-rc1, v6.10, v6.10-rc7, v6.10-rc6, v6.10-rc5, v6.10-rc4, v6.10-rc3, v6.10-rc2, v6.10-rc1, v6.9, v6.9-rc7, v6.9-rc6, v6.9-rc5, v6.9-rc4, v6.9-rc3, v6.9-rc2, v6.9-rc1, v6.8, v6.8-rc7, v6.8-rc6, v6.8-rc5, v6.8-rc4, v6.8-rc3, v6.8-rc2, v6.8-rc1, v6.7, v6.7-rc8, v6.7-rc7, v6.7-rc6, v6.7-rc5, v6.7-rc4, v6.7-rc3 |
|
| #
60433a9d |
| 23-Nov-2023 |
Dmitry Rokosov <[email protected]> |
samples: introduce new samples subdir for cgroup
Patch series "samples: introduce cgroup events listeners", v3.
To begin with, this patch series relocates the cgroup example code to the samples/cgr
samples: introduce new samples subdir for cgroup
Patch series "samples: introduce cgroup events listeners", v3.
To begin with, this patch series relocates the cgroup example code to the samples/cgroup directory, which is the appropriate location for such code snippets.
Furthermore, a new memcg events listener is introduced. This listener is a simple yet effective tool for monitoring memory events and managing counter changes during runtime.
Additionally, as per Andrew Morton's suggestion, a helpful reminder comment is included in the memcontrol implementation. This comment serves to ensure that the samples code is updated whenever new events are added.
This patch (of 3):
Move the cgroup_event_listener for cgroup v1 to the samples directory. This suggestion was proposed by Andrew Morton during the discussion [1].
Link: https://lore.kernel.org/all/[email protected]/ [1] Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Dmitry Rokosov <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Muchun Song <[email protected]> Cc: Roman Gushchin <[email protected]> Cc: Shakeel Butt <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
show more ...
|
|
Revision tags: v6.7-rc2, v6.7-rc1, v6.6, v6.6-rc7, v6.6-rc6, v6.6-rc5, v6.6-rc4, v6.6-rc3, v6.6-rc2, v6.6-rc1, v6.5, v6.5-rc7, v6.5-rc6, v6.5-rc5, v6.5-rc4, v6.5-rc3, v6.5-rc2, v6.5-rc1, v6.4, v6.4-rc7, v6.4-rc6, v6.4-rc5, v6.4-rc4, v6.4-rc3, v6.4-rc2 |
|
| #
9e66fb52 |
| 11-May-2023 |
Julien Panis <[email protected]> |
samples: Add userspace example for TI TPS6594 PFSM
This patch adds an example showing how to use PFSM devices from a userspace application. The PMIC is armed to be triggered by a RTC alarm to execut
samples: Add userspace example for TI TPS6594 PFSM
This patch adds an example showing how to use PFSM devices from a userspace application. The PMIC is armed to be triggered by a RTC alarm to execute state transition.
Signed-off-by: Julien Panis <[email protected]> Message-ID: <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
|
Revision tags: v6.4-rc1, v6.3, v6.3-rc7, v6.3-rc6, v6.3-rc5 |
|
| #
27d9a0fd |
| 30-Mar-2023 |
Hao Ge <[email protected]> |
kmemleak-test: fix kmemleak_test.c build logic
kmemleak-test.c was moved to the samples directory in 1abbef4f51724 ("mm,kmemleak-test.c: move kmemleak-test.c to samples dir").
If CONFIG_DEBUG_KMEML
kmemleak-test: fix kmemleak_test.c build logic
kmemleak-test.c was moved to the samples directory in 1abbef4f51724 ("mm,kmemleak-test.c: move kmemleak-test.c to samples dir").
If CONFIG_DEBUG_KMEMLEAK_TEST=m and CONFIG_SAMPLES is unset, kmemleak-test.c will be unnecessarily compiled.
So move the entry for CONFIG_DEBUG_KMEMLEAK_TEST from mm/Kconfig and add a new CONFIG_SAMPLE_KMEMLEAK in samples/ to control whether kmemleak-test.c is built or not.
Link: https://lkml.kernel.org/r/[email protected] Fixes: 1abbef4f51724 ("mm,kmemleak-test.c: move kmemleak-test.c to samples dir") Signed-off-by: Hao Ge <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Alex Gaynor <[email protected]> Cc: Alex Williamson <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Finn Behrens <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Jason Gunthorpe <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Miguel Ojeda <[email protected]> Cc: Tony Krowiak <[email protected]> Cc: Ye Xingchen <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
show more ...
|
|
Revision tags: v6.3-rc4, v6.3-rc3, v6.3-rc2, v6.3-rc1, v6.2, v6.2-rc8, v6.2-rc7, v6.2-rc6, v6.2-rc5, v6.2-rc4, v6.2-rc3 |
|
| #
b56c68f7 |
| 03-Jan-2023 |
Mark Rutland <[email protected]> |
ftrace: Add sample with custom ops
When reworking core ftrace code or architectural ftrace code, it's often necessary to test/analyse/benchmark a number of ftrace_ops configurations. This patch adds
ftrace: Add sample with custom ops
When reworking core ftrace code or architectural ftrace code, it's often necessary to test/analyse/benchmark a number of ftrace_ops configurations. This patch adds a module which can be used to explore some of those configurations.
I'm using this to benchmark various options for changing the way trampolines and handling of ftrace_ops work on arm64, and ensuring other architectures aren't adversely affected.
For example, in a QEMU+KVM VM running on a 2GHz Xeon E5-2660 workstation, loading the module in various configurations produces:
| # insmod ftrace-ops.ko | ftrace_ops: registering: | relevant ops: 1 | tracee: tracee_relevant [ftrace_ops] | tracer: ops_func_nop [ftrace_ops] | irrelevant ops: 0 | tracee: tracee_irrelevant [ftrace_ops] | tracer: ops_func_nop [ftrace_ops] | saving registers: NO | assist recursion: NO | assist RCU: NO | ftrace_ops: Attempted 100000 calls to tracee_relevant [ftrace_ops] in 1681558ns (16ns / call)
| # insmod ftrace-ops.ko nr_ops_irrelevant=5 | ftrace_ops: registering: | relevant ops: 1 | tracee: tracee_relevant [ftrace_ops] | tracer: ops_func_nop [ftrace_ops] | irrelevant ops: 5 | tracee: tracee_irrelevant [ftrace_ops] | tracer: ops_func_nop [ftrace_ops] | saving registers: NO | assist recursion: NO | assist RCU: NO | ftrace_ops: Attempted 100000 calls to tracee_relevant [ftrace_ops] in 1693042ns (16ns / call)
| # insmod ftrace-ops.ko nr_ops_relevant=2 | ftrace_ops: registering: | relevant ops: 2 | tracee: tracee_relevant [ftrace_ops] | tracer: ops_func_nop [ftrace_ops] | irrelevant ops: 0 | tracee: tracee_irrelevant [ftrace_ops] | tracer: ops_func_nop [ftrace_ops] | saving registers: NO | assist recursion: NO | assist RCU: NO | ftrace_ops: Attempted 100000 calls to tracee_relevant [ftrace_ops] in 11965582ns (119ns / call)
| # insmod ftrace-ops.ko save_regs=true | ftrace_ops: registering: | relevant ops: 1 | tracee: tracee_relevant [ftrace_ops] | tracer: ops_func_nop [ftrace_ops] | irrelevant ops: 0 | tracee: tracee_irrelevant [ftrace_ops] | tracer: ops_func_nop [ftrace_ops] | saving registers: YES | assist recursion: NO | assist RCU: NO | ftrace_ops: Attempted 100000 calls to tracee_relevant [ftrace_ops] in 4459624ns (44ns / call)
Link: https://lkml.kernel.org/r/[email protected]
Cc: Florent Revest <[email protected]> Acked-by: Masami Hiramatsu (Google) <[email protected]> Signed-off-by: Mark Rutland <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
show more ...
|
|
Revision tags: v6.2-rc2, v6.2-rc1, v6.1, v6.1-rc8, v6.1-rc7, v6.1-rc6, v6.1-rc5, v6.1-rc4, v6.1-rc3, v6.1-rc2, v6.1-rc1, v6.0, v6.0-rc7, v6.0-rc6, v6.0-rc5, v6.0-rc4, v6.0-rc3, v6.0-rc2, v6.0-rc1, v5.19, v5.19-rc8, v5.19-rc7, v5.19-rc6, v5.19-rc5, v5.19-rc4, v5.19-rc3, v5.19-rc2, v5.19-rc1, v5.18, v5.18-rc7, v5.18-rc6, v5.18-rc5, v5.18-rc4, v5.18-rc3, v5.18-rc2, v5.18-rc1, v5.17, v5.17-rc8, v5.17-rc7, v5.17-rc6, v5.17-rc5, v5.17-rc4, v5.17-rc3, v5.17-rc2, v5.17-rc1, v5.16, v5.16-rc8, v5.16-rc7, v5.16-rc6, v5.16-rc5, v5.16-rc4, v5.16-rc3, v5.16-rc2, v5.16-rc1, v5.15, v5.15-rc7, v5.15-rc6, v5.15-rc5, v5.15-rc4, v5.15-rc3, v5.15-rc2, v5.15-rc1, v5.14, v5.14-rc7, v5.14-rc6, v5.14-rc5, v5.14-rc4, v5.14-rc3, v5.14-rc2, v5.14-rc1 |
|
| #
e4fc6580 |
| 03-Jul-2021 |
Miguel Ojeda <[email protected]> |
samples: add first Rust examples
The beginning of a set of Rust modules that showcase how Rust modules look like and how to use the abstracted kernel features.
It also includes an example of a Rust
samples: add first Rust examples
The beginning of a set of Rust modules that showcase how Rust modules look like and how to use the abstracted kernel features.
It also includes an example of a Rust host program with several modules.
These samples also double as tests in the CI.
Reviewed-by: Kees Cook <[email protected]> Reviewed-by: Greg Kroah-Hartman <[email protected]> Co-developed-by: Alex Gaynor <[email protected]> Signed-off-by: Alex Gaynor <[email protected]> Co-developed-by: Finn Behrens <[email protected]> Signed-off-by: Finn Behrens <[email protected]> Co-developed-by: Wedson Almeida Filho <[email protected]> Signed-off-by: Wedson Almeida Filho <[email protected]> Co-developed-by: Milan Landaverde <[email protected]> Signed-off-by: Milan Landaverde <[email protected]> Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
6ee64cc3 |
| 15-Mar-2022 |
Masami Hiramatsu <[email protected]> |
fprobe: Add sample program for fprobe
Add a sample program for the fprobe. The sample_fprobe puts a fprobe on kernel_clone() by default. This dump stack and some called address info at the function
fprobe: Add sample program for fprobe
Add a sample program for the fprobe. The sample_fprobe puts a fprobe on kernel_clone() by default. This dump stack and some called address info at the function entry and exit.
The sample_fprobe.ko gets 2 parameters. - symbol: you can specify the comma separated symbols or wildcard symbol pattern (in this case you can not use comma) - stackdump: a bool value to enable or disable stack dump in the fprobe handler.
Signed-off-by: Masami Hiramatsu <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]> Tested-by: Steven Rostedt (Google) <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Link: https://lore.kernel.org/bpf/164735291987.1084943.4449670993752806840.stgit@devnote2
show more ...
|
| #
953c2f05 |
| 03-Mar-2022 |
Steven Rostedt (Google) <[email protected]> |
tracing: Add sample code for custom trace events
Add sample code to show how to create custom trace events in the tracefs directory that can be enabled and modified like any event in tracefs (includ
tracing: Add sample code for custom trace events
Add sample code to show how to create custom trace events in the tracefs directory that can be enabled and modified like any event in tracefs (including triggers, histograms, synthetic events and event probes).
The example is creating a custom sched_switch and a sched_waking to limit what is recorded:
If the custom sched switch only records the prev_prio, next_prio and next_pid, it can bring the size from 64 bytes per event, down to just 16 bytes!
If sched_waking only records the prio and pid of the woken event, it will bring the size down from 36 bytes to 12 bytes per event.
This will allow for a much smaller footprint into the ring buffer and keep more events from dropping.
Link: https://lkml.kernel.org/r/[email protected]
Cc: Ingo Molnar <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Masami Hiramatsu <[email protected]> Cc: Tom Zanussi <[email protected]> Suggested-by: Joel Fernandes <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
show more ...
|
| #
ede5bab8 |
| 24-Nov-2021 |
Mike Leach <[email protected]> |
coresight: syscfg: Example CoreSight configuration loadable module
An example of creating a loadable module to add CoreSight configurations into a system.
In the Kernel samples/coresight directory.
coresight: syscfg: Example CoreSight configuration loadable module
An example of creating a loadable module to add CoreSight configurations into a system.
In the Kernel samples/coresight directory.
Signed-off-by: Mike Leach <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
show more ...
|
| #
503e4510 |
| 15-Nov-2021 |
Heiko Carstens <[email protected]> |
ftrace/samples: add missing Kconfig option for ftrace direct multi sample
Currently it is not possible to build the ftrace direct multi example anymore due to broken config dependencies. Fix this by
ftrace/samples: add missing Kconfig option for ftrace direct multi sample
Currently it is not possible to build the ftrace direct multi example anymore due to broken config dependencies. Fix this by adding SAMPLE_FTRACE_DIRECT_MULTI config option.
This broke when merging s390-5.16-1 due to an incorrect merge conflict resolution proposed by me.
Also rename SAMPLE_FTRACE_MULTI_DIRECT to SAMPLE_FTRACE_DIRECT_MULTI so it matches the module name.
Fixes: 0b707e572a19 ("Merge tag 's390-5.16-1' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux") Acked-by: Steven Rostedt (VMware) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Heiko Carstens <[email protected]>
show more ...
|
| #
54510930 |
| 25-Oct-2021 |
Gabriel Krisman Bertazi <[email protected]> |
samples: Add fs error monitoring example
Introduce an example of a FAN_FS_ERROR fanotify user to track filesystem errors.
Link: https://lore.kernel.org/r/[email protected]
samples: Add fs error monitoring example
Introduce an example of a FAN_FS_ERROR fanotify user to track filesystem errors.
Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Amir Goldstein <[email protected]> Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Gabriel Krisman Bertazi <[email protected]> Signed-off-by: Jan Kara <[email protected]>
show more ...
|
|
Revision tags: v5.13, v5.13-rc7, v5.13-rc6, v5.13-rc5, v5.13-rc4, v5.13-rc3, v5.13-rc2, v5.13-rc1, v5.12 |
|
| #
ba84b0bf |
| 22-Apr-2021 |
Mickaël Salaün <[email protected]> |
samples/landlock: Add a sandbox manager example
Add a basic sandbox tool to launch a command which can only access a list of file hierarchies in a read-only or read-write way.
Cc: James Morris <jmo
samples/landlock: Add a sandbox manager example
Add a basic sandbox tool to launch a command which can only access a list of file hierarchies in a read-only or read-write way.
Cc: James Morris <[email protected]> Cc: Serge E. Hallyn <[email protected]> Signed-off-by: Mickaël Salaün <[email protected]> Reviewed-by: Jann Horn <[email protected]> Reviewed-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: James Morris <[email protected]>
show more ...
|
|
Revision tags: v5.12-rc8, v5.12-rc7, v5.12-rc6, v5.12-rc5, v5.12-rc4, v5.12-rc3, v5.12-rc2, v5.12-rc1, v5.12-rc1-dontuse, v5.11, v5.11-rc7, v5.11-rc6, v5.11-rc5, v5.11-rc4, v5.11-rc3, v5.11-rc2, v5.11-rc1, v5.10, v5.10-rc7, v5.10-rc6, v5.10-rc5, v5.10-rc4, v5.10-rc3, v5.10-rc2, v5.10-rc1 |
|
| #
1abbef4f |
| 13-Oct-2020 |
Hui Su <[email protected]> |
mm,kmemleak-test.c: move kmemleak-test.c to samples dir
kmemleak-test.c is just a kmemleak test module, which also can not be used as a built-in kernel module. Thus, i think it may should not be in
mm,kmemleak-test.c: move kmemleak-test.c to samples dir
kmemleak-test.c is just a kmemleak test module, which also can not be used as a built-in kernel module. Thus, i think it may should not be in mm dir, and move the kmemleak-test.c to samples/kmemleak/kmemleak-test.c. Fix the spelling of built-in by the way.
Signed-off-by: Hui Su <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Mauro Carvalho Chehab <[email protected]> Cc: David S. Miller <[email protected]> Cc: Rob Herring <[email protected]> Cc: Masahiro Yamada <[email protected]> Cc: Sam Ravnborg <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Steven Rostedt (VMware) <[email protected]> Cc: Miguel Ojeda <[email protected]> Cc: Divya Indi <[email protected]> Cc: Tomas Winkler <[email protected]> Cc: David Howells <[email protected]> Link: https://lkml.kernel.org/r/20200925183729.GA172837@rlk Signed-off-by: Linus Torvalds <[email protected]>
show more ...
|
|
Revision tags: v5.9, v5.9-rc8, v5.9-rc7, v5.9-rc6, v5.9-rc5, v5.9-rc4, v5.9-rc3, v5.9-rc2, v5.9-rc1, v5.8, v5.8-rc7, v5.8-rc6, v5.8-rc5, v5.8-rc4, v5.8-rc3, v5.8-rc2, v5.8-rc1 |
|
| #
fca5e949 |
| 07-Jun-2020 |
Masahiro Yamada <[email protected]> |
samples: binderfs: really compile this sample and fix build issues
Even after commit c624adc9cb6e ("samples: fix binderfs sample"), this sample is never compiled.
'hostprogs' teaches Kbuild that th
samples: binderfs: really compile this sample and fix build issues
Even after commit c624adc9cb6e ("samples: fix binderfs sample"), this sample is never compiled.
'hostprogs' teaches Kbuild that this is a host program, but not enough to order to compile it. You must add it to 'always-y' to really compile it.
Since this sample has never been compiled in upstream, various issues are left unnoticed.
[1] compilers without <linux/android/binderfs.h> are still widely used
<linux/android/binderfs.h> is only available since commit c13295ad219d ("binderfs: rename header to binderfs.h"), i.e., Linux 5.0
If your compiler is based on UAPI headers older than Linux 5.0, you will see the following error:
samples/binderfs/binderfs_example.c:16:10: fatal error: linux/android/binderfs.h: No such file or directory #include <linux/android/binderfs.h> ^~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
You cannot rely on compilers having such a new header.
The common approach is to install UAPI headers of this kernel into usr/include, and then add it to the header search path.
I added 'depends on HEADERS_INSTALL' in Kconfig, and '-I usr/include' compiler flag in Makefile.
[2] compile the sample for target architecture
Because headers_install works for the target architecture, only the native compiler was able to build sample code that requires '-I usr/include'.
Commit 7f3a59db274c ("kbuild: add infrastructure to build userspace programs") added the new syntax 'userprogs' to compile user-space programs for the target architecture.
Use it, and then 'ifndef CROSS_COMPILE' will go away.
I added 'depends on CC_CAN_LINK' because $(CC) is not necessarily capable of linking user-space programs.
[3] use subdir-y to descend into samples/binderfs
Since this directory does not contain any kernel-space code, it has no point in generating built-in.a or modules.order.
Replace obj-$(CONFIG_...) with subdir-$(CONFIG_...).
[4] -Wunused-variable warning
If I compile this, I see the following warning.
samples/binderfs/binderfs_example.c: In function 'main': samples/binderfs/binderfs_example.c:21:9: warning: unused variable 'len' [-Wunused-variable] 21 | size_t len; | ^~~
I removed the unused 'len'.
[5] CONFIG_ANDROID_BINDERFS is not required
Since this is a user-space standalone program, it is independent of the kernel configuration.
Remove 'depends on ANDROID_BINDERFS'.
Fixes: 9762dc1432e1 ("samples: add binderfs sample program") Fixes: c624adc9cb6e ("samples: fix binderfs sample") Signed-off-by: Masahiro Yamada <[email protected]> Acked-by: Christian Brauner <[email protected]>
show more ...
|
|
Revision tags: v5.7, v5.7-rc7, v5.7-rc6, v5.7-rc5, v5.7-rc4, v5.7-rc3, v5.7-rc2, v5.7-rc1, v5.6, v5.6-rc7, v5.6-rc6, v5.6-rc5, v5.6-rc4, v5.6-rc3, v5.6-rc2, v5.6-rc1, v5.5, v5.5-rc7 |
|
| #
f5b5a164 |
| 14-Jan-2020 |
David Howells <[email protected]> |
Add sample notification program
The sample program is run like:
./samples/watch_queue/watch_test
and watches "/" for mount changes and the current session keyring for key changes:
# keyctl add
Add sample notification program
The sample program is run like:
./samples/watch_queue/watch_test
and watches "/" for mount changes and the current session keyring for key changes:
# keyctl add user a a @s 1035096409 # keyctl unlink 1035096409 @s
producing:
# ./watch_test read() = 16 NOTIFY[000]: ty=000001 sy=02 i=00000110 KEY 2ffc2e5d change=2[linked] aux=1035096409 read() = 16 NOTIFY[000]: ty=000001 sy=02 i=00000110 KEY 2ffc2e5d change=3[unlinked] aux=1035096409
Other events may be produced, such as with a failing disk:
read() = 22 NOTIFY[000]: ty=000003 sy=02 i=00000416 USB 3-7.7 dev-reset e=0 r=0 read() = 24 NOTIFY[000]: ty=000002 sy=06 i=00000418 BLOCK 00800050 e=6[critical medium] s=64000ef8
This corresponds to:
blk_update_request: critical medium error, dev sdf, sector 1677725432 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
in dmesg.
Signed-off-by: David Howells <[email protected]>
show more ...
|
| #
88a8e278 |
| 29-Apr-2020 |
Masahiro Yamada <[email protected]> |
samples: watchdog: use 'userprogs' syntax
Kbuild now supports the 'userprogs' syntax to compile userspace programs for the same architecture as the kernel.
Add the entry to samples/Makefile to put
samples: watchdog: use 'userprogs' syntax
Kbuild now supports the 'userprogs' syntax to compile userspace programs for the same architecture as the kernel.
Add the entry to samples/Makefile to put this into the build bot coverage.
I also added the CONFIG option guarded by 'depends on CC_CAN_LINK' because $(CC) may not provide libc.
Signed-off-by: Masahiro Yamada <[email protected]> Acked-by: Sam Ravnborg <[email protected]>
show more ...
|
| #
b98ccc71 |
| 29-Apr-2020 |
Masahiro Yamada <[email protected]> |
samples: timers: use 'userprogs' syntax
Kbuild now supports the 'userprogs' syntax to compile userspace programs for the same architecture as the kernel.
Add the entry to samples/Makefile to put th
samples: timers: use 'userprogs' syntax
Kbuild now supports the 'userprogs' syntax to compile userspace programs for the same architecture as the kernel.
Add the entry to samples/Makefile to put this into the build bot coverage.
I also added the CONFIG option guarded by 'depends on CC_CAN_LINK' because $(CC) may not provide libc.
Signed-off-by: Masahiro Yamada <[email protected]> Acked-by: Sam Ravnborg <[email protected]>
show more ...
|
| #
87ffbba9 |
| 29-Apr-2020 |
Masahiro Yamada <[email protected]> |
samples: auxdisplay: use 'userprogs' syntax
Kbuild now supports the 'userprogs' syntax to compile userspace programs for the same architecture as the kernel.
Add the entry to samples/Makefile to pu
samples: auxdisplay: use 'userprogs' syntax
Kbuild now supports the 'userprogs' syntax to compile userspace programs for the same architecture as the kernel.
Add the entry to samples/Makefile to put this into the build bot coverage.
I also added the CONFIG option guarded by 'depends on CC_CAN_LINK' because $(CC) may not provide libc.
Signed-off-by: Masahiro Yamada <[email protected]> Acked-by: Miguel Ojeda <[email protected]> Acked-by: Sam Ravnborg <[email protected]>
show more ...
|
| #
87ecdf4f |
| 29-Apr-2020 |
Masahiro Yamada <[email protected]> |
samples: uhid: build sample program for target architecture
This userspace program includes UAPI headers exported to usr/include/. 'make headers' always works for the target architecture (i.e. the s
samples: uhid: build sample program for target architecture
This userspace program includes UAPI headers exported to usr/include/. 'make headers' always works for the target architecture (i.e. the same architecture as the kernel), so the sample program should be built for the target as well. Kbuild now supports 'userprogs' for that.
Add the entry to samples/Makefile to put this into the build bot coverage.
I also added the CONFIG option guarded by 'depends on CC_CAN_LINK' because $(CC) may not provide libc.
Signed-off-by: Masahiro Yamada <[email protected]> Acked-by: Sam Ravnborg <[email protected]>
show more ...
|
| #
85e4a889 |
| 23-Apr-2020 |
Masahiro Yamada <[email protected]> |
Revert "objtool: Skip samples subdirectory"
This reverts commit 8728497895794d1f207a836e02dae762ad175d56.
samples/ contains only sub-directories.
Because OBJECT_FILES_NON_STANDARD does not work re
Revert "objtool: Skip samples subdirectory"
This reverts commit 8728497895794d1f207a836e02dae762ad175d56.
samples/ contains only sub-directories.
Because OBJECT_FILES_NON_STANDARD does not work recursively, this line has no effect.
Signed-off-by: Masahiro Yamada <[email protected]> Acked-by: Josh Poimboeuf <[email protected]> Acked-by: Sam Ravnborg <[email protected]>
show more ...
|
| #
87284978 |
| 20-Jan-2020 |
Josh Poimboeuf <[email protected]> |
objtool: Skip samples subdirectory
The code in the 'samples' subdirectory isn't part of the kernel, so there's no need to validate it.
Reported-by: Randy Dunlap <[email protected]> Signed-off-b
objtool: Skip samples subdirectory
The code in the 'samples' subdirectory isn't part of the kernel, so there's no need to validate it.
Reported-by: Randy Dunlap <[email protected]> Signed-off-by: Josh Poimboeuf <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/c4cb4ef635ec606454ab834cb49fc3e9381fb1b1.1579543924.git.jpoimboe@redhat.com
show more ...
|
|
Revision tags: v5.5-rc6, v5.5-rc5, v5.5-rc4, v5.5-rc3, v5.5-rc2, v5.5-rc1, v5.4 |
|
| #
89ed4249 |
| 20-Nov-2019 |
Divya Indi <[email protected]> |
tracing: Sample module to demonstrate kernel access to Ftrace instances.
This is a sample module to demonstrate the use of the newly introduced and exported APIs to access Ftrace instances from with
tracing: Sample module to demonstrate kernel access to Ftrace instances.
This is a sample module to demonstrate the use of the newly introduced and exported APIs to access Ftrace instances from within the kernel.
Newly introduced APIs used here -
1. Create/Lookup a trace array with the given name. struct trace_array *trace_array_get_by_name(const char *name)
2. Destroy/Remove a trace array. int trace_array_destroy(struct trace_array *tr)
4. Enable/Disable trace events: int trace_array_set_clr_event(struct trace_array *tr, const char *system, const char *event, bool enable);
Exported APIs - 1. trace_printk equivalent for instances. int trace_array_printk(struct trace_array *tr, unsigned long ip, const char *fmt, ...);
2. Helper function. void trace_printk_init_buffers(void);
3. To decrement the reference counter. void trace_array_put(struct trace_array *tr)
Sample output(contents of /sys/kernel/tracing/instances/sample-instance) NOTE: Tracing disabled after ~5 sec)
_-----=> irqs-off / _----=> need-resched | / _---=> hardirq/softirq || / _--=> preempt-depth ||| / delay TASK-PID CPU# |||| TIMESTAMP FUNCTION | | | |||| | | sample-instance-1452 [002] .... 49.430948: simple_thread: trace_array_printk: count=0 sample-instance-1452 [002] .... 49.430951: sample_event: count value=0 at jiffies=4294716608 sample-instance-1452 [002] .... 50.454847: simple_thread: trace_array_printk: count=1 sample-instance-1452 [002] .... 50.454849: sample_event: count value=1 at jiffies=4294717632 sample-instance-1452 [002] .... 51.478748: simple_thread: trace_array_printk: count=2 sample-instance-1452 [002] .... 51.478750: sample_event: count value=2 at jiffies=4294718656 sample-instance-1452 [002] .... 52.502652: simple_thread: trace_array_printk: count=3 sample-instance-1452 [002] .... 52.502655: sample_event: count value=3 at jiffies=4294719680 sample-instance-1452 [002] .... 53.526533: simple_thread: trace_array_printk: count=4 sample-instance-1452 [002] .... 53.526535: sample_event: count value=4 at jiffies=4294720704 sample-instance-1452 [002] .... 54.550438: simple_thread: trace_array_printk: count=5 sample-instance-1452 [002] .... 55.574336: simple_thread: trace_array_printk: count=6
Link: http://lkml.kernel.org/r/[email protected]
Reviewed-by: Aruna Ramakrishna <[email protected]> Signed-off-by: Divya Indi <[email protected]> [ Moved to samples/ftrace ] Signed-off-by: Steven Rostedt (VMware) <[email protected]>
show more ...
|