diff mbox

[3/5,v4] Export memory_sysdev_class

Message ID 4ADF1E42.3020907@austin.ibm.com (mailing list archive)
State Superseded
Delegated to: Benjamin Herrenschmidt
Headers show

Commit Message

Nathan Fontenot Oct. 21, 2009, 2:44 p.m. UTC
Export the memory_sysdev_class structure.  This is needed so we can create
a 'release' file in sysfs in addition to the existing 'probe' file in
order to support DLPAR removal of memory on the powerpc/pseries platform.
The new 'release' file will be powerpc/pseries only.

Signed-off-by: Nathan Fontenot <nfont at austin.ibm.com>
---

Comments

Dave Hansen Oct. 21, 2009, 4:03 p.m. UTC | #1
On Wed, 2009-10-21 at 09:44 -0500, Nathan Fontenot wrote:
> Export the memory_sysdev_class structure.  This is needed so we can create
> a 'release' file in sysfs in addition to the existing 'probe' file in
> order to support DLPAR removal of memory on the powerpc/pseries platform.
> The new 'release' file will be powerpc/pseries only.

Please do it in generic code.  You may only need it on ppc today, but
somebody else is going to want the same thing tomorrow on another arch.

It's also nice to keep all of the stuff doing the actual sysfs munging
in one place.  I know it'll cost a few stubs for calling in and out of
arch code, but it should save some work down the road for somebody else.

-- Dave
Nathan Fontenot Oct. 22, 2009, 3:31 p.m. UTC | #2
Dave Hansen wrote:
> On Wed, 2009-10-21 at 09:44 -0500, Nathan Fontenot wrote:
>> Export the memory_sysdev_class structure.  This is needed so we can create
>> a 'release' file in sysfs in addition to the existing 'probe' file in
>> order to support DLPAR removal of memory on the powerpc/pseries platform.
>> The new 'release' file will be powerpc/pseries only.
> 
> Please do it in generic code.  You may only need it on ppc today, but
> somebody else is going to want the same thing tomorrow on another arch.

I thought about this but wasn't sure if having the probe/release sysfs files
for memory and cpu be in generic code would be accepted.

Would it be acceptable to put the new release file for memory under the
ARCH_MEMORY_PROBE config option?  This would reduce the number of arch'es
that would require stubs as it appears only powerpc and x86 define this.

I could do the same thing for the cpu probe/release files and a new
ARCH_CPU_PROBE config option which would eliminate the required stubs
in arch'es other than powerpc right now.

-Nathan Fontenot
  
> 
> It's also nice to keep all of the stuff doing the actual sysfs munging
> in one place.  I know it'll cost a few stubs for calling in and out of
> arch code, but it should save some work down the road for somebody else.
> 
> -- Dave
>
Dave Hansen Oct. 22, 2009, 3:56 p.m. UTC | #3
On Thu, 2009-10-22 at 10:31 -0500, Nathan Fontenot wrote:
> Dave Hansen wrote:
> > On Wed, 2009-10-21 at 09:44 -0500, Nathan Fontenot wrote:
> >> Export the memory_sysdev_class structure.  This is needed so we can create
> >> a 'release' file in sysfs in addition to the existing 'probe' file in
> >> order to support DLPAR removal of memory on the powerpc/pseries platform.
> >> The new 'release' file will be powerpc/pseries only.
> > 
> > Please do it in generic code.  You may only need it on ppc today, but
> > somebody else is going to want the same thing tomorrow on another arch.
> 
> I thought about this but wasn't sure if having the probe/release sysfs files
> for memory and cpu be in generic code would be accepted.

Although we don't want to pollute the generic code with lots of per-arch
cruft, this still looks pretty generic to me.  It is also really nice to
have all of the sysfs files for one directory be in a single place in
the source.

> Would it be acceptable to put the new release file for memory under the
> ARCH_MEMORY_PROBE config option?

That sounds fine to me.  It may need a slightly tuned name if you can
think of anything better.  I can't off the top of my head.

x86's is really only there for testing reasons.   I would use mem= to
shrink a machine's memory at boot then use the probe file to re-add it
later.  I did that before I had hardware that could do real hotplug.

> This would reduce the number of arch'es
> that would require stubs as it appears only powerpc and x86 define this.

Yeah, that'd be a nice side-effect I guess.

-- Dave
diff mbox

Patch

Index: powerpc/drivers/base/memory.c
===================================================================
--- powerpc.orig/drivers/base/memory.c	2009-10-19 11:56:51.000000000 -0500
+++ powerpc/drivers/base/memory.c	2009-10-19 11:59:36.000000000 -0500
@@ -28,9 +28,10 @@ 
 
 #define MEMORY_CLASS_NAME	"memory"
 
-static struct sysdev_class memory_sysdev_class = {
+struct sysdev_class memory_sysdev_class = {
 	.name = MEMORY_CLASS_NAME,
 };
+EXPORT_SYMBOL(memory_sysdev_class);
 
 static const char *memory_uevent_name(struct kset *kset, struct kobject *kobj)
 {
Index: powerpc/include/linux/memory_hotplug.h
===================================================================
--- powerpc.orig/include/linux/memory_hotplug.h	2009-10-19 11:58:43.000000000 -0500
+++ powerpc/include/linux/memory_hotplug.h	2009-10-19 11:59:36.000000000 -0500
@@ -12,6 +12,8 @@ 
 
 #ifdef CONFIG_MEMORY_HOTPLUG
 
+extern struct sysdev_class memory_sysdev_class;
+
 /*
  * Types for free bootmem.
  * The normal smallest mapcount is -1. Here is smaller value than it.