From: Andrew Morton <akpm@osdl.org>
To: sekharan@us.ibm.com
Cc: herbert@13thfloor.at, torvalds@osdl.org,
linux-kernel@vger.kernel.org, linux-xfs@oss.sgi.com,
xfs-masters@oss.sgi.com, stern@rowland.harvard.edu,
Ashok Raj <ashok.raj@intel.com>
Subject: Re: Linux 2.6.17-rc2 - notifier chain problem?
Date: Mon, 24 Apr 2006 16:28:17 -0700 [thread overview]
Message-ID: <20060424162817.764fa244.akpm@osdl.org> (raw)
In-Reply-To: <1145919717.1400.67.camel@linuxchandra>
Chandra Seetharaman <sekharan@us.ibm.com> wrote:
>
> On Mon, 2006-04-24 at 15:03 -0700, Andrew Morton wrote:
> > Chandra Seetharaman <sekharan@us.ibm.com> wrote:
> > >
> > > Thanks for the steps. With that i was able to reproduce the problem and
> > > i found the bug.
> > >
> > > While i go ahead and generate the patch, i wanted to hear if my
> > > conclusion is correct.
> > >
> > > The problem is due to the fact that most notifier registrations
> > > incorrectly use __devinitdata to define the callback structure, as in:
> > >
> > > static struct notifier_block __devinitdata hrtimers_nb = {
> > > .notifier_call = hrtimer_cpu_notify,
> > > };
> > >
> > > devinitdata'd data is not _expected to be available_ after the
> > > initialization(unless CONFIG_HOTPLUG is defined).
> > >
> > > I do not know how it was working until now :), anybody has a theory that
> > > can explain it (or my conclusion is wrong) ?
> >
> > That sounds right. There are several __devinitdata notifier_blocks in the
> > tree - please be sure to check them all.
>
> Yes, I am covering all notifier blocks.
>
> Another issue... many of the notifier callback functions are marked as
> init calls (__cpuinit, __devinit etc.,) as in:
>
> static int __cpuinit pageset_cpuup_callback(struct notifier_block *nfb,
> unsigned long action,
> void *hcpu)
hm. This needs some care and thought. We _should_ be oopsing all over the
place because of this. So why aren't we?
iirc, the cpu notifier chain is never used after bootup if
!CONFIG_HOTPLUG_CPU, so there's a good chance that we have things on that
list which have been unloaded, but which never get accessed.
It could be similar with the __devinit things - they're on the list,
they're unloaded, but nothing ever happens in a !CONFIG_HOTPLUG kernel to
cause them to be dereferenced.
Really, these notifier chains just shouldn't exist at all if they're not
going to be used. We're a bit sloppy here. Ashok and I spent some time
working on making lots of code and data structures go away if
!CONFIG_HOTPLUG_CPU, but it's a bit tricky due to the way we do SMP
bringup.
I guess for now, bringing those things into .text and .data when there's
doubt is a reasonable thing to do.
> I am generating a separate patch to take care of those too.
> >
> > btw, it'd be pretty trivial to add runtime checking for this sort of thing:
> >
> > int addr_in_init_section(void *addr)
> > {
> > return addr >= __init_begin && addr < __init_end;
> > }
>
> I will add this to kernel/sys.c, and put a BUG_ON to check for both the
> notifier block and the callback function.
It's x86-only I think. If all architectures use the same symbols then I
guess we could do an arch-neutral version, but one should check.
If it won't work on all architectures then kernel/sys.c isn't the right
place for it.
Maybe it's not so useful. If we're actually accessing these things then
someone should report oopses. So this debugging infrastructure will only
detect things which a) are in __init, b) shouldn't be in __init and c) are
never actually accessed.
So I'd be inclined to not bother about this for now.
next prev parent reply other threads:[~2006-04-24 23:25 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-19 3:27 Linux 2.6.17-rc2 Linus Torvalds
2006-04-19 7:30 ` [patch, 2.6.17-rc2] dm: fix typo Ingo Molnar
2006-04-19 7:33 ` Ingo Molnar
2006-04-19 18:00 ` Linux 2.6.17-rc2 Diego Calleja
2006-04-19 18:04 ` Hua Zhong
2006-04-19 19:40 ` splice and tee [was Linux 2.6.17-rc2] Jonathan Corbet
2006-04-19 18:44 ` Linux 2.6.17-rc2 Linus Torvalds
2006-04-19 19:20 ` Grzegorz Kulewski
2006-04-19 20:09 ` Linus Torvalds
2006-04-19 21:23 ` Trond Myklebust
2006-04-19 21:49 ` Linus Torvalds
2006-04-19 22:19 ` Peter Naulls
2006-04-20 13:21 ` Diego Calleja
2006-04-20 14:50 ` Jens Axboe
2006-04-20 15:32 ` Linus Torvalds
2006-04-20 19:19 ` Jens Axboe
2006-04-20 18:40 ` Linh Dang
2006-04-20 19:49 ` Jens Axboe
2006-04-20 19:57 ` Linh Dang
2006-04-20 20:02 ` Nick Piggin
2006-04-21 7:53 ` Jens Axboe
2006-04-20 20:08 ` Jens Axboe
2006-04-20 19:26 ` David S. Miller
2006-04-20 19:34 ` Jens Axboe
2006-04-20 19:39 ` David S. Miller
2006-04-20 19:44 ` Jens Axboe
2006-04-20 19:54 ` Nick Piggin
2006-04-20 21:37 ` Piet Delaney
2006-04-20 22:20 ` Linus Torvalds
2006-04-20 23:39 ` Piet Delaney
2006-04-21 0:09 ` Linus Torvalds
2006-04-20 23:26 ` David Lang
2006-04-21 0:49 ` David S. Miller
2006-04-22 4:52 ` Troy Benjegerdes
2006-04-21 0:41 ` David S. Miller
2006-04-21 17:58 ` Linus Torvalds
2006-04-21 18:15 ` Steven Rostedt
2006-04-21 18:42 ` Steven Rostedt
2006-04-21 0:20 ` David S. Miller
2006-04-21 2:05 ` Andi Kleen
2006-04-21 6:47 ` Piet Delaney
2006-04-20 16:24 ` Ingo Oeser
2006-04-20 19:52 ` splice(), vmsplice() niftiness [was: Re: Linux 2.6.17-rc2] bjd
2006-04-21 10:21 ` Linux 2.6.17-rc2 Alistair John Strachan
2006-04-21 16:40 ` Linus Torvalds
2006-04-21 17:21 ` Stephen Rothwell
2006-04-21 22:02 ` Andi Kleen
2006-04-22 0:53 ` Alistair John Strachan
2006-04-22 1:07 ` Andi Kleen
2006-04-22 13:21 ` Alistair John Strachan
2006-04-21 11:01 ` Linux 2.6.17-rc2 - notifier chain problem? Herbert Poetzl
2006-04-21 21:31 ` Chandra Seetharaman
2006-04-22 0:58 ` Herbert Poetzl
2006-04-24 21:26 ` Chandra Seetharaman
2006-04-24 22:03 ` Andrew Morton
2006-04-24 23:01 ` Chandra Seetharaman
2006-04-24 23:28 ` Andrew Morton [this message]
2006-04-25 0:19 ` Chandra Seetharaman
2006-04-26 15:49 ` Alan Stern
2006-04-26 18:18 ` Chandra Seetharaman
2006-04-26 18:43 ` Andrew Morton
2006-04-26 19:29 ` Ashok Raj
2006-04-26 20:21 ` Chandra Seetharaman
2006-04-26 20:26 ` Ashok Raj
2006-04-28 23:12 ` Chandra Seetharaman
2006-04-28 23:23 ` Andrew Morton
2006-04-28 23:33 ` Linus Torvalds
2006-04-28 23:48 ` Chandra Seetharaman
2006-04-28 23:43 ` Chandra Seetharaman
2006-04-29 15:30 ` Alan Stern
2006-04-22 6:40 ` Keith Owens
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=20060424162817.764fa244.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=ashok.raj@intel.com \
--cc=herbert@13thfloor.at \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@oss.sgi.com \
--cc=sekharan@us.ibm.com \
--cc=stern@rowland.harvard.edu \
--cc=torvalds@osdl.org \
--cc=xfs-masters@oss.sgi.com \
/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
Powered by JetHome