From: Greg KH <gregkh@linuxfoundation.org>
To: Dmitry Vyukov <dvyukov@gmail.com>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
torvalds@linux-foundation.org, Dmitry Vyukov <dvyukov@google.com>
Subject: Re: [PATCH] include/asm-generic/bug.h: clarify valid uses of WARN()
Date: Thu, 21 Jun 2018 09:02:07 +0900 [thread overview]
Message-ID: <20180621000207.GB21936@kroah.com> (raw)
In-Reply-To: <20180620103716.61636-1-dvyukov@gmail.com>
On Wed, Jun 20, 2018 at 12:37:16PM +0200, Dmitry Vyukov wrote:
> From: Dmitry Vyukov <dvyukov@google.com>
>
> Explicitly state that WARN*() should be used only for recoverable
> kernel issues/bugs and that it should not be used for any kind of
> invalid external inputs or transient conditions.
>
> Motivation: it's a very useful capability to be able to understand
> if a particular kernel splat means a kernel bug or simply an invalid
> user-space program. For the former one wants to notify kernel developers,
> while notifying kernel developers for the latter is annoying.
> Even a kernel developer may not know what to do with a WARNING
> in an unfamiliar subsystem. This is especially critical for any automated
> testing systems that may use panic_on_warn and mail kernel developers.
>
> The clear separation also serves as an additional documentation:
> is it a condition that must never occur because of additional
> checks/logic elsewhere? or is it simply a check for invalid inputs
> or unfortunate conditions?
>
> Use of pr_err() for user messages also leads to better error messages.
> "Something is wrong in file foo on line X" is not particularly useful
> message for end user. pr_err() forces developers to write more meaningful
> error messages for user.
>
> As of now we are almost there. We are doing systematic kernel testing
> with panic_on_warn and are not seeing massive amounts of false positives.
> But every now and then another WARN on ENOMEM or invalid inputs pops up
> and leads to a lengthy argument each time. The goal of this change
> is to officially document the rules.
>
> Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
> ---
> include/asm-generic/bug.h | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
Nice!
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
prev parent reply other threads:[~2018-06-21 0:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-20 10:37 Dmitry Vyukov
2018-06-21 0:02 ` Greg KH [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180621000207.GB21936@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=akpm@linux-foundation.org \
--cc=dvyukov@gmail.com \
--cc=dvyukov@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®