All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] [media] vb2: core: Lower the log level of debug outputs
@ 2017-05-30  9:49 Hirokazu Honda
  2017-05-30 10:19 ` Joe Perches
  0 siblings, 1 reply; 12+ messages in thread
From: Hirokazu Honda @ 2017-05-30  9:49 UTC (permalink / raw)
  To: Pawel Osciak, Marek Szyprowski, Kyungmin Park, Mauro Carvalho Chehab
  Cc: linux-media, linux-kernel, Hirokazu Honda

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

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] [media] vb2: core: Lower the log level of debug outputs
  2017-05-30  9:49 [PATCH v2] [media] vb2: core: Lower the log level of debug outputs Hirokazu Honda
@ 2017-05-30 10:19 ` Joe Perches
       [not found]   ` <CAO5uPHO7GwxCTk2OqQA5NfrL0-Jyt5SB-jVpeUA_eCrqR7u5xA@mail.gmail.com>
  0 siblings, 1 reply; 12+ messages in thread
From: Joe Perches @ 2017-05-30 10:19 UTC (permalink / raw)
  To: Hirokazu Honda, Pawel Osciak, Marek Szyprowski, Kyungmin Park,
	Mauro Carvalho Chehab
  Cc: linux-media, linux-kernel

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
 

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] [media] vb2: core: Lower the log level of debug outputs
       [not found]   ` <CAO5uPHO7GwxCTk2OqQA5NfrL0-Jyt5SB-jVpeUA_eCrqR7u5xA@mail.gmail.com>
@ 2017-05-31  2:16     ` Joe Perches
       [not found]       ` <CAO5uPHPWGABuKf3FuAky2BRx+9E=n-QhZ94RPQ7wEuHAwC1qGg@mail.gmail.com>
  0 siblings, 1 reply; 12+ messages in thread
From: Joe Perches @ 2017-05-31  2:16 UTC (permalink / raw)
  To: Hirokazu Honda, Pawel Osciak, Kyungmin Park, Marek Szyprowski,
	Mauro Carvalho Chehab
  Cc: linux-media, linux-kernel

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.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] [media] vb2: core: Lower the log level of debug outputs
       [not found]       ` <CAO5uPHPWGABuKf3FuAky2BRx+9E=n-QhZ94RPQ7wEuHAwC1qGg@mail.gmail.com>
@ 2017-05-31  4:06         ` Joe Perches
  2017-06-07  9:01           ` Hans Verkuil
  0 siblings, 1 reply; 12+ messages in thread
From: Joe Perches @ 2017-05-31  4:06 UTC (permalink / raw)
  To: Hirokazu Honda
  Cc: Pawel Osciak, Kyungmin Park, Marek Szyprowski,
	Mauro Carvalho Chehab, linux-media, linux-kernel

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.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] [media] vb2: core: Lower the log level of debug outputs
  2017-05-31  4:06         ` Joe Perches
@ 2017-06-07  9:01           ` Hans Verkuil
  2017-06-08  3:24             ` Hirokazu Honda
  0 siblings, 1 reply; 12+ messages in thread
From: Hans Verkuil @ 2017-06-07  9:01 UTC (permalink / raw)
  To: Joe Perches, Hirokazu Honda
  Cc: Pawel Osciak, Kyungmin Park, Marek Szyprowski,
	Mauro Carvalho Chehab, linux-media, linux-kernel

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] [media] vb2: core: Lower the log level of debug outputs
  2017-06-07  9:01           ` Hans Verkuil
@ 2017-06-08  3:24             ` Hirokazu Honda
  2017-06-08  4:39               ` Tomasz Figa
  0 siblings, 1 reply; 12+ messages in thread
From: Hirokazu Honda @ 2017-06-08  3:24 UTC (permalink / raw)
  To: Hans Verkuil
  Cc: Joe Perches, Pawel Osciak, Kyungmin Park, Marek Szyprowski,
	Mauro Carvalho Chehab, linux-media, linux-kernel

Hi,

I completely understand bitmask method now.
I agree to the idea, but it is necessary to change the specification of
a debug parameter.
 (We probably need to change a document about that?)
For example, there is maybe a user who set a debug parameter 3.
The user assume that logs whose levels are less than 4 are shown.
However, after the bitmask method is adopted, someday the logs whose
level is 1 or 2 are only shown, not 3 level logs are not shown.
This will be confusing to users.
The function that users can select a log method is necessary (e.g.
implement dprintk_bitmask and dprintk_level)

The main purpose of my patch is to not output much log messages.
I think the current patch is enough to accomplish the purpose.

Changing the method is a related but different task from my patch.
Therefore, I think it should be done in another patch.

Best,
Hirokazu Honda

On Wed, Jun 7, 2017 at 6:01 PM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
> 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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] [media] vb2: core: Lower the log level of debug outputs
  2017-06-08  3:24             ` Hirokazu Honda
