Skip to content

Commit cb30bf8

Browse files
committed
Merge tag 'trace-v7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull tracing updates from Steven Rostedt: - Fix printf format warning for bprintf sunrpc uses a trace_printk() that triggers a printf warning during the compile. Move the __printf() attribute around for when debugging is not enabled the warning will go away - Remove redundant check for EVENT_FILE_FL_FREED in event_filter_write() The FREED flag is checked in the call to event_file_file() and then checked again right afterward, which is unneeded - Clean up event_file_file() and event_file_data() helpers These helper functions played a different role in the past, but now with eventfs, the READ_ONCE() isn't needed. Simplify the code a bit and also add a warning to event_file_data() if the file or its data is not present - Remove updating file->private_data in tracing open All access to the file private data is handled by the helper functions, which do not use file->private_data. Stop updating it on open - Show ENUM names in function arguments via BTF in function tracing When showing the function arguments when func-args option is set for function tracing, if one of the arguments is found to be an enum, show the name of the enum instead of its number - Add new trace_call__##name() API for tracepoints Tracepoints are enabled via static_branch() blocks, where when not enabled, there's only a nop that is in the code where the execution will just skip over it. When tracing is enabled, the nop is converted to a direct jump to the tracepoint code. Sometimes more calculations are required to be performed to update the parameters of the tracepoint. In this case, trace_##name##_enabled() is called which is a static_branch() that gets enabled only when the tracepoint is enabled. This allows the extra calculations to also be skipped by the nop: if (trace_foo_enabled()) { x = bar(); trace_foo(x); } Where the x=bar() is only performed when foo is enabled. The problem with this approach is that there's now two static_branch() calls. One for checking if the tracepoint is enabled, and then again to know if the tracepoint should be called. The second one is redundant Introduce trace_call__foo() that will call the foo() tracepoint directly without doing a static_branch(): if (trace_foo_enabled()) { x = bar(); trace_call__foo(); } - Update various locations to use the new trace_call__##name() API - Move snapshot code out of trace.c Cleaning up trace.c to not be a "dump all", move the snapshot code out of it and into a new trace_snapshot.c file - Clean up some "%*.s" to "%*s" - Allow boot kernel command line options to be called multiple times Have options like: ftrace_filter=foo ftrace_filter=bar ftrace_filter=zoo Equal to: ftrace_filter=foo,bar,zoo - Fix ipi_raise event CPU field to be a CPU field The ipi_raise target_cpus field is defined as a __bitmask(). There is now a __cpumask() field definition. Update the field to use that - Have hist_field_name() use a snprintf() and not a series of strcat() It's safer to use snprintf() that a series of strcat() - Fix tracepoint regfunc balancing A tracepoint can define a "reg" and "unreg" function that gets called before the tracepoint is enabled, and after it is disabled respectively. But on error, after the "reg" func is called and the tracepoint is not enabled, the "unreg" function is not called to tear down what the "reg" function performed - Fix output that shows what histograms are enabled Event variables are displayed incorrectly in the histogram output Instead of "sched.sched_wakeup.$var", it is showing "$sched.sched_wakeup.var" where the '$' is in the incorrect location - Some other simple cleanups * tag 'trace-v7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: (24 commits) selftests/ftrace: Add test case for fully-qualified variable references tracing: Fix fully-qualified variable reference printing in histograms tracepoint: balance regfunc() on func_add() failure in tracepoint_add_func() tracing: Rebuild full_name on each hist_field_name() call tracing: Report ipi_raise target CPUs as cpumask tracing: Remove duplicate latency_fsnotify() stub tracing: Preserve repeated trace_trigger boot parameters tracing: Append repeated boot-time tracing parameters tracing: Remove spurious default precision from show_event_trigger/filter formats cpufreq: Use trace_call__##name() at guarded tracepoint call sites tracing: Remove tracing_alloc_snapshot() when snapshot isn't defined tracing: Move snapshot code out of trace.c and into trace_snapshot.c mm: damon: Use trace_call__##name() at guarded tracepoint call sites btrfs: Use trace_call__##name() at guarded tracepoint call sites spi: Use trace_call__##name() at guarded tracepoint call sites i2c: Use trace_call__##name() at guarded tracepoint call sites kernel: Use trace_call__##name() at guarded tracepoint call sites tracepoint: Add trace_call__##name() API tracing: trace_mmap.h: fix a kernel-doc warning tracing: Pretty-print enum parameters in function arguments ...
2 parents c9e03d5 + 621a59d commit cb30bf8

28 files changed

