LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Yi Yang <yi.y.yang@intel.com>
Cc: tglx@linutronix.de, hpa@zytor.com, mingo@redhat.com,
	linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: [PATCH 2.6.24] x86: add sysfs interface for cpuid module
Date: Wed, 30 Jan 2008 08:48:52 +0100	[thread overview]
Message-ID: <20080130074852.GA19534@uranus.ravnborg.org> (raw)
In-Reply-To: <1201645363.12722.38.camel@yangyi-dev.bj.intel.com>

On Wed, Jan 30, 2008 at 06:22:43AM +0800, Yi Yang wrote:
> On Tue, 2008-01-29 at 09:44 +0100, Sam Ravnborg wrote:
> > > +
> > > +static struct notifier_block __cpuinitdata cpuid_sysfs_cpu_notifier = {
> > > +	.notifier_call = cpuid_sysfs_cpu_callback,
> > > +};
> > Data is annotated _cpuintidata
> > 
> > but
> > 
> > > +
> > Data is annotated _cpuintidata
> > 
> > > @@ -217,11 +445,14 @@ static void __exit cpuid_exit(void)
> > >  {
> > >  	int cpu = 0;
> > >  
> > > -	for_each_online_cpu(cpu)
> > > +	for_each_online_cpu(cpu) {
> > >  		cpuid_device_destroy(cpu);
> > > +		remove_cpuid_sysfs(cpu);
> > > +	}
> > >  	class_destroy(cpuid_class);
> > >  	unregister_chrdev(CPUID_MAJOR, "cpu/cpuid");
> > >  	unregister_hotcpu_notifier(&cpuid_class_cpu_notifier);
> > > +	unregister_hotcpu_notifier(&cpuid_sysfs_cpu_notifier);
> > 
> > used in an __exit function.
> > 
> > You should have seen a Section mismatch warning for this.
> > The right fix is to annotate the cpuid_sysfs_cpu_notifier
> > with __initdata_refok (soon to be named __refdata)
> > Or even better to declare it const and use _refconst.
> I think __cpuinitdata is different from __initdata, i have tested it
> by insmod, rmmod, echo 0/1 > /sys/devices/system/cpu/cpu1/online
> repeatly, it hasn't any issue.

__cpuinit & _cpuinitdata have over time been used for 
different purposes:
a) To annotate code/data used in the init path and that in the
non HOTPLUG_CPU case can be discarded after init.
b) To annotate code/data used in the 'core' HOTPLUG_CPU
functionality that isonly in use if HOTPLUG_CPU='y'


The b) usage is questionable and the annotation
of cpuid_sysfs_cpu_notifier beongs in the b) category.

The correct solution would be to factor out the 'core'
HOTPLUG_CPU=y code to a set of separate files and used to
usual mechanishm in the Makefile to select when to include
this code in the kernel.

The improved section mismatch checks by modpost has just
brought this issue to the attention and now you add code
that does the wrong thing it is being discussed.

	Sam

  reply	other threads:[~2008-01-30  7:49 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-04 10:10 [linux-pm][PATCH] base: Change power/wakeup output from "" to "unsupported" if wakeup feature isn't supported by a device Yi Yang
2008-01-04 11:48 ` Pavel Machek
2008-01-04 16:09   ` David Brownell
2008-01-04 16:38     ` Alan Stern
2008-01-04 16:52       ` Olivier Galibert
2008-01-04 17:20         ` Oliver Neukum
2008-01-07  2:00           ` Yi Yang
2008-01-07  1:55         ` Yi Yang
2008-01-07  3:49           ` David Brownell
2008-01-07  1:52       ` Yi Yang
2008-01-07  1:37     ` Yi Yang
2008-01-07  1:57       ` Rafael J. Wysocki
2008-01-07  2:05         ` Yi Yang
2008-01-07 16:46           ` Rafael J. Wysocki
2008-01-07  1:21   ` Yi Yang
2008-01-04 16:31 ` David Brownell
2008-01-07  1:51   ` Yi Yang
2008-01-22 23:05 ` [PATCH 2.6.24-rc8] cpufreq: fix obvious condition statement error Yi Yang
2008-01-28 23:14   ` [PATCH 2.6.24] x86: add sysfs interface for cpuid module Yi Yang
2008-01-29  8:44     ` Sam Ravnborg
2008-01-29 22:22       ` Yi Yang
2008-01-30  7:48         ` Sam Ravnborg [this message]
2008-01-29 15:51     ` H. Peter Anvin
2008-01-29 17:52       ` Yi Yang
2008-01-30  6:09         ` H. Peter Anvin
2008-01-29 21:56       ` Yi Yang
2008-01-30  7:17         ` H. Peter Anvin
2008-01-29 22:13           ` Yi Yang
2008-01-30  7:33             ` H. Peter Anvin
2008-01-29 23:41     ` [RFC PATCH 2.6.24] x86: add sysfs interface for cpuid module, try 2 Yi Yang
2008-01-30 17:35       ` H. Peter Anvin
2008-01-31  1:18       ` [PATCH 2.6.24] Add new string functions real_strtoul and change kernel params to use them Yi Yang
2008-01-31 17:03         ` Randy Dunlap
2008-01-31 16:30           ` Yi Yang
2008-02-01  2:47             ` Randy Dunlap
2008-01-31 22:11         ` [PATCH 2.6.24] Add new string functions strict_strto* and convert kernel params to use them, take 2 Yi Yang
2008-02-01  0:02           ` [PATCH 2.6.24] Add new string functions strict_strto* and convert kernel params to use them, take 3 Yi Yang
2008-02-01  7:36           ` [PATCH 2.6.24] Add new string functions strict_strto* and convert kernel params to use them, take 2 Andrew Morton
2008-02-01  7:39           ` Andrew Morton
2008-02-01  7:40           ` Andrew Morton
2008-02-01 16:31     ` [PATCH 2.6.24] x86: add sysfs interface for cpuid module dean gaudet
2008-02-01 17:56       ` H. Peter Anvin
2008-02-01 17:58         ` H. Peter Anvin
2008-02-14 23:44   ` [PATCH 2.6.25-rc1] cpufreq: fix cpufreq policy refcount imbalance Yi Yang
2008-02-14 23:48   ` Yi Yang
2008-02-15 15:52     ` [linux-pm] " Alan Stern
2008-02-15 18:24       ` Greg KH
2008-02-15 21:01     ` Greg KH
2008-02-25  0:46     ` [PATCH 2.6.25-rc3] cpuidle: fix cpuidle time and usage overflow Yi Yang
2008-02-25 10:15       ` Ingo Molnar
2008-02-25  1:10         ` Yi Yang
2008-03-26  4:46       ` Len Brown

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=20080130074852.GA19534@uranus.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=yi.y.yang@intel.com \
    --subject='Re: [PATCH 2.6.24] x86: add sysfs interface for cpuid module' \
    /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

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).