@ 2017-06-08  4:39               ` Tomasz Figa
  2017-06-08  5:16                 ` Joe Perches
  0 siblings, 1 reply; 12+ messages in thread
From: Tomasz Figa @ 2017-06-08  4:39 UTC (permalink / raw)
  To: Hirokazu Honda, Hans Verkuil, Joe Perches
  Cc: Pawel Osciak, Kyungmin Park, Marek Szyprowski,
	Mauro Carvalho Chehab, linux-media, linux-kernel

On Thu, Jun 8, 2017 at 12:24 PM, Hirokazu Honda <hiroh@chromium.org> wrote:
> Hi,
>
> I completely understand bitmask method now.
> I agree to the idea, but it is necessary to change the specification of
> a debug parameter.
>  (We probably need to change a document about that?)
> For example, there is maybe a user who set a debug parameter 3.
> The user assume that logs whose levels are less than 4 are shown.
> However, after the bitmask method is adopted, someday the logs whose
> level is 1 or 2 are only shown, not 3 level logs are not shown.
> This will be confusing to users.

I think I have to agree with Hirokazu here. Even though it's only
about debugging, there might be some automatic testing systems that
actually rely on certain values here. It probably shouldn't be
considered hard ABI, but that still could be a significant annoyance
for everyone.

However, one could add this in an incremental way, i.e. add a new
debug_mask parameter that would be used by dprinkt(), while making the
original debug parameter simply update the debug_mask whenever it's
changed.

I still think that it should be made with a separate patch, though, as
adjusting the levels and changing the filtering method are orthogonal.

Best regards,
Tomasz

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] [media] vb2: core: Lower the log level of debug outputs
  2017-06-08  4:39               ` Tomasz Figa
@ 2017-06-08  5:16                 ` Joe Perches
  2017-06-08  5:24                   ` Tomasz Figa
  0 siblings, 1 reply; 12+ messages in thread
From: Joe Perches @ 2017-06-08  5:16 UTC (permalink / raw)
  To: Tomasz Figa, Hirokazu Honda, Hans Verkuil
  Cc: Pawel Osciak, Kyungmin Park, Marek Szyprowski,
	Mauro Carvalho Chehab, linux-media, linux-kernel

On Thu, 2017-06-08 at 13:39 +0900, Tomasz Figa wrote:
> On Thu, Jun 8, 2017 at 12:24 PM, Hirokazu Honda <hiroh@chromium.org> wrote:
> > Hi,
> > 
> > I completely understand bitmask method now.
> > I agree to the idea, but it is necessary to change the specification of
> > a debug parameter.
> >  (We probably need to change a document about that?)
> > For example, there is maybe a user who set a debug parameter 3.
> > The user assume that logs whose levels are less than 4 are shown.
> > However, after the bitmask method is adopted, someday the logs whose
> > level is 1 or 2 are only shown, not 3 level logs are not shown.
> > This will be confusing to users.
> 
> I think I have to agree with Hirokazu here. Even though it's only
> about debugging, there might be some automatic testing systems that
> actually rely on certain values here.

I think it's a non-argument.

If there automated systems that rely on specific levels, then
changing the levels of individual messages could also cause
those automated systems to fail.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] [media] vb2: core: Lower the log level of debug outputs
  2017-06-08  5:16                 ` Joe Perches
