public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arch/x86: get rid of KERN_CONT in show_fault_oops()
@ 2018-06-20 12:55 Dmitry Vyukov
  2018-06-21  1:06 ` Andy Shevchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Vyukov @ 2018-06-20 12:55 UTC (permalink / raw)
  To: tglx, mingo, x86, linux-kernel, sergey.senozhatsky.work; +Cc: Dmitry Vyukov

From: Dmitry Vyukov <dvyukov@google.com>

KERN_CONT leads to split lines in kernel output
and complicates useful changes to printk like
printing context before each line.

Only acceptable use of continuations is basically
boot-time testing.

Get rid of it.

Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
---
 arch/x86/mm/fault.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 9a84a0d08727..2a2def636545 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -671,13 +671,9 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code,
 			printk(smep_warning, from_kuid(&init_user_ns, current_uid()));
 	}
 
-	printk(KERN_ALERT "BUG: unable to handle kernel ");
-	if (address < PAGE_SIZE)
-		printk(KERN_CONT "NULL pointer dereference");
-	else
-		printk(KERN_CONT "paging request");
-
-	printk(KERN_CONT " at %px\n", (void *) address);
+	printk(KERN_ALERT "BUG: unable to handle kernel %s at %px\n",
+		(address < PAGE_SIZE ? "NULL pointer dereference" :
+		"paging request"), (void *) address);
 
 	dump_pagetable(address);
 }
-- 
2.18.0.rc1.244.gcf134e6275-goog


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

* Re: [PATCH] arch/x86: get rid of KERN_CONT in show_fault_oops()
  2018-06-20 12:55 [PATCH] arch/x86: get rid of KERN_CONT in show_fault_oops() Dmitry Vyukov
@ 2018-06-21  1:06 ` Andy Shevchenko
  2018-06-21  7:59   ` Dmitry Vyukov
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2018-06-21  1:06 UTC (permalink / raw)
  To: Dmitry Vyukov
  Cc: Thomas Gleixner, Ingo Molnar,
	maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
	Linux Kernel Mailing List, Sergey Senozhatsky, Dmitry Vyukov

On Wed, Jun 20, 2018 at 3:55 PM, Dmitry Vyukov <dvyukov@gmail.com> wrote:
> From: Dmitry Vyukov <dvyukov@google.com>
>
> KERN_CONT leads to split lines in kernel output
> and complicates useful changes to printk like
> printing context before each line.
>
> Only acceptable use of continuations is basically
> boot-time testing.
>
> Get rid of it.

> +       printk(KERN_ALERT "BUG: unable to handle kernel %s at %px\n",
> +               (address < PAGE_SIZE ? "NULL pointer dereference" :
> +               "paging request"), (void *) address);

Perhaps pr_alert() ?

Btw, parens are redundant for the first argument.

P.S. And personally I would rather do
if (address < PAGE_SIZE)
 pr_alert(...NULL pointer dereference...);
else
 pr_alert(...paging request...);

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH] arch/x86: get rid of KERN_CONT in show_fault_oops()
  2018-06-21  1:06 ` Andy Shevchenko
@ 2018-06-21  7:59   ` Dmitry Vyukov
  2018-06-21  8:17     ` Sergey Senozhatsky
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Vyukov @ 2018-06-21  7:59 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Dmitry Vyukov, Thomas Gleixner, Ingo Molnar,
	maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
	Linux Kernel Mailing List, Sergey Senozhatsky

On Thu, Jun 21, 2018 at 3:06 AM, Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Wed, Jun 20, 2018 at 3:55 PM, Dmitry Vyukov <dvyukov@gmail.com> wrote:
>> From: Dmitry Vyukov <dvyukov@google.com>
>>
>> KERN_CONT leads to split lines in kernel output
>> and complicates useful changes to printk like
>> printing context before each line.
>>
>> Only acceptable use of continuations is basically
>> boot-time testing.
>>
>> Get rid of it.
>
>> +       printk(KERN_ALERT "BUG: unable to handle kernel %s at %px\n",
>> +               (address < PAGE_SIZE ? "NULL pointer dereference" :
>> +               "paging request"), (void *) address);
>
> Perhaps pr_alert() ?

