aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2013-12-16 03:45:37 -0500
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-01-07 03:51:41 -0500
commitaa32f4c0bcce7dac55bf2639f4a6cf37c5c96934 (patch)
tree04bc0b91fe4ec0f5983f13673391a08505dd72ef
parent3fe6d4b9620a653f46c5566016c8b060d21e0543 (diff)
[media] v4l2: move tracepoints to video_usercopy
The (d)qbuf ioctls were traced in the low-level v4l2 ioctl function. The trace was outside the serialization lock, so that can affect the usefulness of the timing. In addition, the __user pointer was expected instead of a proper kernel pointer. By moving the tracepoints to video_usercopy we ensure that the trace calls use the correct kernel pointer, and that it happens right after the ioctl call to the driver, so certainly inside the serialization lock. In addition, we only trace if the call was successful. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Wade Farnsworth <wade_farnsworth@mentor.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--drivers/media/v4l2-core/v4l2-dev.c9
-rw-r--r--drivers/media/v4l2-core/v4l2-ioctl.c9
2 files changed, 9 insertions, 9 deletions
diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c
index 1cc17496b202..b5aaaac427ad 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -31,10 +31,6 @@
31#include <media/v4l2-device.h> 31#include <media/v4l2-device.h>
32#include <media/v4l2-ioctl.h> 32#include <media/v4l2-ioctl.h>
33 33
34
35#define CREATE_TRACE_POINTS
36#include <trace/events/v4l2.h>
37
38#define VIDEO_NUM_DEVICES 256 34#define VIDEO_NUM_DEVICES 256
39#define VIDEO_NAME "video4linux" 35#define VIDEO_NAME "video4linux"
40 36
@@ -395,11 +391,6 @@ static long v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
395 } else 391 } else
396 ret = -ENOTTY; 392 ret = -ENOTTY;
397 393
398 if (cmd == VIDIOC_DQBUF)
399 trace_v4l2_dqbuf(vdev->minor, (struct v4l2_buffer *)arg);
400 else if (cmd == VIDIOC_QBUF)
401 trace_v4l2_qbuf(vdev->minor, (struct v4l2_buffer *)arg);
402
403 return ret; 394 return ret;
404} 395}
405 396
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 68e6b5e912ff..707aef705a47 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -28,6 +28,9 @@
28#include <media/v4l2-device.h> 28#include <media/v4l2-device.h>
29#include <media/videobuf2-core.h> 29#include <media/videobuf2-core.h>
30 30
31#define CREATE_TRACE_POINTS
32#include <trace/events/v4l2.h>
33
31/* Zero out the end of the struct pointed to by p. Everything after, but 34/* Zero out the end of the struct pointed to by p. Everything after, but
32 * not including, the specified field is cleared. */ 35 * not including, the specified field is cleared. */
33#define CLEAR_AFTER_FIELD(p, field) \ 36#define CLEAR_AFTER_FIELD(p, field) \
@@ -2338,6 +2341,12 @@ video_usercopy(struct file *file, unsigned int cmd, unsigned long arg,
2338 err = func(file, cmd, parg); 2341 err = func(file, cmd, parg);
2339 if (err == -ENOIOCTLCMD) 2342 if (err == -ENOIOCTLCMD)
2340 err = -ENOTTY; 2343 err = -ENOTTY;
2344 if (err == 0) {
2345 if (cmd == VIDIOC_DQBUF)
2346 trace_v4l2_dqbuf(video_devdata(file)->minor, parg);
2347 else if (cmd == VIDIOC_QBUF)
2348 trace_v4l2_qbuf(video_devdata(file)->minor, parg);
2349 }
2341 2350
2342 if (has_array_args) { 2351 if (has_array_args) {
2343 *kernel_ptr = user_ptr; 2352 *kernel_ptr = user_ptr;