@ 2017-06-08  5:24                   ` Tomasz Figa
  2017-06-08  5:33                     ` Joe Perches
  0 siblings, 1 reply; 12+ messages in thread
From: Tomasz Figa @ 2017-06-08  5:24 UTC (permalink / raw)
  To: Joe Perches
  Cc: Hirokazu Honda, Hans Verkuil, Pawel Osciak, Kyungmin Park,
	Marek Szyprowski, Mauro Carvalho Chehab, linux-media,
	linux-kernel

On Thu, Jun 8, 2017 at 2:16 PM, Joe Perches <joe@perches.com> wrote:
> On Thu, 2017-06-08 at 13:39 +0900, Tomasz Figa wrote:
>> On Thu, Jun 8, 2017 at 12:24 PM, Hirokazu Honda <hiroh@chromium.org> wrote:
>> > Hi,
>> >
>> > I completely understand bitmask method now.
>> > I agree to the idea, but it is necessary to change the specification of
>> > a debug parameter.
>> >  (We probably need to change a document about that?)
>> > For example, there is maybe a user who set a debug parameter 3.
>> > The user assume that logs whose levels are less than 4 are shown.
>> > However, after the bitmask method is adopted, someday the logs whose
>> > level is 1 or 2 are only shown, not 3 level logs are not shown.
>> > This will be confusing to users.
>>
>> I think I have to agree with Hirokazu here. Even though it's only
>> about debugging, there might be some automatic testing systems that
>> actually rely on certain values here.
>
> I think it's a non-argument.
>
> If there automated systems that rely on specific levels, then
> changing the levels of individual messages could also cause
> those automated systems to fail.

Well, that might be true for some of them indeed. I was thinking about
our use case, which relies on particular numbers to get expected
verbosity levels not caring about particular messages. I guess the
break all or none rule is going to apply here, so we should do the
bitmap conversion indeed. :)

On the other hand, I think it would be still preferable to do the
conversion in a separate patch.

Best regards,
Tomasz

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] [media] vb2: core: Lower the log level of debug outputs
  2017-06-08  5:24                   ` Tomasz Figa
@ 2017-06-08  5:33                     ` Joe Perches
  2017-06-27 22:57                       ` Hirokazu Honda
  0 siblings, 1 reply; 12+ messages in thread
From: Joe Perches @ 2017-06-08  5:33 UTC (permalink / raw)
  To: Tomasz Figa
  Cc: Hirokazu Honda, Hans Verkuil, Pawel Osciak, Kyungmin Park,
	Marek Szyprowski, Mauro Carvalho Chehab, linux-media,
	linux-kernel

On Thu, 2017-06-08 at 14:24 +0900, Tomasz Figa wrote:
> On Thu, Jun 8, 2017 at 2:16 PM, Joe Perches <joe@perches.com> wrote:
[]
> > If there automated systems that rely on specific levels, then
> > changing the levels of individual messages could also cause
> > those automated systems to fail.
> 
> Well, that might be true for some of them indeed. I was thinking about
> our use case, which relies on particular numbers to get expected
> verbosity levels not caring about particular messages. I guess the
> break all or none rule is going to apply here, so we should do the
> bitmap conversion indeed. :)
> 
> On the other hand, I think it would be still preferable to do the
> conversion in a separate patch.

Right.  No worries.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] [media] vb2: core: Lower the log level of debug outputs
  2017-06-08  5:33                     ` Joe Perches
@ 2017-06-27 22:57                       ` Hirokazu Honda
  2017-07-28 13:13                         ` Hans Verkuil
  0 siblings, 1 reply; 12+ messages in thread
From: Hirokazu Honda @ 2017-06-27 22:57 UTC (permalink / raw)
  To: Joe Perches
  Cc: Tomasz Figa, Hans Verkuil, Pawel Osciak, Kyungmin Park,
	Marek Szyprowski, Mauro Carvalho Chehab, linux-media,
	linux-kernel

Hi,

