Skip to content

Commit 5a7f7fc

Browse files
committed
Merge tag 'trace-v5.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing fix and cleanup from Steven Rostedt: "Tracing fix for histograms and a clean up in ftrace: - Fixed a bug that broke the .sym-offset modifier and added a test to make sure nothing breaks it again. - Replace a list_del/list_add() with a list_move()" * tag 'trace-v5.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: ftrace: Use list_move instead of list_del/list_add tracing/selftests: Add tests to test histogram sym and sym-offset modifiers tracing/histograms: Fix parsing of "sym-offset" modifier
2 parents 1eb8df1 + 3ecda64 commit 5a7f7fc

3 files changed

Lines changed: 26 additions & 2 deletions

File tree

kernel/trace/ftrace.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4212,8 +4212,7 @@ static void process_mod_list(struct list_head *head, struct ftrace_ops *ops,
42124212
if (!func) /* warn? */
42134213
continue;
42144214

4215-
list_del(&ftrace_mod->list);
4216-
list_add(&ftrace_mod->list, &process_mods);
4215+
list_move(&ftrace_mod->list, &process_mods);
42174216

42184217
/* Use the newly allocated func, as it may be "*" */
42194218
kfree(ftrace_mod->func);

kernel/trace/trace_events_hist.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,6 +1555,13 @@ static int contains_operator(char *str)
15551555

15561556
switch (*op) {
15571557
case '-':
1558+
/*
1559+
* Unfortunately, the modifier ".sym-offset"
1560+
* can confuse things.
1561+
*/
1562+
if (op - str >= 4 && !strncmp(op - 4, ".sym-offset", 11))
1563+
return FIELD_OP_NONE;
1564+
15581565
if (*str == '-')
15591566
field_op = FIELD_OP_UNARY_MINUS;
15601567
else

tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,24 @@ grep "parent_comm: $COMM" events/sched/sched_process_fork/hist > /dev/null || \
3939

4040
reset_trigger
4141

42+
echo "Test histogram with sym modifier"
43+
44+
echo 'hist:keys=call_site.sym' > events/kmem/kmalloc/trigger
45+
for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done
46+
grep '{ call_site: \[[0-9a-f][0-9a-f]*\] [_a-zA-Z][_a-zA-Z]* *}' events/kmem/kmalloc/hist > /dev/null || \
47+
fail "sym modifier on kmalloc call_site did not work"
48+
49+
reset_trigger
50+
51+
echo "Test histogram with sym-offset modifier"
52+
53+
echo 'hist:keys=call_site.sym-offset' > events/kmem/kmalloc/trigger
54+
for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done
55+
grep '{ call_site: \[[0-9a-f][0-9a-f]*\] [_a-zA-Z][_a-zA-Z]*+0x[0-9a-f][0-9a-f]*' events/kmem/kmalloc/hist > /dev/null || \
56+
fail "sym-offset modifier on kmalloc call_site did not work"
57+
58+
reset_trigger
59+
4260
echo "Test histogram with sort key"
4361

4462
echo 'hist:keys=parent_pid,child_pid:sort=child_pid.ascending' > events/sched/sched_process_fork/trigger

0 commit comments

Comments
 (0)