It's the same, right? Make sense.

> Btw, parens are redundant for the first argument.
>
> P.S. And personally I would rather do
> if (address < PAGE_SIZE)
>  pr_alert(...NULL pointer dereference...);
> else
>  pr_alert(...paging request...);

It's kinda shorter this way. Any other opinions?

pr_alert("BUG: unable to handle kernel %s at %px\n",
        address < PAGE_SIZE ? "NULL pointer dereference" :
        "paging request", (void *) address);

vs:

if (address < PAGE_SIZE)
        pr_alert("BUG: unable to handle kernel NULL pointer
dereference at %px\n",
                (void *) address);
else
        pr_alert("BUG: unable to handle kernel paging request at %px\n",
                (void *) address);

Or, should we just do:

pr_alert("BUG: unable to handle kernel paging request at %px\n",
        (void *) address);

and not try to be too smart here? In the end, that can be a NULL deref
with 5K offset, right?

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

* Re: [PATCH] arch/x86: get rid of KERN_CONT in show_fault_oops()
  2018-06-21  7:59   ` Dmitry Vyukov
@ 2018-06-21  8:17     ` Sergey Senozhatsky
  2018-06-25 12:40       ` Dmitry Vyukov
  0 siblings, 1 reply; 5+ messages in thread
From: Sergey Senozhatsky @ 2018-06-21  8:17 UTC (permalink / raw)
  To: Dmitry Vyukov
  Cc: Andy Shevchenko, Dmitry Vyukov, Thomas Gleixner, Ingo Molnar,
	maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
	Linux Kernel Mailing List, Sergey Senozhatsky

On (06/21/18 09:59), Dmitry Vyukov wrote:
> >
> >> +       printk(KERN_ALERT "BUG: unable to handle kernel %s at %px\n",
> >> +               (address < PAGE_SIZE ? "NULL pointer dereference" :
> >> +               "paging request"), (void *) address);
> >
> > Perhaps pr_alert() ?
> 
> It's the same, right? Make sense.

Right.

In printk(KERN_<LEVEL> ...) people tend to forget KERN_<LEVEL> sometimes,
so, I think, in general we want to see more pr_foo() and less printk().

	-ss

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

* Re: [PATCH] arch/x86: get rid of KERN_CONT in show_fault_oops()
  2018-06-21  8:17     ` Sergey Senozhatsky
@ 2018-06-25 12:40       ` Dmitry Vyukov
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Vyukov @ 2018-06-25 12:40 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: Andy Shevchenko, Dmitry Vyukov, Thomas Gleixner, Ingo Molnar,
	maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
	Linux Kernel Mailing List

On Thu, Jun 21, 2018 at 10:17 AM, Sergey Senozhatsky
<sergey.senozhatsky.work@gmail.com> wrote:
> On (06/21/18 09:59), Dmitry Vyukov wrote:
>> >
>> >> +       printk(KERN_ALERT "BUG: unable to handle kernel %s at %px\n",
>> >> +               (address < PAGE_SIZE ? "NULL pointer dereference" :
>> >> +               "paging request"), (void *) address);
>> >
>> > Perhaps pr_alert() ?
>>
>> It's the same, right? Make sense.
>
> Right.
>
> In printk(KERN_<LEVEL> ...) people tend to forget KERN_<LEVEL> sometimes,
> so, I think, in general we want to see more pr_foo() and less printk().

Mailed v2 with pr_alert().

Since nobody else commented on single pr_alert() with ternary operator
vs if + 2 pr_alert()'s, I left it intact for now.

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

end of thread, other threads:[~2018-06-25 12:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-20 12:55 [PATCH] arch/x86: get rid of KERN_CONT in show_fault_oops() Dmitry Vyukov
2018-06-21  1:06 ` Andy Shevchenko
2018-06-21  7:59   ` Dmitry Vyukov
2018-06-21  8:17     ` Sergey Senozhatsky
2018-06-25 12:40       ` Dmitry Vyukov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox