From: Greg KH <gregkh@suse.de>
To: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
"Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>,
Sergei Trofimovich <slyich@gmail.com>,
linux-kernel@vger.kernel.org, Kay Sievers <kay.sievers@vrfy.org>,
Linux PM mailing list <linux-pm@vger.kernel.org>,
Tony Luck <tony.luck@intel.com>, Borislav Petkov <bp@amd64.org>,
"tglx@linutronix.de" <tglx@linutronix.de>,
prasad@linux.vnet.ibm.com, Ming Lei <tom.leiming@gmail.com>,
Djalal Harouni <tixxdz@opendz.org>,
Borislav Petkov <borislav.petkov@amd.com>,
Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>,
Andi Kleen <ak@linux.intel.com>,
gouders@et.bocholt.fh-gelsenkirchen.de,
Marcos Souza <marcos.mage@gmail.com>,
justinmattock@gmail.com, Jeff Chua <jeff.chua.linux@gmail.com>
Subject: Re: [PATCH] mce: fix warning messages about static struct mce_device
Date: Wed, 18 Jan 2012 06:42:50 -0800 [thread overview]
Message-ID: <20120118144250.GA16288@suse.de> (raw)
In-Reply-To: <20120118093138.GC5842@elte.hu>
On Wed, Jan 18, 2012 at 10:31:38AM +0100, Ingo Molnar wrote:
>
> * Greg KH <gregkh@suse.de> wrote:
>
> > On Tue, Jan 17, 2012 at 09:38:43AM +0100, Ingo Molnar wrote:
> > >
> > > * Greg KH <gregkh@suse.de> wrote:
> > >
> > > > diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
> > > > index f35ce43..6aefb14 100644
> > > > --- a/arch/x86/include/asm/mce.h
> > > > +++ b/arch/x86/include/asm/mce.h
> > > > @@ -151,7 +151,7 @@ static inline void enable_p5_mce(void) {}
> > > >
> > > > void mce_setup(struct mce *m);
> > > > void mce_log(struct mce *m);
> > > > -DECLARE_PER_CPU(struct device, mce_device);
> > > > +extern struct device *mce_device[CONFIG_NR_CPUS];
> > >
> > > Minor nit, i don't think we have any other such [CONFIG_NR_CPUS]
> > > pattern in the kernel.
> > >
> > > This should be something like:
> > >
> > > DECLARE_PER_CPU(struct device *, mce_device);
> >
> > That is what we used to have, but with just a static struct
> > device. [...]
>
> Which was fine in itself for a per CPU data structure - wouldnt
> the warning be fixed by memset()-ing before registering the
> device or such, if device registry absolutely needs a pre-zeroed
> buffer?
It was already fixed that way, but the problem is that you can not have
statically allocated 'struct device' objects in the system. That's what
my add-on patch fixed, also resolving the syslog messages saying there
was no release function for the device as well.
> I still think there must be some bug/assumption lurking in the
> device layer - do you require all device allocations to be one
> via zalloc()? Seems like a weird and unrobust requirement.
Yes, that's always been the requirement.
> I don't object to the quick fix that gets rid of the warnings,
> but that quick fix came at the price of leaving the real bug
> unfixed and at the price of introducing a new ugliness ;-)
Nope, all of the bugs are now fixed :)
> > [...] We really don't need this to be in the per-cpu area, a
> > flat array should be just fine, why can't we use the
> > CONFIG_NR_CPUS value? Should we use something else?
>
> By that argument we don't really need PER_CPU() areas to begin
> with, a flat [CONFIG_NR_CPUS] array is just fine, right?
I never said that, only for this type of variable.
> Amongst other things we use PER_CPU to have an array of just 2
> elements on a dual core system, even if it boots a
> CONFIG_NR_CPUS=512 distro kernel. That saves RAM, and with
> higher CONFIG_NR_CPUS values it adds up quickly.
>
> > > Or the pointer should be attached to the CPU info structure.
> >
> > Ok, I have no objection to that, do you want me to make a
> > patch doing that, now that this is already in Linus's tree?
>
> Would be nice if you could do that or some other equivalent
> solution, i'd really not like to see the [CONFIG_NR_CPUS]
> pattern to spread in the kernel, we spent a lot of time getting
> rid of such uses ;-)
Ok, I'll work on resolving this.
thanks,
greg k-h
next prev parent reply other threads:[~2012-01-18 14:52 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-16 22:40 [PATCH] mce: fix warning messages about static struct mce_device Greg KH
2012-01-17 0:14 ` Djalal Harouni
2012-01-17 0:15 ` Greg KH
2012-01-17 0:21 ` Linus Torvalds
2012-01-17 1:00 ` Greg KH
2012-01-17 8:38 ` Ingo Molnar
2012-01-17 15:51 ` Greg KH
2012-01-17 16:28 ` Greg KH
2012-01-18 9:31 ` Ingo Molnar
2012-01-18 14:42 ` Greg KH [this message]
2012-01-18 15:51 ` Alan Stern
2012-01-18 17:28 ` Luck, Tony
2012-01-18 17:54 ` Srivatsa S. Bhat
2012-01-18 18:10 ` Alan Stern
2012-01-18 18:50 ` Kay Sievers
2012-01-18 19:00 ` Luck, Tony
2012-01-18 19:31 ` Srivatsa S. Bhat
2012-01-19 12:32 ` Ingo Molnar
2012-01-19 13:29 ` Srivatsa S. Bhat
2012-01-19 15:13 ` Alan Stern
2012-01-19 19:38 ` Ingo Molnar
2012-01-19 20:52 ` Alan Stern
2012-01-19 12:28 ` Ingo Molnar
2012-01-26 23:49 ` MCE: convert static array of pointers to per-cpu variables Greg KH
2012-01-27 13:14 ` Srivatsa S. Bhat
2012-01-17 12:36 ` [PATCH] mce: fix warning messages about static struct mce_device Srivatsa S. Bhat
2012-01-17 15:52 ` Greg KH
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=20120118144250.GA16288@suse.de \
--to=gregkh@suse.de \
--cc=ak@linux.intel.com \
--cc=borislav.petkov@amd.com \
--cc=bp@amd64.org \
--cc=gouders@et.bocholt.fh-gelsenkirchen.de \
--cc=jeff.chua.linux@gmail.com \
--cc=justinmattock@gmail.com \
--cc=kay.sievers@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=marcos.mage@gmail.com \
--cc=mingo@elte.hu \
--cc=prasad@linux.vnet.ibm.com \
--cc=rjw@sisk.pl \
--cc=seto.hidetoshi@jp.fujitsu.com \
--cc=slyich@gmail.com \
--cc=srivatsa.bhat@linux.vnet.ibm.com \
--cc=tglx@linutronix.de \
--cc=tixxdz@opendz.org \
--cc=tom.leiming@gmail.com \
--cc=tony.luck@intel.com \
--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;
as well as URLs for NNTP newsgroup(s).