vb2: core: Lower the log level of debug outputs
PATCH v2 1/1 vb2: core: Lower the log level of debug outputs
Some debug output whose log level is set 1 flooded the log. Their log level is lowered to find the important log easily.
--- drivers/media/v4l2-core/videobuf2-core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/media/v4l2-core/videobuf2-core.c +5 -5
@@ -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 ;
Signature · 1 line
2.13.0.219.gdb65acc882-goog
Quoted 2 lines · 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.
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(-)
drivers/media/v4l2-core/videobuf2-core.c +0 -0
@@ -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
A message that is not in the archive (sent off-list or not yet received): CAO5uPHO7GwxCTk2OqQA5NfrL0-Jyt5SB-jVpeUA_eCrqR7u5xA@mail.gmail.com
Quoted 3 lines · Hirokazu Honda
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.
A message that is not in the archive (sent off-list or not yet received): CAO5uPHPWGABuKf3FuAky2BRx+9E=n-QhZ94RPQ7wEuHAwC1qGg@mail.gmail.com
Quoted 4 lines · Hirokazu Honda
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.
Quoted 6 lines · Joe Perches
Quoted 4 lines · Hirokazu Honda
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.
Quoted 7 lines
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
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
Quoted 22 lines · Hans Verkuil
Quoted 6 lines · Joe Perches
Quoted 4 lines · Hirokazu Honda
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.Quoted 7 lines
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
Quoted 11 lines · Hirokazu Honda
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
Quoted 13 lines · Tomasz Figa
Quoted 11 lines · Hirokazu Honda
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.
Quoted 3 lines
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.
Quoted 18 lines · Joe Perches
Quoted 13 lines · Tomasz Figa
Quoted 11 lines · Hirokazu Honda
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.Quoted 3 lines
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.
Quoted 5 lines
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
Quoted 1 line · Tomasz Figa
On Thu, Jun 8, 2017 at 2:16 PM, Joe Perches <[email protected]> wrote:
[]
Quoted 4 lines
Quoted 3 lines
If there automated systems that rely on specific levels, then changing the levels of individual messages could also cause those automated systems to fail.
Quoted 8 lines
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.
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
Quoted 18 lines · Joe Perches
Quoted 1 line · Tomasz Figa
On Thu, Jun 8, 2017 at 2:16 PM, Joe Perches <[email protected]> wrote:
[]
Quoted 4 lines
Quoted 3 lines
If there automated systems that rely on specific levels, then changing the levels of individual messages could also cause those automated systems to fail.
Quoted 8 lines
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.
Quoted 6 lines · Hirokazu Honda
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
Quoted 23 lines
Best,
Hirokazu HondaQuoted 18 lines · Joe Perches
Quoted 1 line · Tomasz Figa
On Thu, Jun 8, 2017 at 2:16 PM, Joe Perches <[email protected]> wrote:
[]
Quoted 4 lines
Quoted 3 lines
If there automated systems that rely on specific levels, then changing the levels of individual messages could also cause those automated systems to fail.
Quoted 8 lines
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.