Skip to content

Commit 2293be5

Browse files
committed
Merge tag 'trace-v5.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing fixes from Steven Rostedt: - rtla (Real-Time Linux Analysis tool): - fix typo in man page - Update API -e to -E before it is released - Error message fix and memory leak fix - Partially uninline trace event soft disable to shrink text - Fix function graph start up test - Have triggers affect the trace instance they are in and not top level - Have osnoise sleep in the units it says it uses - Remove unused ftrace stub function - Remove event probe redundant info from event in the buffer - Fix group ownership setting in tracefs - Ensure trace buffer is minimum size to prevent crashes * tag 'trace-v5.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: rtla/osnoise: Fix error message when failing to enable trace instance rtla/osnoise: Free params at the exit rtla/hist: Make -E the short version of --entries tracing: Fix selftest config check for function graph start up test tracefs: Set the group ownership in apply_options() not parse_options() tracing/osnoise: Make osnoise_main to sleep for microseconds ftrace: Remove unused ftrace_startup_enable() stub tracing: Ensure trace buffer is at least 4096 bytes large tracing: Uninline trace_trigger_soft_disabled() partly eprobes: Remove redundant event type information tracing: Have traceon and traceoff trigger honor the instance tracing: Dump stacktrace trigger to the corresponding instance rtla: Fix systme -> system typo on man page
2 parents e41898d + 90f59ee commit 2293be5

File tree

18 files changed

+148
-79
lines changed

18 files changed

+148
-79
lines changed

Documentation/tools/rtla/common_hist_options.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Set the histogram bucket size (default *1*).
44

5-
**-e**, **--entries** *N*
5+
**-E**, **--entries** *N*
66

77
Set the number of entries of the histogram (default 256).
88

Documentation/tools/rtla/common_osnoise_description.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
The **rtla osnoise** tool is an interface for the *osnoise* tracer. The
22
*osnoise* tracer dispatches a kernel thread per-cpu. These threads read the
33
time in a loop while with preemption, softirq and IRQs enabled, thus
4-
allowing all the sources of operating systme noise during its execution.
4+
allowing all the sources of operating system noise during its execution.
55
The *osnoise*'s tracer threads take note of the delta between each time
66
read, along with an interference counter of all sources of interference.
77
At the end of each period, the *osnoise* tracer displays a summary of

Documentation/tools/rtla/rtla-osnoise-hist.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ default). The reason for reducing the runtime is to avoid starving the
3636
**rtla** tool. The tool is also set to run for *one minute*. The output
3737
histogram is set to group outputs in buckets of *10us* and *25* entries::
3838

39-
[root@f34 ~/]# rtla osnoise hist -P F:1 -c 0-11 -r 900000 -d 1M -b 10 -e 25
39+
[root@f34 ~/]# rtla osnoise hist -P F:1 -c 0-11 -r 900000 -d 1M -b 10 -E 25
4040
# RTLA osnoise histogram
4141
# Time unit is microseconds (us)
4242
# Duration: 0 00:01:00

fs/tracefs/inode.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ static int tracefs_parse_options(char *data, struct tracefs_mount_opts *opts)
264264
if (!gid_valid(gid))
265265
return -EINVAL;
266266
opts->gid = gid;
267-
set_gid(tracefs_mount->mnt_root, gid);
268267
break;
269268
case Opt_mode:
270269
if (match_octal(&args[0], &option))
@@ -291,7 +290,9 @@ static int tracefs_apply_options(struct super_block *sb)
291290
inode->i_mode |= opts->mode;
292291

293292
inode->i_uid = opts->uid;
294-
inode->i_gid = opts->gid;
293+
294+
/* Set all the group ids to the mount option */
295+
set_gid(sb->s_root, opts->gid);
295296

296297
return 0;
297298
}

