Re: [RFC PATCH] vsprintf: Add %pv extension replacement for print_vma_addr
From: Andy Shevchenko
Date: Mon Aug 17 2020 - 07:44:53 EST
On Fri, Aug 14, 2020 at 10:53:03AM -0700, Joe Perches wrote:
> There is a print_vma_addr function used several places
> that requires KERN_CONT use.
>
> Add a %pv mechanism to avoid the need for KERN_CONT.
I like the idea, but I would accent the selling point to make code
(in the user call sites) nicer.
> An example conversion is arch/x86/kernel/signal.c
>
> from:
> if (show_unhandled_signals && printk_ratelimit()) {
> printk("%s"
> "%s[%d] bad frame in %s frame:%p ip:%lx sp:%lx orax:%lx",
> task_pid_nr(current) > 1 ? KERN_INFO : KERN_EMERG,
> me->comm, me->pid, where, frame,
> regs->ip, regs->sp, regs->orig_ax);
> print_vma_addr(KERN_CONT " in ", regs->ip);
> pr_cont("\n");
> to:
> printk("%s"
> "%s[%d] bad frame in %s frame:%p ip:%lx sp:%lx orax:%lx in %pv\n",
> task_pid_nr(current) > 1 ? KERN_INFO : KERN_EMERG,
> me->comm, me->pid, where, frame,
> regs->ip, regs->sp, regs->orig_ax, (void *)regs->ip);
...
> +#else
> + buf = string_nocheck(buf, end, "CONFIG_MMU=n", default_str_spec);
> +#endif
Can we avoid this spammy message? Really it's quite long and fills valuable
space in kernel buffer. I would rather print the hashed pointer as it's done
for the rest of %pXXX.
--
With Best Regards,
Andy Shevchenko