From: "Joel Fernandes (Google)" <joel(a)joelfernandes.org>
This is the next (hopefully close to final) revision of preempt/irq tracepoint
centralization and unified usage across the kernel. This revision mostly has
minor style corrections, reviewed-by tag additions and an improvement to the
test module. All patches now have a Reviewed-by tag except for the kselftest
script (patch 7/7). I have also now split out the softirq fix which really
should go into an -rc cycle and is independent of this series (see [1]).
The preempt/irq tracepoints exist but not everything in the kernel is using it
whenever they need to be notified that a preempt disable/enable or an irq
disable enable has occurred. This makes things not work simultaneously (for
example, only either lockdep or irqsoff trace-events can be used at a time).
This is particular painful to deal with, since turning on lockdep breaks
tracers that install probes on IRQ events, such as the BCC atomic critical
section tracer [2]. This constraint also makes it not possible to use synthetic
events to trace irqsoff sections with lockdep simulataneously turned on.
This series solves that, and also results in a nice clean up of relevant parts
of the kernel. Several ifdefs are simpler, and the design is more unified and
better. Also as a result of this, we also speeded performance all rcuidle
tracepoints since their handling is simpler.
[1] https://lkml.org/lkml/2018/6/7/1135
[2] https://github.com/iovisor/bcc/pull/1801/
v8->v9:
- Small style changes to tracepoint code (Mathieu)
- Minor style fix to use PTR_ERR_OR_ZERO (0-day bot)
- Minor fix to test_atomic_sections to use unsigned long.
- Added Namhyung's, Mathieu's Reviewed-by to some patches.
v7->v8:
- Refactored irqsoff tracer probe defines (Namhyung)
v6->v7:
- Added a module to simulate an atomic section, a kselftest to load and
and trigger it which verifies the preempt-tracer and this series.
- Fixed a new warning after I rebased in early boot, this is because
early_boot_irqs_disabled was set too early, I moved it after the lockdep
initialization.
- added back the softirq fix since it appears it wasn't picked up.
- Ran Ingo's locking API selftest suite which are passing with this
series.
- Mathieu suggested ifdef'ing the tracepoint_synchronize_unregister
function incase tracepoints aren't enabled, did that.
Joel Fernandes (Google) (6):
srcu: Add notrace variant of srcu_dereference
trace/irqsoff: Split reset into separate functions
tracepoint: Make rcuidle tracepoint callers use SRCU
tracing: Centralize preemptirq tracepoints and unify their usage
lib: Add module to simulate atomic sections for testing preemptoff
tracers
kselftests: Add tests for the preemptoff and irqsoff tracers
Paul McKenney (1):
srcu: Add notrace variants of srcu_read_{lock,unlock}
include/linux/ftrace.h | 11 +-
include/linux/irqflags.h | 11 +-
include/linux/lockdep.h | 8 +-
include/linux/preempt.h | 2 +-
include/linux/srcu.h | 22 ++
include/linux/tracepoint.h | 49 +++-
include/trace/events/preemptirq.h | 23 +-
init/main.c | 5 +-
kernel/locking/lockdep.c | 35 +--
kernel/sched/core.c | 2 +-
kernel/trace/Kconfig | 22 +-
kernel/trace/Makefile | 2 +-
kernel/trace/trace_irqsoff.c | 253 ++++++------------
kernel/trace/trace_preemptirq.c | 71 +++++
kernel/tracepoint.c | 16 +-
lib/Kconfig.debug | 8 +
lib/Makefile | 1 +
lib/test_atomic_sections.c | 77 ++++++
tools/testing/selftests/ftrace/config | 3 +
.../test.d/preemptirq/irqsoff_tracer.tc | 74 +++++
20 files changed, 454 insertions(+), 241 deletions(-)
create mode 100644 kernel/trace/trace_preemptirq.c
create mode 100644 lib/test_atomic_sections.c
create mode 100644 tools/testing/selftests/ftrace/test.d/preemptirq/irqsoff_tracer.tc
--
2.17.1.1185.g55be947832-goog
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
"len" needs to be signed for the error handling to work.
Signed-off-by: Dan Carpenter <dan.carpenter(a)oracle.com>
diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c
index b69bdeb4b9fe..1e9e3c470561 100644
--- a/tools/testing/selftests/cgroup/cgroup_util.c
+++ b/tools/testing/selftests/cgroup/cgroup_util.c
@@ -35,7 +35,7 @@ static ssize_t read_text(const char *path, char *buf, size_t max_len)
return len;
}
-static ssize_t write_text(const char *path, char *buf, size_t len)
+static ssize_t write_text(const char *path, char *buf, ssize_t len)
{
int fd;
@@ -140,7 +140,7 @@ long cg_read_key_long(const char *cgroup, const char *control, const char *key)
int cg_write(const char *cgroup, const char *control, char *buf)
{
char path[PATH_MAX];
- size_t len = strlen(buf);
+ ssize_t len = strlen(buf);
snprintf(path, sizeof(path), "%s/%s", cgroup, control);
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: "Joel Fernandes (Google)" <joel(a)joelfernandes.org>
The preempt/irq tracepoints exist but not everything in the kernel is
using it during preempt/irq on/off events. This makes things not work
simultaneously (for ex, only either lockdep or irqsoff events can be
used at a time). This series is an attempt to solve that, and also
results in a nice clean up of the kernel in general. Several ifdefs are
simpler, and the design is more unified and better. Also as a result of
this, we also speeded up performance all rcuidle tracepoints since
their handling is simpler.
v7->v8:
- Refactored irqsoff tracer probe defines based on Namhyung's
suggestions. No functional change.
v6->v7:
- Added a module to simulate an atomic section, a kselftest to load and
and trigger it which verifies the preempt-tracer and this series.
- Fixed a new warning after I rebased in early boot, this is because
early_boot_irqs_disabled was set too early, I moved it after the lockdep
initialization.
- added back the softirq fix since it appears it wasn't picked up.
- Ran Ingo's locking API selftest suite which are passing with this
series.
- Mathieu suggested ifdef'ing the tracepoint_synchronize_unregister
function incase tracepoints aren't enabled, did that.
Joel Fernandes (Google) (7):
softirq: reorder trace_softirqs_on to prevent lockdep splat
srcu: Add notrace variant of srcu_dereference
trace/irqsoff: Split reset into separate functions
tracepoint: Make rcuidle tracepoint callers use SRCU
tracing: Centralize preemptirq tracepoints and unify their usage
lib: Add module to simulate atomic sections for testing preemptoff
tracers
kselftests: Add tests for the preemptoff and irqsoff tracers
Paul McKenney (1):
srcu: Add notrace variants of srcu_read_{lock,unlock}
include/linux/ftrace.h | 11 +-
include/linux/irqflags.h | 11 +-
include/linux/lockdep.h | 8 +-
include/linux/preempt.h | 2 +-
include/linux/srcu.h | 22 ++
include/linux/tracepoint.h | 48 +++-
include/trace/events/preemptirq.h | 23 +-
init/main.c | 5 +-
kernel/locking/lockdep.c | 35 +--
kernel/sched/core.c | 2 +-
kernel/softirq.c | 6 +-
kernel/trace/Kconfig | 22 +-
kernel/trace/Makefile | 2 +-
kernel/trace/trace_irqsoff.c | 253 ++++++------------
kernel/trace/trace_preemptirq.c | 71 +++++
kernel/tracepoint.c | 15 +-
lib/Kconfig.debug | 8 +
lib/Makefile | 1 +
lib/test_atomic_sections.c | 79 ++++++
tools/testing/selftests/ftrace/config | 3 +
.../test.d/preemptirq/irqsoff_tracer.tc | 74 +++++
21 files changed, 459 insertions(+), 242 deletions(-)
create mode 100644 kernel/trace/trace_preemptirq.c
create mode 100644 lib/test_atomic_sections.c
create mode 100644 tools/testing/selftests/ftrace/test.d/preemptirq/irqsoff_tracer.tc
--
2.17.0.921.gf22659ad46-goog
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
ADI is a feature supported on SPARC M7 and newer processors to allow
hardware to catch rogue accesses to memory. ADI is supported for data
fetches only and not instruction fetches. An app can enable ADI on its
data pages, set version tags on them and use versioned addresses to
access the data pages. Upper bits of the address contain the version
tag. On M7 processors, upper four bits (bits 63-60) contain the version
tag. If a rogue app attempts to access ADI enabled data pages, its
access is blocked and processor generates an exception. Please see
Documentation/sparc/adi.txt for further details.
This patchset implements a char driver to read/write ADI versions from
privileged user space processes. Intended consumers are makedumpfile
and crash.
v6:
* Addressed a few action items from greg k-h
* Added Reviewed-by Greg Kroah-Hartman and Shuah Khan
v5:
* Fixed MODULE_LICENSE() for adi.c
v4:
* Fixed messed up subject lines.
v3:
* Really fixed the copyright headers to use SPDX GPL v2. Really.
v2:
* Simplified copyright headers
* Completely reworked sparc64 selftests Makefiles. Used the
android selftests Makefiles as an example
* Added run.sh and drivers_test.sh to the sparc64 selftest
directory. Used bpf/test_kmod.sh and the android selftests
as examples
* Minor cleanups in the selftest adi-test.c
* Added calls to ksft_test_*() in the adi-test.c
Tom Hromatka (2):
char: sparc64: Add privileged ADI driver
selftests: sparc64: char: Selftest for privileged ADI driver
drivers/char/Kconfig | 12 +
drivers/char/Makefile | 1 +
drivers/char/adi.c | 239 +++++++
tools/testing/selftests/Makefile | 1 +
tools/testing/selftests/sparc64/Makefile | 46 ++
tools/testing/selftests/sparc64/drivers/.gitignore | 1 +
tools/testing/selftests/sparc64/drivers/Makefile | 15 +
tools/testing/selftests/sparc64/drivers/adi-test.c | 721 +++++++++++++++++++++
.../selftests/sparc64/drivers/drivers_test.sh | 30 +
tools/testing/selftests/sparc64/run.sh | 3 +
10 files changed, 1069 insertions(+)
create mode 100644 drivers/char/adi.c
create mode 100644 tools/testing/selftests/sparc64/Makefile
create mode 100644 tools/testing/selftests/sparc64/drivers/.gitignore
create mode 100644 tools/testing/selftests/sparc64/drivers/Makefile
create mode 100644 tools/testing/selftests/sparc64/drivers/adi-test.c
create mode 100755 tools/testing/selftests/sparc64/drivers/drivers_test.sh
create mode 100755 tools/testing/selftests/sparc64/run.sh
--
2.15.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
When libraries are sourced from elsewhere from the tree, such as the
testing/selftests/drivers/net/mlxsw subdirectory, sourcing their own
dependencies directly by name doesn't work. Thus running mirror_gre.sh
from that subdirectory results in the following cascade of errors:
./../../../net/forwarding/mirror_gre_lib.sh: line 3: mirror_lib.sh: No such file or directory
./../../../net/forwarding/mirror_gre_topo_lib.sh: line 36: mirror_topo_lib.sh: No such file or directory
./../../../net/forwarding/mirror_gre_topo_lib.sh: line 80: mirror_topo_h1_create: command not found
./../../../net/forwarding/mirror_gre_topo_lib.sh: line 81: mirror_topo_h2_create: command not found
./../../../net/forwarding/mirror_gre_topo_lib.sh: line 40: mirror_topo_h3_create: command not found
[...]
Fix by relying on $relative_path, set up by lib.sh, which should be
imported by the test in question anyway, and source the file using
relative path appropriate for the subdirectory.
Fixes: d5ea2bfc806a ("selftests: forwarding: mirror_gre_lib: Extract generic functions")
Fixes: 74ed089d48a4 ("selftests: forwarding: Split mirror_gre_topo_lib.sh")
Signed-off-by: Petr Machata <petrm(a)mellanox.com>
---
tools/testing/selftests/net/forwarding/mirror_gre_lib.sh | 2 +-
tools/testing/selftests/net/forwarding/mirror_gre_topo_lib.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_lib.sh b/tools/testing/selftests/net/forwarding/mirror_gre_lib.sh
index 619b469..1388845 100644
--- a/tools/testing/selftests/net/forwarding/mirror_gre_lib.sh
+++ b/tools/testing/selftests/net/forwarding/mirror_gre_lib.sh
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
-source mirror_lib.sh
+source "$relative_path/mirror_lib.sh"
quick_test_span_gre_dir_ips()
{
diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_topo_lib.sh b/tools/testing/selftests/net/forwarding/mirror_gre_topo_lib.sh
index 2534195..39c03e2 100644
--- a/tools/testing/selftests/net/forwarding/mirror_gre_topo_lib.sh
+++ b/tools/testing/selftests/net/forwarding/mirror_gre_topo_lib.sh
@@ -33,7 +33,7 @@
# | |
# +-------------------------------------------------------------------------+
-source mirror_topo_lib.sh
+source "$relative_path/mirror_topo_lib.sh"
mirror_gre_topo_h3_create()
{
--
2.4.11
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
This patchset includes two small fixes for the tests that were
introduced in commit 1bb58d2d3cbe ("Merge branch
'Mirroring-tests-involving-VLAN'").
In patch #1, a "tc action trap" is uninstalled after the suite runs,
instead of being installed again.
In patch #2, a test in suite is renamed to differentiate it from another
test of the same name.
Petr Machata (2):
selftests: forwarding: mirror_vlan: Uninstall trap
selftests: forwarding: mirror_vlan: Change test description
tools/testing/selftests/net/forwarding/mirror_vlan.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--
2.4.11
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html