Message ID | 20201009220524.485102-2-axelrasmussen@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add tracepoints around mmap_lock acquisition | expand |
Tom, Can you ack this patch for me? -- Steve On Fri, 9 Oct 2020 15:05:23 -0700 Axel Rasmussen <axelrasmussen@google.com> wrote: > It's common [1] to define tracepoint fields as "bool" when they contain > a true / false value. Currently, defining a synthetic event with a > "bool" field yields EINVAL. It's possible to work around this by using > e.g. u8 (assuming sizeof(bool) is 1, and bool is unsigned; if either of > these properties don't match, you get EINVAL [2]). > > Supporting "bool" explicitly makes hooking this up easier and more > portable for userspace. > > [1]: grep -r "bool" include/trace/events/ > [2]: check_synth_field() in kernel/trace/trace_events_hist.c > > Acked-by: Michel Lespinasse <walken@google.com> > Signed-off-by: Axel Rasmussen <axelrasmussen@google.com> > --- > kernel/trace/trace_events_synth.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c > index 8e1974fbad0e..8f94c84349a6 100644 > --- a/kernel/trace/trace_events_synth.c > +++ b/kernel/trace/trace_events_synth.c > @@ -234,6 +234,8 @@ static int synth_field_size(char *type) > size = sizeof(long); > else if (strcmp(type, "unsigned long") == 0) > size = sizeof(unsigned long); > + else if (strcmp(type, "bool") == 0) > + size = sizeof(bool); > else if (strcmp(type, "pid_t") == 0) > size = sizeof(pid_t); > else if (strcmp(type, "gfp_t") == 0) > @@ -276,6 +278,8 @@ static const char *synth_field_fmt(char *type) > fmt = "%ld"; > else if (strcmp(type, "unsigned long") == 0) > fmt = "%lu"; > + else if (strcmp(type, "bool") == 0) > + fmt = "%d"; > else if (strcmp(type, "pid_t") == 0) > fmt = "%d"; > else if (strcmp(type, "gfp_t") == 0) > -- > 2.28.0.1011.ga647a8990f-goog
Hi Steve, Looks ok to me. Acked-by: Tom Zanussi <zanussi@kernel.org> Thanks, Tom On Mon, 2020-10-12 at 10:15 -0400, Steven Rostedt wrote: > Tom, > > Can you ack this patch for me? > > -- Steve > > > On Fri, 9 Oct 2020 15:05:23 -0700 > Axel Rasmussen <axelrasmussen@google.com> wrote: > > > It's common [1] to define tracepoint fields as "bool" when they > > contain > > a true / false value. Currently, defining a synthetic event with a > > "bool" field yields EINVAL. It's possible to work around this by > > using > > e.g. u8 (assuming sizeof(bool) is 1, and bool is unsigned; if > > either of > > these properties don't match, you get EINVAL [2]). > > > > Supporting "bool" explicitly makes hooking this up easier and more > > portable for userspace. > > > > [1]: grep -r "bool" include/trace/events/ > > [2]: check_synth_field() in kernel/trace/trace_events_hist.c > > > > Acked-by: Michel Lespinasse <walken@google.com> > > Signed-off-by: Axel Rasmussen <axelrasmussen@google.com> > > --- > > kernel/trace/trace_events_synth.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/kernel/trace/trace_events_synth.c > > b/kernel/trace/trace_events_synth.c > > index 8e1974fbad0e..8f94c84349a6 100644 > > --- a/kernel/trace/trace_events_synth.c > > +++ b/kernel/trace/trace_events_synth.c > > @@ -234,6 +234,8 @@ static int synth_field_size(char *type) > > size = sizeof(long); > > else if (strcmp(type, "unsigned long") == 0) > > size = sizeof(unsigned long); > > + else if (strcmp(type, "bool") == 0) > > + size = sizeof(bool); > > else if (strcmp(type, "pid_t") == 0) > > size = sizeof(pid_t); > > else if (strcmp(type, "gfp_t") == 0) > > @@ -276,6 +278,8 @@ static const char *synth_field_fmt(char *type) > > fmt = "%ld"; > > else if (strcmp(type, "unsigned long") == 0) > > fmt = "%lu"; > > + else if (strcmp(type, "bool") == 0) > > + fmt = "%d"; > > else if (strcmp(type, "pid_t") == 0) > > fmt = "%d"; > > else if (strcmp(type, "gfp_t") == 0) > > -- > > 2.28.0.1011.ga647a8990f-goog > >
On Mon, 12 Oct 2020 09:26:13 -0500 Tom Zanussi <zanussi@kernel.org> wrote: > Hi Steve, > > Looks ok to me. > > Acked-by: Tom Zanussi <zanussi@kernel.org> Great! I'll pull this patch into my tree. It doesn't look like patch 2/2 is dependent on this and these two can go through different trees. Is everyone OK if I take this patch through my tree? -- Steve
On Mon, Oct 12, 2020 at 7:46 AM Steven Rostedt <rostedt@goodmis.org> wrote: > > On Mon, 12 Oct 2020 09:26:13 -0500 > Tom Zanussi <zanussi@kernel.org> wrote: > > > Hi Steve, > > > > Looks ok to me. > > > > Acked-by: Tom Zanussi <zanussi@kernel.org> > > Great! > > I'll pull this patch into my tree. It doesn't look like patch 2/2 is > dependent on this and these two can go through different trees. > > Is everyone OK if I take this patch through my tree? Sounds good to me. You're right that there is no compile-time dependency between the two patches. Thanks! > > -- Steve
On Fri, 9 Oct 2020, Axel Rasmussen wrote: > It's common [1] to define tracepoint fields as "bool" when they contain > a true / false value. Currently, defining a synthetic event with a > "bool" field yields EINVAL. It's possible to work around this by using > e.g. u8 (assuming sizeof(bool) is 1, and bool is unsigned; if either of > these properties don't match, you get EINVAL [2]). > > Supporting "bool" explicitly makes hooking this up easier and more > portable for userspace. > > [1]: grep -r "bool" include/trace/events/ > [2]: check_synth_field() in kernel/trace/trace_events_hist.c > > Acked-by: Michel Lespinasse <walken@google.com> > Signed-off-by: Axel Rasmussen <axelrasmussen@google.com> Acked-by: David Rientjes <rientjes@google.com>
diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c index 8e1974fbad0e..8f94c84349a6 100644 --- a/kernel/trace/trace_events_synth.c +++ b/kernel/trace/trace_events_synth.c @@ -234,6 +234,8 @@ static int synth_field_size(char *type) size = sizeof(long); else if (strcmp(type, "unsigned long") == 0) size = sizeof(unsigned long); + else if (strcmp(type, "bool") == 0) + size = sizeof(bool); else if (strcmp(type, "pid_t") == 0) size = sizeof(pid_t); else if (strcmp(type, "gfp_t") == 0) @@ -276,6 +278,8 @@ static const char *synth_field_fmt(char *type) fmt = "%ld"; else if (strcmp(type, "unsigned long") == 0) fmt = "%lu"; + else if (strcmp(type, "bool") == 0) + fmt = "%d"; else if (strcmp(type, "pid_t") == 0) fmt = "%d"; else if (strcmp(type, "gfp_t") == 0)