include/linux/trace_events.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,8 @@ event_triggers_post_call(struct trace_event_file *file,
699699

700700
bool trace_event_ignore_this_pid(struct trace_event_file *trace_file);
701701

702+
bool __trace_trigger_soft_disabled(struct trace_event_file *file);
703+
702704
/**
703705
* trace_trigger_soft_disabled - do triggers and test if soft disabled
704706
* @file: The file pointer of the event to test
@@ -708,20 +710,20 @@ bool trace_event_ignore_this_pid(struct trace_event_file *trace_file);
708710
* triggers that require testing the fields, it will return true,
709711
* otherwise false.
710712
*/
711-
static inline bool
713+
static __always_inline bool
712714
trace_trigger_soft_disabled(struct trace_event_file *file)
713715
{
714716
unsigned long eflags = file->flags;
715717

716-
if (!(eflags & EVENT_FILE_FL_TRIGGER_COND)) {
717-
if (eflags & EVENT_FILE_FL_TRIGGER_MODE)
718-
event_triggers_call(file, NULL, NULL, NULL);
719-
if (eflags & EVENT_FILE_FL_SOFT_DISABLED)
720-
return true;
721-
if (eflags & EVENT_FILE_FL_PID_FILTER)
722-
return trace_event_ignore_this_pid(file);
723-
}
724-
return false;
718+
if (likely(!(eflags & (EVENT_FILE_FL_TRIGGER_MODE |
719+
EVENT_FILE_FL_SOFT_DISABLED |
720+
EVENT_FILE_FL_PID_FILTER))))
721+
return false;
722+
723+
if (likely(eflags & EVENT_FILE_FL_TRIGGER_COND))
724+
return false;
725+
726+
return __trace_trigger_soft_disabled(file);
725727
}
726728

727729
#ifdef CONFIG_BPF_EVENTS

kernel/trace/ftrace.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7191,7 +7191,6 @@ static int __init ftrace_nodyn_init(void)
71917191
core_initcall(ftrace_nodyn_init);
71927192

71937193
static inline int ftrace_init_dyn_tracefs(struct dentry *d_tracer) { return 0; }
7194-
static inline void ftrace_startup_enable(int command) { }
71957194
static inline void ftrace_startup_all(int command) { }
71967195

71977196
# define ftrace_startup_sysctl() do { } while (0)

kernel/trace/trace.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,10 +1474,12 @@ static int __init set_buf_size(char *str)
14741474
if (!str)
14751475
return 0;
14761476
buf_size = memparse(str, &str);
1477-
/* nr_entries can not be zero */
1478-
if (buf_size == 0)
1479-
return 0;
1480-
trace_buf_size = buf_size;
1477+
/*
1478+
* nr_entries can not be zero and the startup
1479+
* tests require some buffer space. Therefore
1480+
* ensure we have at least 4096 bytes of buffer.
1481+
*/
1482+
trace_buf_size = max(4096UL, buf_size);
14811483
return 1;
14821484
}
14831485
__setup("trace_buf_size=", set_buf_size);

