Ubuntu-focal-kernel/kernel/trace
Shiju Jose bdb7cd4238 tracing: Fix poll() and select() do not work on per_cpu trace_pipe and trace_pipe_raw
BugLink: https://bugs.launchpad.net/bugs/2011625

commit 3e46d910d8acf94e5360126593b68bf4fee4c4a1 upstream.

poll() and select() on per_cpu trace_pipe and trace_pipe_raw do not work
since kernel 6.1-rc6. This issue is seen after the commit
42fb0a1e84ff525ebe560e2baf9451ab69127e2b ("tracing/ring-buffer: Have
polling block on watermark").

This issue is firstly detected and reported, when testing the CXL error
events in the rasdaemon and also erified using the test application for poll()
and select().

This issue occurs for the per_cpu case, when calling the ring_buffer_poll_wait(),
in kernel/trace/ring_buffer.c, with the buffer_percent > 0 and then wait until the
percentage of pages are available. The default value set for the buffer_percent is 50
in the kernel/trace/trace.c.

As a fix, allow userspace application could set buffer_percent as 0 through
the buffer_percent_fops, so that the task will wake up as soon as data is added
to any of the specific cpu buffer.

Link: https://lore.kernel.org/linux-trace-kernel/20230202182309.742-2-shiju.jose@huawei.com

Cc: <mhiramat@kernel.org>
Cc: <mchehab@kernel.org>
Cc: <linux-edac@vger.kernel.org>
Cc: stable@vger.kernel.org
Fixes: 42fb0a1e84ff5 ("tracing/ring-buffer: Have polling block on watermark")
Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luke Nowakowski-Krijger <luke.nowakowskikrijger@canonical.com>
Acked-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
2023-04-18 17:21:01 +02:00
..
Kconfig tracing/kprobes: Do the notrace functions check without kprobes on ftrace 2021-02-19 16:44:35 +01:00
Makefile
blktrace.c blktrace: Fix output non-blktrace event when blk_classic option enabled 2023-02-01 15:22:40 +01:00
bpf_trace.c bpf: Skip task with pid=1 in send_signal_common() 2023-03-21 10:09:01 +01:00
fgraph.c fgraph: Initialize tracing_graph_pause at task creation 2021-03-24 11:11:41 +01:00
ftrace.c ftrace: Fix null pointer dereference in ftrace_add_mod() 2023-02-01 15:21:10 +01:00
ftrace_internal.h
power-traces.c
preemptirq_delay_test.c
ring_buffer.c tracing/ring-buffer: Only do full wait when cpu != RING_BUFFER_ALL_CPUS 2023-02-01 15:22:04 +01:00
ring_buffer_benchmark.c
rpm-traces.c
trace.c tracing: Fix poll() and select() do not work on per_cpu trace_pipe and trace_pipe_raw 2023-04-18 17:21:01 +02:00
trace.h tracing: Make sure trace_printk() can output as soon as it can be used 2023-03-21 10:08:59 +01:00
trace_benchmark.c
trace_benchmark.h
trace_branch.c
trace_clock.c tracing: Do no increment trace_clock_global() by one 2021-07-15 19:27:43 +02:00
trace_dynevent.c tracing: Free buffers when a used dynamic event is removed 2023-02-01 15:21:45 +01:00
trace_dynevent.h
trace_entries.h
trace_event_perf.c
trace_events.c tracing: Free buffers when a used dynamic event is removed 2023-02-01 15:21:45 +01:00
trace_events_filter.c
trace_events_filter_test.h
trace_events_hist.c trace_events_hist: add check for return value of 'create_hist_field' 2023-03-21 10:08:59 +01:00
trace_events_trigger.c tracing: Dump stacktrace trigger to the corresponding instance 2022-06-22 14:50:44 +02:00
trace_export.c
trace_functions.c tracing: Have all levels of checks prevent recursion 2021-11-22 17:31:04 +01:00
trace_functions_graph.c
trace_hwlat.c
trace_irqsoff.c
trace_kdb.c
trace_kprobe.c tracing: Fix return value of __setup handlers 2022-05-20 15:17:33 +02:00
trace_kprobe_selftest.c
trace_kprobe_selftest.h
trace_mmiotrace.c
trace_nop.c
trace_output.c tracing: Make sure trace_printk() can output as soon as it can be used 2023-03-21 10:08:59 +01:00
trace_output.h
trace_preemptirq.c tracing: hold caller_addr to hardirq_{enable,disable}_ip 2022-11-24 10:28:25 +01:00
trace_printk.c
trace_probe.c tracing/probes: Have kprobes and uprobes use $COMM too 2022-10-17 15:02:04 +02:00
trace_probe.h tracing/probes: Reject events which have the same name of existing one 2021-10-12 16:31:44 -06:00
trace_probe_tmpl.h
trace_sched_switch.c
trace_sched_wakeup.c
trace_selftest.c
trace_selftest_dynamic.c
trace_seq.c
trace_stack.c
trace_stat.c
trace_stat.h
trace_syscalls.c
trace_uprobe.c tracing/uprobe: Fix uprobe_perf_open probes iteration 2022-02-03 18:56:45 +01:00
tracing_map.c tracing: Fix a kmemleak false positive in tracing_map 2022-03-07 16:33:53 +01:00
tracing_map.h