[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1289997434.2109.738.camel@laptop>
Date: Wed, 17 Nov 2010 13:37:14 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Ingo Molnar <mingo@...e.hu>
Cc: Pekka Enberg <penberg@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Steven Rostedt <rostedt@...dmis.org>,
Arjan van de Ven <arjan@...ux.intel.com>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Frederic Weisbecker <fweisbec@...il.com>,
linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Darren Hart <dvhart@...ux.intel.com>,
Arjan van de Ven <arjan@...radead.org>
Subject: Re: [patch] trace: Add user-space event tracing/injection
On Wed, 2010-11-17 at 13:29 +0100, Peter Zijlstra wrote:
> > + case PR_TASK_PERF_USER_TRACE:
> > + {
> > + void __user *uevent_ptr = (void *)arg2;
> > + char kstring[MAX_USER_TRACE_SIZE+1];
> > + unsigned long uevent_len = arg3;
> > +
> > + if (uevent_len > MAX_USER_TRACE_SIZE)
> > + return -EINVAL;
> > + if (copy_from_user(kstring, uevent_ptr, uevent_len))
> > + return -EFAULT;
> > + kstring[uevent_len] = 0;
> > +
> > + trace_user(kstring);
> > + return 0;
> > + }
That implementation can be improved upon, no need to actually do the
copy_from_user() when the tracepoint isn't enabled.
Also, do we really need a max size here? I know ftrace (and the perf
tracepoint interface) are currently limited to 1 page of trace data but
that can be fixed (although not trivially).
Also, -EINVAL isn't really a helpful error code in that case, -EMSGSIZE
seems like a good candidate.
And the uevent name is already taken for something else, re-using it
here might cause confusion.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists