Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1653045 > unrolled thread

[PATCH v2] [media] vb2: core: Lower the log level of debug outputs

Started byHirokazu Honda <hiroh@chromium.org>
First post2017-05-30 11:50 +0200
Last post2017-06-07 11:10 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] [media] vb2: core: Lower the log level of debug outputs Hirokazu Honda <hiroh@chromium.org> - 2017-05-30 11:50 +0200
    Re: [PATCH v2] [media] vb2: core: Lower the log level of debug  outputs Joe Perches <joe@perches.com> - 2017-05-30 12:20 +0200
      Re: [PATCH v2] [media] vb2: core: Lower the log level of debug  outputs Joe Perches <joe@perches.com> - 2017-05-31 04:20 +0200
        Re: [PATCH v2] [media] vb2: core: Lower the log level of debug  outputs Joe Perches <joe@perches.com> - 2017-05-31 06:10 +0200
          Re: [PATCH v2] [media] vb2: core: Lower the log level of debug  outputs Hans Verkuil <hverkuil@xs4all.nl> - 2017-06-07 11:10 +0200

#1653045 — [PATCH v2] [media] vb2: core: Lower the log level of debug outputs

FromHirokazu Honda <hiroh@chromium.org>
Date2017-05-30 11:50 +0200
Subject[PATCH v2] [media] vb2: core: Lower the log level of debug outputs
Message-ID<tMLWO-5BU-19@gated-at.bofh.it>
Some debug output whose log level is set 1 flooded the log.
Their log level is lowered to find the important log easily.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
---
 drivers/media/v4l2-core/videobuf2-core.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
index 94afbbf92807..25257f92bbcf 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -1139,7 +1139,7 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const void *pb)
 			continue;
 		}
 
-		dprintk(1, "buffer for plane %d changed\n", plane);
+		dprintk(3, "buffer for plane %d changed\n", plane);
 
 		if (!reacquired) {
 			reacquired = true;
@@ -1294,7 +1294,7 @@ int vb2_core_prepare_buf(struct vb2_queue *q, unsigned int index, void *pb)
 	/* Fill buffer information for the userspace */
 	call_void_bufop(q, fill_user_buffer, vb, pb);
 
-	dprintk(1, "prepare of buffer %d succeeded\n", vb->index);
+	dprintk(2, "prepare of buffer %d succeeded\n", vb->index);
 
 	return ret;
 }
@@ -1424,7 +1424,7 @@ int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb)
 			return ret;
 	}
 
-	dprintk(1, "qbuf of buffer %d succeeded\n", vb->index);
+	dprintk(2, "qbuf of buffer %d succeeded\n", vb->index);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(vb2_core_qbuf);
@@ -1472,7 +1472,7 @@ static int __vb2_wait_for_done_vb(struct vb2_queue *q, int nonblocking)
 		}
 
 		if (nonblocking) {
-			dprintk(1, "nonblocking and no buffers to dequeue, will not wait\n");
+			dprintk(3, "nonblocking and no buffers to dequeue, will not wait\n");
 			return -EAGAIN;
 		}
 
