From: Florian Mickler <florian@mickler.org>
To: James Bottomley <James.Bottomley@suse.de>
Cc: Thomas Gleixner <tglx@linutronix.de>,
pm list <linux-pm@lists.linux-foundation.org>,
markgross@thegnar.org, mgross@linux.intel.com,
Frederic Weisbecker <fweisbec@gmail.com>,
Jonathan Corbet <corbet@lwn.net>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] pm_qos: make update_request callable from interrupt context
Date: Wed, 9 Jun 2010 18:48:50 +0200 [thread overview]
Message-ID: <20100609184850.2779b784@schatten.dmk.lab> (raw)
In-Reply-To: <1276097546.4343.219.camel@mulgrave.site>
On Wed, 09 Jun 2010 11:32:26 -0400
James Bottomley <James.Bottomley@suse.de> wrote:
> > > @@ -302,8 +330,12 @@ int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier)
> > > {
> > > int retval;
> > >
> > > + /* someone tried to register a blocking notifier to a
> > > + * qos object that only supports atomic ones */
> > > + BUG_ON(!pm_qos_array[pm_qos_class]->blocking_notifiers);
> > > +
> > > retval = blocking_notifier_chain_register(
> > > - pm_qos_array[pm_qos_class]->notifiers, notifier);
> > > + pm_qos_array[pm_qos_class]->blocking_notifiers, notifier);
> > >
> > > return retval;
> > > }
> >
> > Why not:
> >
> > retval = 1;
> > if(pm_qos_array[pm_qos_class]->blocking_notifiers)
> > retval = blocking_notifier_chain_register(..
> > else
> > WARN();
> > return retval;
> >
> > That way, the offending programmer could eventually fix it, without
> > having to reboot?
>
> Because there are no current users that will trip the BUG_ON ... and we
> want to keep it that way. Code doesn't go into the kernel if it BUGs on
> boot.
>
> The point about failing hard for an abuse of a kernel API isn't to trap
> current abusers because you fix those before you add it. It's to
> prevent future abuse. If your kernel BUGs under test you tend to fix
> the code, so it becomes impossible for anyone to add any users which
> abuse the API in this fashion.
>
> James
>
There are actually people who ignore WARN()ings when submitting code??
....thinking about it... Yes, that may be possible.
Cheers,
Flo
--
Only two things are infinite, the universe and human stupidity, and I'm
not sure about the former. Albert Einstein
next prev parent reply other threads:[~2010-06-09 16:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-09 9:15 [RFC PATCH 1/2] mac80211: make max_network_latency notifier atomic safe florian
2010-06-09 9:15 ` [PATCH 2/2] pm_qos: make update_request callable from interrupt context florian
2010-06-09 9:46 ` Thomas Gleixner
2010-06-09 12:38 ` James Bottomley
2010-06-09 15:27 ` Florian Mickler
2010-06-09 15:32 ` James Bottomley
2010-06-09 16:48 ` Florian Mickler [this message]
2010-06-09 9:38 ` [RFC PATCH 1/2] mac80211: make max_network_latency notifier atomic safe Johannes Berg
2010-06-09 10:20 ` Florian Mickler
2010-06-09 10:42 ` Johannes Berg
2010-06-09 12:16 ` Florian Mickler
2010-06-09 12:27 ` Johannes Berg
2010-06-09 15:37 ` Florian Mickler
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=20100609184850.2779b784@schatten.dmk.lab \
--to=florian@mickler.org \
--cc=James.Bottomley@suse.de \
--cc=corbet@lwn.net \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=markgross@thegnar.org \
--cc=mgross@linux.intel.com \
--cc=tglx@linutronix.de \
/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