Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 455230 - v4l2 ioctl debug messages cannot be turned off
Summary: v4l2 ioctl debug messages cannot be turned off
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel
Version: 5.2
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Mauro Carvalho Chehab
QA Contact: Martin Jenner
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-07-14 09:09 UTC by Howard Gray
Modified: 2009-01-20 20:25 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-01-20 20:25:00 UTC
Target Upstream Version:


Attachments (Terms of Use)
Patch to correct "dbgarg" macro and allow V4L2 ioctl debug messages to be turned on or off with the debug flags (deleted)
2008-07-14 09:14 UTC, Howard Gray
no flags Details | Diff
patch for this problem from the upstream kernel (deleted)
2008-07-14 11:39 UTC, Arnd Bergmann
no flags Details | Diff


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2009:0225 normal SHIPPED_LIVE Important: Red Hat Enterprise Linux 5.3 kernel security and bug fix update 2009-01-20 16:06:24 UTC

Description Howard Gray 2008-07-14 09:09:28 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9) Gecko/2008061015 Firefox/3.0

Description of problem:
The kernel always produces debug messages for every V4L ioctl called. The debug flags in the video device (e.g. V4L2_DEBUG_IOCTL_ARG) are ignored. The macro "dbgarg" used to produce the messages (in file drivers/media/video/videodev.c from line 17) is faulty. Later kernel versions have a corrected macro.

Version-Release number of selected component (if applicable):
RHEL5u1 with kernel-debug-2.6.18-95.el5.ppc64.rpm prerelease kernel 

How reproducible:
Always


Steps to Reproduce:
1.Connect a V4L2 device.
2.In the driver for the V4L2 device ensure that the "debug" field in the "struct video_device" is 0 (i.e. no debug messages required).
3.Run a V4L2 application and observe the kernel log.

Actual Results:
Many messages like these are seen in the kernel log and cannot be turned off:

v4l2 ioctl VIDIOC_S_INPUT, dir=rw (0xc0045627)
v4l2 ioctl VIDIOC_QUERYCAP, dir=r- (0x40685600)
v4l2 ioctl VIDIOC_G_FMT, dir=rw (0xc0d05604)
v4l2 ioctl VIDIOC_S_STD, dir=-w (0x80085618)
v4l2 ioctl VIDIOC_G_FMT, dir=rw (0xc0d05604)
v4l2 ioctl VIDIOC_S_FMT, dir=rw (0xc0d05605)
v4l2 ioctl VIDIOC_TRY_FMT, dir=rw (0xc0d05640)
v4l2 ioctl VIDIOC_TRY_FMT, dir=rw (0xc0d05640)
v4l2 ioctl VIDIOC_TRY_FMT, dir=rw (0xc0d05640)
v4l2 ioctl VIDIOC_TRY_FMT, dir=rw (0xc0d05640)
v4l2 ioctl VIDIOC_TRY_FMT, dir=rw (0xc0d05640)
v4l2 ioctl VIDIOC_TRY_FMT, dir=rw (0xc0d05640)
v4l2 ioctl VIDIOC_TRY_FMT, dir=rw (0xc0d05640)
v4l2 ioctl VIDIOC_TRY_FMT, dir=rw (0xc0d05640)

Expected Results:
The "debug" field in the "struct video_device" should control the output of V4L2 ioctl debug messages but it is ignored.

Additional info:

Comment 1 Howard Gray 2008-07-14 09:14:43 UTC
Created attachment 311686 [details]
Patch to correct "dbgarg" macro and allow V4L2 ioctl debug messages to be turned on or off with the debug flags

This is a backport from newer kernel versions, Without this patch the use of
V4L2 devices on RHEL 5.2 will be made considerably more difficult due to the
very high amount of debug messages created.

Comment 2 Arnd Bergmann 2008-07-14 11:02:49 UTC
The patch only corrects the dbgarg macro, not dbgarg2, which has the same bug.

Comment 3 Howard Gray 2008-07-14 11:24:10 UTC
No, I do not agree. The dbgarg2 macro consists only of an "if" followed by a
single line:

#define dbgarg2(fmt, arg...) \
                if (vfd->debug & V4L2_DEBUG_IOCTL_ARG)                  \
                        printk (KERN_DEBUG "%s: " fmt, vfd->name, ## arg);

So "{" ... "}" brackets are not strictly needed here unless for style purposes.
Later kernel versions (e.g. 2.6.23) have only a corrected version of dbgarg not
dbgarg2.

Comment 4 Arnd Bergmann 2008-07-14 11:39:24 UTC
Created attachment 311689 [details]
patch for this problem from the upstream kernel

Yes, you're right, the curly braces are not needed.

For correctness, it would be better to use the 

do {
  if (vfd->debug)
     printk(...);
} while (0)

form though for both macros, fixing the code in the same way as upstream.

If it's not clear why, the 'do { } while (0)' form avoids problems with users
like

if (condition)
   dbgarg(...)
else
   bar();

that would otherwise turn into

if (condition)
   if (vfd->debug)
       printk(...);
   else
       bar();

which is something completely different.

For reference, the attached patch was merged into mainline to address this
problem.

Comment 5 Howard Gray 2008-07-14 12:17:19 UTC
Fine by me. Best to use the upstream patch, of course.

Comment 6 Mauro Carvalho Chehab 2008-08-12 13:30:53 UTC
sent to rhkernel-list

Comment 7 Don Zickus 2008-09-03 03:40:41 UTC
in kernel-2.6.18-107.el5
You can download this test kernel from http://people.redhat.com/dzickus/el5

Comment 11 Adrian Reber 2009-01-15 11:08:44 UTC
Will this fix appear in RHEL5.2?

Comment 12 errata-xmlrpc 2009-01-20 20:25:00 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2009-0225.html


Note You need to log in before you can comment on or make changes to this bug.