According to patch work, this patch are not approved yet and its
status are "Changes Requested."
What changes are necessary actually?
If there is no necessary change, can you approve this patch?

Best,
Hirokazu Honda

On Thu, Jun 8, 2017 at 2:33 PM, Joe Perches <joe@perches.com> wrote:
> On Thu, 2017-06-08 at 14:24 +0900, Tomasz Figa wrote:
>> On Thu, Jun 8, 2017 at 2:16 PM, Joe Perches <joe@perches.com> wrote:
> []
>> > If there automated systems that rely on specific levels, then
>> > changing the levels of individual messages could also cause
>> > those automated systems to fail.
>>
>> Well, that might be true for some of them indeed. I was thinking about
>> our use case, which relies on particular numbers to get expected
>> verbosity levels not caring about particular messages. I guess the
>> break all or none rule is going to apply here, so we should do the
>> bitmap conversion indeed. :)
>>
>> On the other hand, I think it would be still preferable to do the
>> conversion in a separate patch.
>
> Right.  No worries.
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] [media] vb2: core: Lower the log level of debug outputs
  2017-06-27 22:57                       ` Hirokazu Honda
@ 2017-07-28 13:13                         ` Hans Verkuil
  0 siblings, 0 replies; 12+ messages in thread
From: Hans Verkuil @ 2017-07-28 13:13 UTC (permalink / raw)
  To: Hirokazu Honda, Joe Perches
  Cc: Tomasz Figa, Pawel Osciak, Kyungmin Park, Marek Szyprowski,
	Mauro Carvalho Chehab, linux-media, linux-kernel

On 06/28/2017 12:57 AM, Hirokazu Honda wrote:
> Hi,
> 
> According to patch work, this patch are not approved yet and its
> status are "Changes Requested."
> What changes are necessary actually?
> If there is no necessary change, can you approve this patch?

I was considering to have more fine grained control by changing
the debug parameter to a bitmask. But after thinking about it a
bit more I decided that this patch is OK after all.

I'll pick it up the next time I prepare a pull request.

Regards,

	Hans

> 
> Best,
> Hirokazu Honda
> 
> On Thu, Jun 8, 2017 at 2:33 PM, Joe Perches <joe@perches.com> wrote:
>> On Thu, 2017-06-08 at 14:24 +0900, Tomasz Figa wrote:
>>> On Thu, Jun 8, 2017 at 2:16 PM, Joe Perches <joe@perches.com> wrote:
>> []
>>>> If there automated systems that rely on specific levels, then
>>>> changing the levels of individual messages could also cause
>>>> those automated systems to fail.
>>>
>>> Well, that might be true for some of them indeed. I was thinking about
>>> our use case, which relies on particular numbers to get expected
>>> verbosity levels not caring about particular messages. I guess the
>>> break all or none rule is going to apply here, so we should do the
>>> bitmap conversion indeed. :)
>>>
>>> On the other hand, I think it would be still preferable to do the
>>> conversion in a separate patch.
>>
>> Right.  No worries.
>>

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-07-28 13:13 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-30  9:49 [PATCH v2] [media] vb2: core: Lower the log level of debug outputs Hirokazu Honda
2017-05-30 10:19 ` Joe Perches
     [not found]   ` <CAO5uPHO7GwxCTk2OqQA5NfrL0-Jyt5SB-jVpeUA_eCrqR7u5xA@mail.gmail.com>
2017-05-31  2:16     ` Joe Perches
     [not found]       ` <CAO5uPHPWGABuKf3FuAky2BRx+9E=n-QhZ94RPQ7wEuHAwC1qGg@mail.gmail.com>
2017-05-31  4:06         ` Joe Perches
2017-06-07  9:01           ` Hans Verkuil
2017-06-08  3:24             ` Hirokazu Honda
2017-06-08  4:39               ` Tomasz Figa
2017-06-08  5:16                 ` Joe Perches
2017-06-08  5:24                   ` Tomasz Figa
2017-06-08  5:33                     ` Joe Perches
2017-06-27 22:57                       ` Hirokazu Honda
2017-07-28 13:13                         ` Hans Verkuil

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.