@@ -1619,7 +1619,7 @@ int vb2_core_dqbuf(struct vb2_queue *q, unsigned int *pindex, void *pb,
 	/* go back to dequeued state */
 	__vb2_dqbuf(vb);
 
-	dprintk(1, "dqbuf of buffer %d, with state %d\n",
+	dprintk(2, "dqbuf of buffer %d, with state %d\n",
 			vb->index, vb->state);
 
 	return 0;
-- 
2.13.0.219.gdb65acc882-goog

[toc] | [next] | [standalone]


#1653076 — Re: [PATCH v2] [media] vb2: core: Lower the log level of debug outputs

FromJoe Perches <joe@perches.com>
Date2017-05-30 12:20 +0200
SubjectRe: [PATCH v2] [media] vb2: core: Lower the log level of debug outputs
Message-ID<tMMpQ-63R-23@gated-at.bofh.it>
In reply to#1653045
On Tue, 2017-05-30 at 18:49 +0900, Hirokazu Honda wrote:
> Some debug output whose log level is set 1 flooded the log.
> Their log level is lowered to find the important log easily.

Maybe use pr_debug instead?

Perhaps it would be better to change the level to a bitmap
so these can be more individually controlled.

Maybe add MODULE_PARM_DESC too.

Perhaps something like below (without the pr_debug conversion)

---
 drivers/media/v4l2-core/videobuf2-core.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
index 94afbbf92807..88ae2b238115 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -31,12 +31,13 @@
 
 static int debug;
 module_param(debug, int, 0644);
+MODULE_PARM_DESC(debug, "debugging output control bitmap (values from 0-31)")
 
-#define dprintk(level, fmt, arg...)					      \
-	do {								      \
-		if (debug >= level)					      \
-			pr_info("vb2-core: %s: " fmt, __func__, ## arg); \
-	} while (0)
+#define dprintk(level, fmt, ...)					\
+do {									\
+	if (debug & BIT(level))						\
+		pr_info("vb2-core: %s: " fmt, __func__, ##__VA_ARGS__);	\
+} while (0)
 
 #ifdef CONFIG_VIDEO_ADV_DEBUG
 

[toc] | [prev] | [next] | [standalone]


#1653777 — Re: [PATCH v2] [media] vb2: core: Lower the log level of debug outputs

FromJoe Perches <joe@perches.com>
Date2017-05-31 04:20 +0200
SubjectRe: [PATCH v2] [media] vb2: core: Lower the log level of debug outputs
Message-ID<tN1oR-732-1@gated-at.bofh.it>
In reply to#1653076
On Wed, 2017-05-31 at 11:05 +0900, Hirokazu Honda wrote:
> Although bitmap is useful, there is need to change the log level for each
> log.
> Because it will take a longer time, it should be done in another patch.

I have no idea what you mean.

A bit & comparison is typically an identical instruction
cycle count to a >= comparison.

[toc] | [prev] | [next] | [standalone]


#1653821 — Re: [PATCH v2] [media] vb2: core: Lower the log level of debug outputs

FromJoe Perches <joe@perches.com>
Date2017-05-31 06:10 +0200
SubjectRe: [PATCH v2] [media] vb2: core: Lower the log level of debug outputs
Message-ID<tN37k-8e3-15@gated-at.bofh.it>
In reply to#1653777
On Wed, 2017-05-31 at 12:28 +0900, Hirokazu Honda wrote:
> If I understand a bitmap correctly, it is necessary to change the log level
> for each message.
> I didn't mean a bitmap will take a long CPU time.
> I mean the work to change so takes a long time.

No, none of the messages or levels need change,
only the >= test changes to & so that for instance,
level 1 and level 3 messages could be emitted
without also emitting level 2 messages.

The patch suggested is all that would be required.

[toc] | [prev] | [next] | [standalone]


#1659561 — Re: [PATCH v2] [media] vb2: core: Lower the log level of debug outputs

FromHans Verkuil <hverkuil@xs4all.nl>
Date2017-06-07 11:10 +0200
SubjectRe: [PATCH v2] [media] vb2: core: Lower the log level of debug outputs
Message-ID<tPF8u-4Fk-7@gated-at.bofh.it>
In reply to#1653821
On 31/05/17 06:06, Joe Perches wrote:
> On Wed, 2017-05-31 at 12:28 +0900, Hirokazu Honda wrote:
>> If I understand a bitmap correctly, it is necessary to change the log level
>> for each message.
>> I didn't mean a bitmap will take a long CPU time.
>> I mean the work to change so takes a long time.
> 
> No, none of the messages or levels need change,
> only the >= test changes to & so that for instance,
> level 1 and level 3 messages could be emitted
> without also emitting level 2 messages.
> 
> The patch suggested is all that would be required.
> 

I prefer the solution that Joe proposed as well.

It's more useful, esp. with a complex beast like vb2.

Regards,

	Hans

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web