Messages in this thread | | | Subject | Re: [PATCH 2/2] x86/e820: Use pr_debug to avoid spamming dmesg log with debug messages | From | Jason Baron <> | Date | Fri, 14 May 2021 15:56:01 -0400 |
| |
On 5/14/21 1:38 PM, Joe Perches wrote: > On Tue, 2021-05-11 at 17:31 -0400, Jason Baron wrote: > >> That said, I do see the value in not having to open code the branch stuff, and >> making pr_debug() consistent with printk which does return a value. So that >> makes sense to me. > > IMO: printk should not return a value. >
Ok, the issue we are trying to resolve is to control whether a 'pr_debug()' statement is enabled and thus use that to control subsequent output. The proposed patch does:
+ printed = pr_debug("e820: update [mem %#010Lx-%#010Lx] ", start, end - 1); + if (printed > 0) { + e820_print_type(old_type); + pr_cont(" ==> "); + e820_print_type(new_type); + pr_cont("\n"); + }
I do think pr_debug() here is different from printk() b/c it can be explicitly toggled.
I also suggested an alternative, which is possible with the current code which is to use DYNAMIC_DEBUG_BRANCH().
if (DYNAMIC_DEBUG_BRANCH(e820_debg)) { printk(KERN_DEBUG "e820: update [mem %#010Lx-%#010Lx] ", start, end - 1); e820_print_type(old_type); pr_cont(" ==> "); e820_print_type(new_type); pr_cont("\n"); }
That however does require one to do something like this first:
DEFINE_DYNAMIC_DEBUG_METADATA(e820_dbg, "e820 verbose mode");
So I don't feel too strongly either way, but maybe others do?
Thanks,
-Jason
| |