From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org,
Mauro Carvalho Chehab <mchehab@infradead.org>,
Hans de Goede <hdegoede@redhat.com>,
Andy Walls <awalls@md.metrocast.net>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
Pawel Osciak <pawel@osciak.com>,
Tomasz Stanislawski <t.stanislaws@samsung.com>
Subject: Re: [RFCv1 PATCH 00/32] Core and vb2 enhancements
Date: Tue, 12 Jun 2012 08:35:10 -0300 [thread overview]
Message-ID: <4FD7296E.9080400@redhat.com> (raw)
In-Reply-To: <201206102127.12029.hverkuil@xs4all.nl>
Em 10-06-2012 16:27, Hans Verkuil escreveu:
> On Sun June 10 2012 19:32:36 Hans Verkuil wrote:
>> On Sun June 10 2012 18:46:52 Mauro Carvalho Chehab wrote:
>>> 3) it would be interesting if you could benchmark the previous code and the new
>>> one, to see what gains this change introduced, in terms of v4l2-core footprint and
>>> performance.
>>
>> I'll try that, should be interesting. Actually, my prediction is that I won't notice any
>> difference. Todays CPUs are so fast that the overhead of the switch is probably hard to
>> measure.
>
> I did some tests, calling various ioctls 100,000,000 times. The actual call into the
> driver was disabled so that I only measure the time spent in v4l2-ioctl.c.
>
> I ran the test program with 'time ./t' and measured the sys time.
>
> For each ioctl I tested 5 times and averaged the results. Times are in seconds.
>
> Old New
> QUERYCAP 24.86 24.37
> UNSUBSCRIBE_EVENT 23.40 23.10
> LOG_STATUS 18.84 18.76
> ENUMINPUT 28.82 28.90
>
> Particularly for QUERYCAP and UNSUBSCRIBE_EVENT I found a small but reproducible
> improvement in speed. The results for LOG_STATUS and ENUMINPUT are too close to
> call.
>
> After looking at the assembly code that the old code produces I suspect (but it
> is hard to be sure) that LOG_STATUS and ENUMINPUT are tested quite early on, whereas
> QUERYCAP and UNSUBSCRIBE_EVENT are tested quite late. The order in which the compiler
> tests definitely has no relationship with the order of the case statements in the
> switch.
The ioctl's are reordered, as gcc optimizes them in order to do a tree search and to avoid
cache flush. The worse case is likely converted into 7 CMP asm calls (log2(128)).
On your code, gcc may not be able to predict the JMP's, so it may actually have cache flushes,
depending on the cache size, and if the caller functions are before of after the video_ioctl2
handler.
I suspect that, if you compare the code with debug enabled, the new code can actually be worse
than the previous one.
It would be good if you could test what happens with QBUF/DQBUF.
> This would certainly explain what I am seeing. I'm actually a bit surprised that
> this is measurable at all.
The timing difference is not significant, especially because those ioctl's aren't the ones
used inside the streaming loop. The only ioctl's that are more time-sensitive are the streaming
ones, especially QBUF/DQBUF.
Regards,
Mauro
next prev parent reply other threads:[~2012-06-12 11:35 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-10 10:25 [RFCv1 PATCH 00/32] Core and vb2 enhancements Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 01/32] Regression fixes Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 02/32] v4l2-ioctl.c: move a block of code down, no other changes Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 03/32] v4l2-ioctl.c: introduce INFO_FL_CLEAR to replace switch Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 04/32] v4l2-ioctl.c: v4l2-ioctl: add debug and callback/offset functionality Hans Verkuil
2012-06-18 9:47 ` Laurent Pinchart
2012-06-18 11:25 ` Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 05/32] v4l2-ioctl.c: remove an unnecessary #ifdef Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 06/32] v4l2-ioctl.c: use the new table for querycap and i/o ioctls Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 07/32] v4l2-ioctl.c: use the new table for priority ioctls Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 08/32] v4l2-ioctl.c: use the new table for format/framebuffer ioctls Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 09/32] v4l2-ioctl.c: use the new table for overlay/streamon/off ioctls Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 10/32] v4l2-ioctl.c: use the new table for std/tuner/modulator ioctls Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 11/32] v4l2-ioctl.c: use the new table for queuing/parm ioctls Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 12/32] v4l2-ioctl.c: use the new table for control ioctls Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 13/32] v4l2-ioctl.c: use the new table for selection ioctls Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 14/32] v4l2-ioctl.c: use the new table for compression ioctls Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 15/32] v4l2-ioctl.c: use the new table for debug ioctls Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 16/32] v4l2-ioctl.c: use the new table for preset/timings ioctls Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 17/32] v4l2-ioctl.c: use the new table for the remaining ioctls Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 18/32] v4l2-ioctl.c: finalize table conversion Hans Verkuil
2012-06-18 9:46 ` Laurent Pinchart
2012-06-18 10:50 ` Mauro Carvalho Chehab
2012-06-18 11:03 ` Laurent Pinchart
2012-06-18 11:49 ` Hans Verkuil
2012-06-18 12:03 ` Mauro Carvalho Chehab
2012-06-18 12:22 ` Hans Verkuil
2012-06-18 11:17 ` Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 19/32] v4l2-dev.c: add debug sysfs entry Hans Verkuil
2012-06-18 9:48 ` Laurent Pinchart
2012-06-18 11:30 ` Hans Verkuil
2012-06-18 11:36 ` Laurent Pinchart
2012-06-10 10:25 ` [RFCv1 PATCH 20/32] v4l2-ioctl: remove v4l_(i2c_)print_ioctl Hans Verkuil
2012-06-18 9:50 ` Laurent Pinchart
2012-06-18 11:33 ` Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 21/32] ivtv: don't mess with vfd->debug Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 22/32] cx18: " Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 23/32] v4l2-dev/ioctl.c: add vb2_queue support to video_device Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 24/32] videobuf2-core: add helper functions Hans Verkuil
2012-06-18 10:23 ` Laurent Pinchart
2012-06-18 11:49 ` Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 25/32] create_bufs: handle count == 0 Hans Verkuil
2012-06-18 10:11 ` Laurent Pinchart
2012-06-18 11:43 ` Hans Verkuil
2012-06-18 12:20 ` Laurent Pinchart
2012-06-10 10:25 ` [RFCv1 PATCH 26/32] vivi: remove pointless g/s_std support Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 27/32] vivi: embed struct video_device instead of allocating it Hans Verkuil
2012-06-18 10:13 ` Laurent Pinchart
2012-06-18 11:44 ` Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 28/32] vivi: use vb2 helper functions Hans Verkuil
2012-06-18 10:08 ` Laurent Pinchart
2012-06-18 11:40 ` Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 29/32] v4l2-dev.c: also add debug support for the fops Hans Verkuil
2012-06-18 10:01 ` Laurent Pinchart
2012-06-18 11:40 ` Hans Verkuil
2012-06-18 12:19 ` Laurent Pinchart
2012-06-18 12:48 ` Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 30/32] v4l2-ioctl.c: shorten the lines of the table Hans Verkuil
2012-06-18 9:57 ` Laurent Pinchart
2012-06-18 11:34 ` Hans Verkuil
2012-06-18 12:15 ` Laurent Pinchart
2012-06-10 10:25 ` [RFCv1 PATCH 31/32] pwc: use the new vb2 helpers Hans Verkuil
2012-06-10 10:25 ` [RFCv1 PATCH 32/32] pwc: v4l2-compliance fixes Hans Verkuil
2012-06-10 16:46 ` [RFCv1 PATCH 00/32] Core and vb2 enhancements Mauro Carvalho Chehab
2012-06-10 17:32 ` Hans Verkuil
2012-06-10 19:27 ` Hans Verkuil
2012-06-12 11:35 ` Mauro Carvalho Chehab [this message]
2012-06-12 13:21 ` Hans Verkuil
2012-06-12 13:24 ` Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FD7296E.9080400@redhat.com \
--to=mchehab@redhat.com \
--cc=awalls@md.metrocast.net \
--cc=g.liakhovetski@gmx.de \
--cc=hdegoede@redhat.com \
--cc=hverkuil@xs4all.nl \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@infradead.org \
--cc=pawel@osciak.com \
--cc=t.stanislaws@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.