On Thu, Dec 23, 2021 at 12:11:42AM +0900, Masami Hiramatsu wrote: > On Thu, 16 Dec 2021 09:35:07 -0800 > Beau Belgrave <beaub@xxxxxxxxxxxxxxxxxxx> wrote: > > > Pass iterator through to probes to allow copying data directly to the > > probe buffers instead of taking multiple copies. Enables eBPF user and > > raw iterator types out to programs for no-copy scenarios. > > This looks good to me, except for 1 nitpick. See below. > > Reviewed-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx> > > > > > Signed-off-by: Beau Belgrave <beaub@xxxxxxxxxxxxxxxxxxx> > > --- > > kernel/trace/trace_events_user.c | 113 +++++++++++++++++++++++-------- > > 1 file changed, 85 insertions(+), 28 deletions(-) > > > > diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c > > index cc30d1fcbb63..fa3e26281fc3 100644 > > --- a/kernel/trace/trace_events_user.c > > +++ b/kernel/trace/trace_events_user.c > > @@ -41,6 +41,9 @@ > > #define MAX_FIELD_ARRAY_SIZE 1024 > > #define MAX_FIELD_ARG_NAME 256 > > [..] > > -static void user_event_ftrace(struct user_event *user, void *data, u32 datalen, > > +static void user_event_ftrace(struct user_event *user, struct iov_iter *i, > > void *tpdata) > > { > > struct trace_event_file *file; > > @@ -540,41 +556,85 @@ static void user_event_ftrace(struct user_event *user, void *data, u32 datalen, > > > > /* Allocates and fills trace_entry, + 1 of this is data payload */ > > entry = trace_event_buffer_reserve(&event_buffer, file, > > - sizeof(*entry) + datalen); > > + sizeof(*entry) + i->count); > > > > if (unlikely(!entry)) > > return; > > > > - memcpy(entry + 1, data, datalen); > > + if (unlikely(!copy_nofault(entry + 1, i->count, i))) { > > + __trace_event_discard_commit(event_buffer.buffer, > > + event_buffer.event); > > + return; > > + } > > > > trace_event_buffer_commit(&event_buffer); > > Will this be > > if (unlikely(!copy_nofault(entry + 1, i->count, i))) > __trace_event_discard_commit(event_buffer.buffer, > event_buffer.event); > else > trace_event_buffer_commit(&event_buffer); > > ? Sure, why not. Thanks, -Beau