kernel/trace/trace.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ struct kprobe_trace_entry_head {
136136

137137
struct eprobe_trace_entry_head {
138138
struct trace_entry ent;
139-
unsigned int type;
140139
};
141140

142141
struct kretprobe_trace_entry_head {

kernel/trace/trace_eprobe.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -242,16 +242,13 @@ static int trace_eprobe_tp_arg_update(struct trace_eprobe *ep, int i)
242242

243243
static int eprobe_event_define_fields(struct trace_event_call *event_call)
244244
{
245-
int ret;
246245
struct eprobe_trace_entry_head field;
247246
struct trace_probe *tp;
248247

249248
tp = trace_probe_primary_from_call(event_call);
250249
if (WARN_ON_ONCE(!tp))
251250
return -ENOENT;
252251

253-
DEFINE_FIELD(unsigned int, type, FIELD_STRING_TYPE, 0);
254-
255252
return traceprobe_define_arg_fields(event_call, sizeof(field), tp);
256253
}
257254

@@ -270,23 +267,28 @@ print_eprobe_event(struct trace_iterator *iter, int flags,
270267
struct trace_event_call *pevent;
271268
struct trace_event *probed_event;
272269
struct trace_seq *s = &iter->seq;
270+
struct trace_eprobe *ep;
273271
struct trace_probe *tp;
272+
unsigned int type;
274273

275274
field = (struct eprobe_trace_entry_head *)iter->ent;
276275
tp = trace_probe_primary_from_call(
277276
container_of(event, struct trace_event_call, event));
278277
if (WARN_ON_ONCE(!tp))
279278
goto out;
280279

280+
ep = container_of(tp, struct trace_eprobe, tp);
281+
type = ep->event->event.type;
282+
281283
trace_seq_printf(s, "%s: (", trace_probe_name(tp));
282284

283-
probed_event = ftrace_find_event(field->type);
285+
probed_event = ftrace_find_event(type);
284286
if (probed_event) {
285287
pevent = container_of(probed_event, struct trace_event_call, event);
286288
trace_seq_printf(s, "%s.%s", pevent->class->system,
287289
trace_event_name(pevent));
288290
} else {
289-
trace_seq_printf(s, "%u", field->type);
291+
trace_seq_printf(s, "%u", type);
290292
}
291293

292294
trace_seq_putc(s, ')');
@@ -498,10 +500,6 @@ __eprobe_trace_func(struct eprobe_data *edata, void *rec)
498500
return;
499501

500502
entry = fbuffer.entry = ring_buffer_event_data(fbuffer.event);
501-
if (edata->ep->event)
502-
entry->type = edata->ep->event->event.type;
503-
else
504-
entry->type = 0;
505503
store_trace_args(&entry[1], &edata->ep->tp, rec, sizeof(*entry), dsize);
506504

507505
trace_event_buffer_commit(&fbuffer);

kernel/trace/trace_events_trigger.c

Lines changed: 66 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,20 @@ event_triggers_call(struct trace_event_file *file,
8484
}
8585
EXPORT_SYMBOL_GPL(event_triggers_call);
8686

87+
bool __trace_trigger_soft_disabled(struct trace_event_file *file)
88+
{
89+
unsigned long eflags = file->flags;
90+
91+
if (eflags & EVENT_FILE_FL_TRIGGER_MODE)
92+
event_triggers_call(file, NULL, NULL, NULL);
93+
if (eflags & EVENT_FILE_FL_SOFT_DISABLED)
94+
return true;
95+
if (eflags & EVENT_FILE_FL_PID_FILTER)
96+
return trace_event_ignore_this_pid(file);
97+
return false;
98+
}
99+
EXPORT_SYMBOL_GPL(__trace_trigger_soft_disabled);
100+
87101
/**
88102
* event_triggers_post_call - Call 'post_triggers' for a trace event
89103
* @file: The trace_event_file associated with the event
@@ -1295,6 +1309,16 @@ traceon_trigger(struct event_trigger_data *data,
12951309
struct trace_buffer *buffer, void *rec,
12961310
struct ring_buffer_event *event)
12971311
{
1312+
struct trace_event_file *file = data->private_data;
1313+
1314+
if (file) {
1315+
if (tracer_tracing_is_on(file->tr))
1316+
return;
1317+
1318+
tracer_tracing_on(file->tr);
1319+
return;
1320+
}
1321+
12981322
if (tracing_is_on())
12991323
return;
13001324

@@ -1306,23 +1330,43 @@ traceon_count_trigger(struct event_trigger_data *data,
13061330
struct trace_buffer *buffer, void *rec,
13071331
struct ring_buffer_event *event)
13081332
{
1309-
if (tracing_is_on())
1310-
return;
1333+
struct trace_event_file *file = data->private_data;
1334+
1335+
if (file) {
1336+
if (tracer_tracing_is_on(file->tr))
1337+
return;
1338+
} else {
1339+
if (tracing_is_on())
1340+
return;
1341+
}
13111342

13121343
if (!data->count)
13131344
return;
13141345

13151346
if (data->count != -1)
13161347
(data->count)--;
13171348

1318-
tracing_on();
1349+
if (file)
1350+
tracer_tracing_on(file->tr);
1351+
else
1352+
tracing_on();
13191353
}
13201354

13211355
static void
13221356
traceoff_trigger(struct event_trigger_data *data,
13231357
struct trace_buffer *buffer, void *rec,
13241358
struct ring_buffer_event *event)
13251359
{
1360+
struct trace_event_file *file = data->private_data;
1361+
1362+
if (file) {
1363+
if (!tracer_tracing_is_on(file->tr))
1364+
return;
1365+
1366+
tracer_tracing_off(file->tr);
1367+
return;
1368+
}
1369+
13261370
if (!tracing_is_on())
13271371
return;
13281372

@@ -1334,16 +1378,26 @@ traceoff_count_trigger(struct event_trigger_data *data,
13341378
struct trace_buffer *buffer, void *rec,
13351379
struct ring_buffer_event *event)
13361380
{
1337-
if (!tracing_is_on())
1338-
return;
1381+
struct trace_event_file *file = data->private_data;
1382+
1383+
if (file) {
1384+
if (!tracer_tracing_is_on(file->tr))
1385+
return;
1386+
} else {
1387+
if (!tracing_is_on())
1388+
return;
1389+
}
13391390

13401391
if (!data->count)
13411392
return;
13421393

13431394
if (data->count != -1)
13441395
(data->count)--;
13451396

1346-
tracing_off();
1397+
if (file)
1398+
tracer_tracing_off(file->tr);
1399+
else
1400+
tracing_off();
13471401
}
13481402

13491403
static int
@@ -1540,7 +1594,12 @@ stacktrace_trigger(struct event_trigger_data *data,
15401594
struct trace_buffer *buffer, void *rec,
15411595
struct ring_buffer_event *event)
15421596
{
1543-
trace_dump_stack(STACK_SKIP);
1597+
struct trace_event_file *file = data->private_data;
1598+
1599+
if (file)
1600+
__trace_stack(file->tr, tracing_gen_ctx(), STACK_SKIP);
1601+
else
1602+
trace_dump_stack(STACK_SKIP);
15441603
}
15451604

15461605
static void

0 commit comments

Comments
 (0)