linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	linux-mm@kvack.org
Subject: Re: [patch] mm, mempolicy: make mempolicies robust against errors
Date: Tue, 6 Mar 2012 21:58:41 -0800 (PST)	[thread overview]
Message-ID: <alpine.DEB.2.00.1203062151530.6424@chino.kir.corp.google.com> (raw)
In-Reply-To: <CAHGf_=qG1Lah00fGTNENvtgacsUt1=FcMKyt+kmPG1=UD6ecNw@mail.gmail.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2124 bytes --]

On Wed, 7 Mar 2012, KOSAKI Motohiro wrote:

> > It's unnecessary to BUG() in situations when a mempolicy has an
> > unsupported mode, it just means that a mode doesn't have complete coverage
> > in all mempolicy functions -- which is an error, but not a fatal error --
> > or that a bit has flipped.  Regardless, it's sufficient to warn the user
> > in the kernel log of the situation once and then proceed without crashing
> > the system.
> >
> > This patch converts nearly all the BUG()'s in mm/mempolicy.c to
> > WARN_ON_ONCE(1) and provides the necessary code to return successfully.
> 
> I'm sorry. I simple don't understand the purpose of this patch. every
> mem policy  syscalls have input check then we can't hit BUG()s in
> mempolicy.c. To me, BUG() is obvious notation than WARN_ON_ONCE().
> 

Right, this patch doesn't functionally change anything except it will (1) 
continue to warn users when there's a legitimate mempolicy code error by 
way of WARN_ON_ONCE() (which is good), just without crashing the machine 
unnecessarily and (2) allow the system to stay alive since no mempolicy 
error changed by this bug is fatal.  We should only be using BUG() when 
the side-effects of continuing are fatal; doing WARN_ON_ONCE(1) is 
sufficient annotation, I think, that this code should never be reached -- 
BUG() has no advantage here.

> We usually use WARN_ON_ONCE() for hw drivers code. Because of, the
> warn-on mean "we believe this route never reach, but we afraid there
> is crazy buggy hardware".
> 
> And, now BUG() has renreachable() annotation. why don't it work?
> 
> 
> #define BUG()                                                   \
> do {                                                            \
>         asm volatile("ud2");                                    \
>         unreachable();                                          \
> } while (0)
> 

That's not compiled for CONFIG_BUG=n; such a config fallsback to 
include/asm-generic/bug.h which just does

	#define BUG()	do {} while (0)

because CONFIG_BUG specifically _wants_ to bypass BUG()s and is reasonably 
protected by CONFIG_EXPERT.

  reply	other threads:[~2012-03-07  5:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-04 21:43 [patch] mm, mempolicy: dummy slab_node return value for bugless kernels David Rientjes
2012-03-06 20:15 ` Rafael Aquini
2012-03-07  0:08 ` Andrew Morton
2012-03-07  0:55   ` Rafael Aquini
2012-03-07  4:25   ` David Rientjes
2012-03-07  4:29     ` [patch] mm, mempolicy: make mempolicies robust against errors David Rientjes
2012-03-07  5:30       ` KOSAKI Motohiro
2012-03-07  5:58         ` David Rientjes [this message]
2012-03-07  6:34           ` KOSAKI Motohiro
2012-03-07  6:56             ` David Rientjes
2012-03-07 16:24               ` KOSAKI Motohiro
2012-03-07 21:06                 ` David Rientjes
2012-03-08 23:51             ` Andrew Morton
2012-04-26 14:58           ` Christoph Lameter
2012-03-07 11:12     ` [patch] mm, mempolicy: dummy slab_node return value for bugless kernels Glauber Costa
2012-03-07 21:04       ` David Rientjes

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=alpine.DEB.2.00.1203062151530.6424@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-mm@kvack.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