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:
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.
The patch only corrects the dbgarg macro, not dbgarg2, which has the same bug.
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.
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.
Fine by me. Best to use the upstream patch, of course.
sent to rhkernel-list
in kernel-2.6.18-107.el5 You can download this test kernel from http://people.redhat.com/dzickus/el5
Will this fix appear in RHEL5.2?
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