Lines changed: 1397 additions & 1292 deletions

drivers/cpufreq/amd-pstate.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ static int msr_update_perf(struct cpufreq_policy *policy, u8 min_perf,
256256
if (trace_amd_pstate_epp_perf_enabled()) {
257257
union perf_cached perf = READ_ONCE(cpudata->perf);
258258

259-
trace_amd_pstate_epp_perf(cpudata->cpu,
259+
trace_call__amd_pstate_epp_perf(cpudata->cpu,
260260
perf.highest_perf,
261261
epp,
262262
min_perf,
@@ -306,7 +306,7 @@ static int msr_set_epp(struct cpufreq_policy *policy, u8 epp)
306306
if (trace_amd_pstate_epp_perf_enabled()) {
307307
union perf_cached perf = cpudata->perf;
308308

309-
trace_amd_pstate_epp_perf(cpudata->cpu, perf.highest_perf,
309+
trace_call__amd_pstate_epp_perf(cpudata->cpu, perf.highest_perf,
310310
epp,
311311
FIELD_GET(AMD_CPPC_MIN_PERF_MASK,
312312
cpudata->cppc_req_cached),
@@ -420,7 +420,7 @@ static int shmem_set_epp(struct cpufreq_policy *policy, u8 epp)
420420
if (trace_amd_pstate_epp_perf_enabled()) {
421421
union perf_cached perf = cpudata->perf;
422422

423-
trace_amd_pstate_epp_perf(cpudata->cpu, perf.highest_perf,
423+
trace_call__amd_pstate_epp_perf(cpudata->cpu, perf.highest_perf,
424424
epp,
425425
FIELD_GET(AMD_CPPC_MIN_PERF_MASK,
426426
cpudata->cppc_req_cached),
@@ -585,7 +585,7 @@ static int shmem_update_perf(struct cpufreq_policy *policy, u8 min_perf,
585585
if (trace_amd_pstate_epp_perf_enabled()) {
586586
union perf_cached perf = READ_ONCE(cpudata->perf);
587587

588-
trace_amd_pstate_epp_perf(cpudata->cpu,
588+
trace_call__amd_pstate_epp_perf(cpudata->cpu,
589589
perf.highest_perf,
590590
epp,
591591
min_perf,
@@ -663,7 +663,7 @@ static void amd_pstate_update(struct cpufreq_policy *policy, u8 min_perf,
663663
}
664664

665665
if (trace_amd_pstate_perf_enabled() && amd_pstate_sample(cpudata)) {
666-
trace_amd_pstate_perf(min_perf, des_perf, max_perf, cpudata->freq,
666+
trace_call__amd_pstate_perf(min_perf, des_perf, max_perf, cpudata->freq,
667667
cpudata->cur.mperf, cpudata->cur.aperf, cpudata->cur.tsc,
668668
cpudata->cpu, fast_switch);
669669
}

drivers/cpufreq/cpufreq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2212,7 +2212,7 @@ unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy,
22122212

22132213
if (trace_cpu_frequency_enabled()) {
22142214
for_each_cpu(cpu, policy->cpus)
2215-
trace_cpu_frequency(freq, cpu);
2215+
trace_call__cpu_frequency(freq, cpu);
22162216
}
22172217

22182218
return freq;

drivers/cpufreq/intel_pstate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3132,7 +3132,7 @@ static void intel_cpufreq_trace(struct cpudata *cpu, unsigned int trace_type, in
31323132
return;
31333133

31343134
sample = &cpu->sample;
3135-
trace_pstate_sample(trace_type,
3135+
trace_call__pstate_sample(trace_type,
31363136
0,
31373137
old_pstate,
31383138
cpu->pstate.current_pstate,

drivers/i2c/i2c-core-slave.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ int i2c_slave_event(struct i2c_client *client,
8989
int ret = client->slave_cb(client, event, val);
9090

9191
if (trace_i2c_slave_enabled())
92-
trace_i2c_slave(client, event, val, ret);
92+
trace_call__i2c_slave(client, event, val, ret);
9393

9494
return ret;
9595
}

drivers/spi/spi-axi-spi-engine.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ static int spi_engine_transfer_one_message(struct spi_controller *host,
953953
struct spi_transfer *xfer;
954954

955955
list_for_each_entry(xfer, &msg->transfers, transfer_list)
956-
trace_spi_transfer_start(msg, xfer);
956+
trace_call__spi_transfer_start(msg, xfer);
957957
}
958958

959959
spin_lock_irqsave(&spi_engine->lock, flags);
@@ -987,7 +987,7 @@ static int spi_engine_transfer_one_message(struct spi_controller *host,
987987
struct spi_transfer *xfer;
988988

989989
list_for_each_entry(xfer, &msg->transfers, transfer_list)
990-
trace_spi_transfer_stop(msg, xfer);
990+
trace_call__spi_transfer_stop(msg, xfer);
991991
}
992992

993993
out:

fs/btrfs/extent_map.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,7 +1318,7 @@ static void btrfs_extent_map_shrinker_worker(struct work_struct *work)
13181318
if (trace_btrfs_extent_map_shrinker_scan_enter_enabled()) {
13191319
s64 nr = percpu_counter_sum_positive(&fs_info->evictable_extent_maps);
13201320

1321-
trace_btrfs_extent_map_shrinker_scan_enter(fs_info, nr);
1321+
trace_call__btrfs_extent_map_shrinker_scan_enter(fs_info, nr);
13221322
}
13231323

13241324
while (ctx.scanned < ctx.nr_to_scan && !btrfs_fs_closing(fs_info)) {
@@ -1358,7 +1358,7 @@ static void btrfs_extent_map_shrinker_worker(struct work_struct *work)
13581358
if (trace_btrfs_extent_map_shrinker_scan_exit_enabled()) {
13591359
s64 nr = percpu_counter_sum_positive(&fs_info->evictable_extent_maps);
13601360

1361-
trace_btrfs_extent_map_shrinker_scan_exit(fs_info, nr_dropped, nr);
1361+
trace_call__btrfs_extent_map_shrinker_scan_exit(fs_info, nr_dropped, nr);
13621362
}
13631363

13641364
atomic64_set(&fs_info->em_shrinker_nr_to_scan, 0);

fs/btrfs/raid56.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,7 +1719,7 @@ static void submit_read_wait_bio_list(struct btrfs_raid_bio *rbio,
17191719
struct raid56_bio_trace_info trace_info = { 0 };
17201720

17211721
bio_get_trace_info(rbio, bio, &trace_info);
1722-
trace_raid56_read(rbio, bio, &trace_info);
1722+
trace_call__raid56_read(rbio, bio, &trace_info);
17231723
}
17241724
submit_bio(bio);
17251725
}
@@ -2404,7 +2404,7 @@ static void submit_write_bios(struct btrfs_raid_bio *rbio,
24042404
struct raid56_bio_trace_info trace_info = { 0 };
24052405

24062406
bio_get_trace_info(rbio, bio, &trace_info);
2407-
trace_raid56_write(rbio, bio, &trace_info);
2407+
trace_call__raid56_write(rbio, bio, &trace_info);
24082408
}
24092409
submit_bio(bio);
24102410
}

include/linux/ftrace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#define ARCH_SUPPORTS_FTRACE_OPS 0
3232
#endif
3333

34-
#ifdef CONFIG_TRACING
34+
#ifdef CONFIG_TRACER_SNAPSHOT
3535
extern void ftrace_boot_snapshot(void);
3636
#else
3737
static inline void ftrace_boot_snapshot(void) { }

include/linux/trace_printk.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ do { \
107107
__trace_printk(_THIS_IP_, fmt, ##args); \
108108
} while (0)
109109

110-
extern __printf(2, 3)
111110
int __trace_bprintk(unsigned long ip, const char *fmt, ...);
112111

113112
extern __printf(2, 3)

include/linux/tracepoint.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,10 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
314314
WARN_ONCE(!rcu_is_watching(), \
315315
"RCU not watching for tracepoint"); \
316316
} \
317+
} \
318+
static inline void trace_call__##name(proto) \
319+
{ \
320+
__do_trace_##name(args); \
317321
}
318322

319323
#define __DECLARE_TRACE_SYSCALL(name, proto, args, data_proto) \
@@ -333,6 +337,11 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
333337
WARN_ONCE(!rcu_is_watching(), \
334338
"RCU not watching for tracepoint"); \
335339
} \
340+
} \
341+
static inline void trace_call__##name(proto) \
342+
{ \
343+
might_fault(); \
344+
__do_trace_##name(args); \
336345
}
337346

338347
/*
@@ -418,6 +427,8 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
418427
#define __DECLARE_TRACE_COMMON(name, proto, args, data_proto) \
419428
static inline void trace_##name(proto) \
420429
{ } \
430+
static inline void trace_call__##name(proto) \
431+
{ } \
421432
static inline int \
422433
register_trace_##name(void (*probe)(data_proto), \
423434
void *data) \

0 commit comments

Comments
 (0)