Commit eaba52d6 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'trace-v6.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull tracing fixes from Steven Rostedt:

 - Fix setting affinity of hwlat threads in containers

   Using sched_set_affinity() has unwanted side effects when being
   called within a container. Use set_cpus_allowed_ptr() instead

 - Fix per cpu thread management of the hwlat tracer:
    - Do not start per_cpu threads if one is already running for the CPU
    - When starting per_cpu threads, do not clear the kthread variable
      as it may already be set to running per cpu threads

 - Fix return value for test_gen_kprobe_cmd()

   On error the return value was overwritten by being set to the result
   of the call from kprobe_event_delete(), which would likely succeed,
   and thus have the function return success

 - Fix splice() reads from the trace file that was broken by commit
   36e2c742 ("fs: don't allow splice read/write without explicit
   ops")

 - Remove obsolete and confusing comment in ring_buffer.c

   The original design of the ring buffer used struct page flags for
   tricks to optimize, which was shortly removed due to them being
   tricks. But a comment for those tricks remained

 - Set local functions and variables to static

* tag 'trace-v6.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
  tracing/hwlat: Replace sched_setaffinity with set_cpus_allowed_ptr
  ring-buffer: remove obsolete comment for free_buffer_page()
  tracing: Make splice_read available again
  ftrace: Set direct_ops storage-class-specifier to static
  trace/hwlat: Do not start per-cpu thread if it is already running
  trace/hwlat: Do not wipe the contents of per-cpu thread data
  tracing/osnoise: set several trace_osnoise.c variables storage-class-specifier to static
  tracing: Fix wrong return in kprobe_event_gen_test.c
parents 5cdfdd6d 71c7a304
...@@ -2592,7 +2592,7 @@ static void call_direct_funcs(unsigned long ip, unsigned long pip, ...@@ -2592,7 +2592,7 @@ static void call_direct_funcs(unsigned long ip, unsigned long pip,
arch_ftrace_set_direct_caller(fregs, addr); arch_ftrace_set_direct_caller(fregs, addr);
} }
struct ftrace_ops direct_ops = { static struct ftrace_ops direct_ops = {
.func = call_direct_funcs, .func = call_direct_funcs,
.flags = FTRACE_OPS_FL_DIRECT | FTRACE_OPS_FL_SAVE_REGS .flags = FTRACE_OPS_FL_DIRECT | FTRACE_OPS_FL_SAVE_REGS
| FTRACE_OPS_FL_PERMANENT, | FTRACE_OPS_FL_PERMANENT,
......
...@@ -146,7 +146,7 @@ static int __init test_gen_kprobe_cmd(void) ...@@ -146,7 +146,7 @@ static int __init test_gen_kprobe_cmd(void)
if (trace_event_file_is_valid(gen_kprobe_test)) if (trace_event_file_is_valid(gen_kprobe_test))
gen_kprobe_test = NULL; gen_kprobe_test = NULL;
/* We got an error after creating the event, delete it */ /* We got an error after creating the event, delete it */
ret = kprobe_event_delete("gen_kprobe_test"); kprobe_event_delete("gen_kprobe_test");
goto out; goto out;
} }
...@@ -211,7 +211,7 @@ static int __init test_gen_kretprobe_cmd(void) ...@@ -211,7 +211,7 @@ static int __init test_gen_kretprobe_cmd(void)
if (trace_event_file_is_valid(gen_kretprobe_test)) if (trace_event_file_is_valid(gen_kretprobe_test))
gen_kretprobe_test = NULL; gen_kretprobe_test = NULL;
/* We got an error after creating the event, delete it */ /* We got an error after creating the event, delete it */
ret = kprobe_event_delete("gen_kretprobe_test"); kprobe_event_delete("gen_kretprobe_test");
goto out; goto out;
} }
......
...@@ -354,10 +354,6 @@ static void rb_init_page(struct buffer_data_page *bpage) ...@@ -354,10 +354,6 @@ static void rb_init_page(struct buffer_data_page *bpage)
local_set(&bpage->commit, 0); local_set(&bpage->commit, 0);
} }
/*
* Also stolen from mm/slob.c. Thanks to Mathieu Desnoyers for pointing
* this issue out.
*/
static void free_buffer_page(struct buffer_page *bpage) static void free_buffer_page(struct buffer_page *bpage)
{ {
free_page((unsigned long)bpage->page); free_page((unsigned long)bpage->page);
......
...@@ -5167,6 +5167,8 @@ loff_t tracing_lseek(struct file *file, loff_t offset, int whence) ...@@ -5167,6 +5167,8 @@ loff_t tracing_lseek(struct file *file, loff_t offset, int whence)
static const struct file_operations tracing_fops = { static const struct file_operations tracing_fops = {
.open = tracing_open, .open = tracing_open,
.read = seq_read, .read = seq_read,
.read_iter = seq_read_iter,
.splice_read = generic_file_splice_read,
.write = tracing_write_stub, .write = tracing_write_stub,
.llseek = tracing_lseek, .llseek = tracing_lseek,
.release = tracing_release, .release = tracing_release,
......
...@@ -339,7 +339,7 @@ static void move_to_next_cpu(void) ...@@ -339,7 +339,7 @@ static void move_to_next_cpu(void)
cpumask_clear(current_mask); cpumask_clear(current_mask);
cpumask_set_cpu(next_cpu, current_mask); cpumask_set_cpu(next_cpu, current_mask);
sched_setaffinity(0, current_mask); set_cpus_allowed_ptr(current, current_mask);
return; return;
change_mode: change_mode:
...@@ -446,7 +446,7 @@ static int start_single_kthread(struct trace_array *tr) ...@@ -446,7 +446,7 @@ static int start_single_kthread(struct trace_array *tr)
} }
sched_setaffinity(kthread->pid, current_mask); set_cpus_allowed_ptr(kthread, current_mask);
kdata->kthread = kthread; kdata->kthread = kthread;
wake_up_process(kthread); wake_up_process(kthread);
...@@ -492,6 +492,10 @@ static int start_cpu_kthread(unsigned int cpu) ...@@ -492,6 +492,10 @@ static int start_cpu_kthread(unsigned int cpu)
{ {
struct task_struct *kthread; struct task_struct *kthread;
/* Do not start a new hwlatd thread if it is already running */
if (per_cpu(hwlat_per_cpu_data, cpu).kthread)
return 0;
kthread = kthread_run_on_cpu(kthread_fn, NULL, cpu, "hwlatd/%u"); kthread = kthread_run_on_cpu(kthread_fn, NULL, cpu, "hwlatd/%u");
if (IS_ERR(kthread)) { if (IS_ERR(kthread)) {
pr_err(BANNER "could not start sampling thread\n"); pr_err(BANNER "could not start sampling thread\n");
...@@ -584,9 +588,6 @@ static int start_per_cpu_kthreads(struct trace_array *tr) ...@@ -584,9 +588,6 @@ static int start_per_cpu_kthreads(struct trace_array *tr)
*/ */
cpumask_and(current_mask, cpu_online_mask, tr->tracing_cpumask); cpumask_and(current_mask, cpu_online_mask, tr->tracing_cpumask);
for_each_online_cpu(cpu)
per_cpu(hwlat_per_cpu_data, cpu).kthread = NULL;
for_each_cpu(cpu, current_mask) { for_each_cpu(cpu, current_mask) {
retval = start_cpu_kthread(cpu); retval = start_cpu_kthread(cpu);
if (retval) if (retval)
......
...@@ -217,7 +217,7 @@ struct osnoise_variables { ...@@ -217,7 +217,7 @@ struct osnoise_variables {
/* /*
* Per-cpu runtime information. * Per-cpu runtime information.
*/ */
DEFINE_PER_CPU(struct osnoise_variables, per_cpu_osnoise_var); static DEFINE_PER_CPU(struct osnoise_variables, per_cpu_osnoise_var);
/* /*
* this_cpu_osn_var - Return the per-cpu osnoise_variables on its relative CPU * this_cpu_osn_var - Return the per-cpu osnoise_variables on its relative CPU
...@@ -240,7 +240,7 @@ struct timerlat_variables { ...@@ -240,7 +240,7 @@ struct timerlat_variables {
u64 count; u64 count;
}; };
DEFINE_PER_CPU(struct timerlat_variables, per_cpu_timerlat_var); static DEFINE_PER_CPU(struct timerlat_variables, per_cpu_timerlat_var);
/* /*
* this_cpu_tmr_var - Return the per-cpu timerlat_variables on its relative CPU * this_cpu_tmr_var - Return the per-cpu timerlat_variables on its relative CPU
...@@ -332,7 +332,7 @@ struct timerlat_sample { ...@@ -332,7 +332,7 @@ struct timerlat_sample {
/* /*
* Protect the interface. * Protect the interface.
*/ */
struct mutex interface_lock; static struct mutex interface_lock;
/* /*
* Tracer data. * Tracer data.
...@@ -2239,8 +2239,8 @@ static struct trace_min_max_param osnoise_print_stack = { ...@@ -2239,8 +2239,8 @@ static struct trace_min_max_param osnoise_print_stack = {
/* /*
* osnoise/timerlat_period: min 100 us, max 1 s * osnoise/timerlat_period: min 100 us, max 1 s
*/ */
u64 timerlat_min_period = 100; static u64 timerlat_min_period = 100;
u64 timerlat_max_period = 1000000; static u64 timerlat_max_period = 1000000;
static struct trace_min_max_param timerlat_period = { static struct trace_min_max_param timerlat_period = {
.lock = &interface_lock, .lock = &interface_lock,
.val = &osnoise_data.timerlat_period, .val = &osnoise_data.timerlat_period,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment