hi, Steven asked for possibility to block traced process in case the tracer can't keep up and we would loose events. This (RFC) patchset tries to implement this by adding 'block' bool in struct perf_event_attr to be set only for syscalls tracepoints and adding code to block the traced process, if there's no space in event's ring buffer. The blocking code will poll/periodically check for the space and continue if the event was successfully written.
Available also here: git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git perf/block Thoughts? thanks, jirka --- Jiri Olsa (8): perf: Allow to block process in syscall tracepoints perf tools: Sync uapi perf_event.h perf record: Add --block option perf trace: Add --block option perf tools: Add block term support for tracepoints perf tools: Add ordered_events__flush_time interface perf trace: Move event delivery to deliver_event function perf trace: Add ordered processing for --block option arch/x86/entry/common.c | 36 ++++++++++++++++++++++++++++++++++-- include/linux/perf_event.h | 2 ++ include/linux/sched.h | 2 ++ include/linux/syscalls.h | 2 ++ include/uapi/linux/perf_event.h | 3 ++- kernel/events/core.c | 40 ++++++++++++++++++++++++++++++++++++++-- kernel/events/ring_buffer.c | 4 +++- kernel/trace/trace_event_perf.c | 4 ++++ kernel/trace/trace_syscalls.c | 28 ++++++++++++++++++++++++---- tools/include/uapi/linux/perf_event.h | 3 ++- tools/perf/builtin-record.c | 9 +++++++++ tools/perf/builtin-trace.c | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------- tools/perf/perf.h | 1 + tools/perf/util/evsel.c | 7 +++++++ tools/perf/util/evsel.h | 2 ++ tools/perf/util/ordered-events.c | 34 ++++++++++++++++++++++++++++++---- tools/perf/util/ordered-events.h | 3 +++ tools/perf/util/parse-events.c | 8 ++++++++ tools/perf/util/parse-events.h | 1 + tools/perf/util/parse-events.l | 1 + 20 files changed, 263 insertions(+), 24 deletions(-)