Skip to contentSkip to conversation

SCSI: megaraid, fix suspend/resume sections

PATCH In review Jiri Slaby 6 participants 11 messages May 1, 2008 – May 14, 2008

Subsystems (2)
lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

PATCH 1/1 SCSI: megaraid, fix suspend/resume sections

megaraid_sas suspend and resume are inappropriatelly placed in __devinit section. Remove those placements and make the stuff dependent on CONFIG_PM.

While at it, mark remove function as __devexit.

Cc Neela Syam Kolli <[email protected]>
---
 drivers/scsi/megaraid/megaraid_sas.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
drivers/scsi/megaraid/megaraid_sas.c +8 -3
index b937e9c..a90944c 100644
@@ -2650,12 +2650,13 @@ static void megasas_shutdown_controller(struct megasas_instance *instance,
 	return;
 }
 
+#ifdef CONFIG_PM
 /**
  * megasas_suspend -	driver suspend entry point
  * @pdev:		PCI device structure
  * @state:		PCI power state to suspend routine
  */
-static int __devinit
+static int
 megasas_suspend(struct pci_dev *pdev, pm_message_t state)
 {
 	struct Scsi_Host *host;
@@ -2687,7 +2688,7 @@ megasas_suspend(struct pci_dev *pdev, pm_message_t state)
  * megasas_resume-      driver resume entry point
  * @pdev:               PCI device structure
  */
-static int __devinit
+static int
 megasas_resume(struct pci_dev *pdev)
 {
 	int rval;
@@ -2782,12 +2783,16 @@ fail_ready_state:
 
 	return -ENODEV;
 }
+#else
+#define megasas_suspend	NULL
+#define megasas_resume	NULL
+#endif
 
 /**
  * megasas_detach_one -	PCI hot"un"plug entry point
  * @pdev:		PCI device structure
  */
-static void megasas_detach_one(struct pci_dev *pdev)
+static void __devexit megasas_detach_one(struct pci_dev *pdev)
 {
 	int i;
 	struct Scsi_Host *host;
Signature · 1 line
1.5.4.5
#1 lore raw

ACK.

Thanks.

Bo Yang

-----Original Message-----
From: Jiri Slaby [mailto:[email protected]]
Sent: Thursday, May 01, 2008 11:56 AM
To: DL-MegaRAID Linux
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Jiri Slaby
Subject: [PATCH #repost] SCSI: megaraid, fix suspend/resume sections

megaraid_sas suspend and resume are inappropriatelly placed in __devinit section. Remove those placements and make the stuff dependent on CONFIG_PM.

While at it, mark remove function as __devexit.

Cc Neela Syam Kolli <[email protected]>
---
 drivers/scsi/megaraid/megaraid_sas.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/drivers/scsi/megaraid/megaraid_sas.c
index b937e9c..a90944c 100644

drivers/scsi/megaraid/megaraid_sas.c +0 -0
@@ -2650,12 +2650,13 @@ static void megasas_shutdown_controller(struct

megasas_instance *instance,
return;
}

+#ifdef CONFIG_PM
/**
* megasas_suspend - driver suspend entry point
* @pdev: PCI device structure
* @state: PCI power state to suspend routine
*/
-static int __devinit
+static int
megasas_suspend(struct pci_dev *pdev, pm_message_t state) {
struct Scsi_Host *host;
@@ -2687,7 +2688,7 @@ megasas_suspend(struct pci_dev *pdev, pm_message_t state)
* megasas_resume- driver resume entry point
* @pdev: PCI device structure
*/
-static int __devinit
+static int
megasas_resume(struct pci_dev *pdev)
{
int rval;
@@ -2782,12 +2783,16 @@ fail_ready_state:

return -ENODEV;
}
+#else
+#define megasas_suspend NULL
+#define megasas_resume NULL
+#endif

/**
* megasas_detach_one - PCI hot"un"plug entry point
* @pdev: PCI device structure
*/
-static void megasas_detach_one(struct pci_dev *pdev) +static void __devexit megasas_detach_one(struct pci_dev *pdev)
{
int i;
struct Scsi_Host *host;
--
1.5.4.5

author
#3 lore raw
Quoted 7 lines · Andrew Morton
Quoted 2 lines · On Thu, 1 May 2008 17:56:02 +0200 Jiri Slaby <[email protected]> wrote:

megaraid_sas suspend and resume are inappropriatelly placed in __devinit section.

That's a box-killer, isn't it?

I think so -- the non-CONFIG_HOTPLUG ones.

maintainer
#4 lore raw
Quoted 10 lines · Jiri Slaby
Quoted 7 lines · Andrew Morton
Quoted 2 lines · On Thu, 1 May 2008 17:56:02 +0200 Jiri Slaby <[email protected]> wrote:

megaraid_sas suspend and resume are inappropriatelly placed in __devinit section.

That's a box-killer, isn't it?

I think so -- the non-CONFIG_HOTPLUG ones.

CONFIG_HOTPLUG is only settable to 'n' if you're CONFIG_EMBEDDED which has a zero set intersection with the users of megaraid, so in practical terms, there's no actual box it could kill.

this whole

#if CONFIG_PM
define suspend resume
#else
set suspend resume methods to null
#endif

Is completely analagous to what we used to do with CONFIG_HOTPLUG before we had the __dev.* sectional annotations. Since the expanding bureacracy is determined to keep the _dev.* sections in spite of the pain, could we not at least make the machinery do something vaguely useful and expand it to confine the pm routines to sections which can be discarded if CONFIG_PM is n?

James

#5 lore raw
Quoted 8 lines · On Thu, 01 May 2008 17:05:59 -0500 James Bottomley…
Quoted 7 lines · Jiri Slaby
Quoted 6 lines · Andrew Morton
Quoted 2 lines · On Thu, 1 May 2008 17:56:02 +0200 Jiri Slaby <[email protected]> wrote:

megaraid_sas suspend and resume are inappropriatelly placed in __devinit section.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

That's a box-killer, isn't it?

I think so -- the non-CONFIG_HOTPLUG ones.

CONFIG_HOTPLUG is only settable to 'n' if you're CONFIG_EMBEDDED which has a zero set intersection with the users of megaraid, so in practical terms, there's no actual box it could kill.

who suspends and resumes servers?

Quoted 11 lines

this whole

#if CONFIG_PM
define suspend resume
#else
set suspend resume methods to null
#endif

Is completely analagous to what we used to do with CONFIG_HOTPLUG before we had the __dev.* sectional annotations. Since the expanding bureacracy is determined to keep the _dev.* sections

ooh, that makes us sound really bad! ("since the server-obsessed embedded-hating bloatmonkeys..."?)

Quoted 1 line

in spite of the pain,

What pain? Other people write the dang patches for you! Their main problem is getting them merged.

Quoted 3 lines

could we not at least make the machinery do something vaguely useful and expand it to confine the pm routines to sections which can be discarded if CONFIG_PM is n?

a) it would need to be discarded at link-time, ideally.

b) worth investigating. It might lead to lengthy chains of compilation warnings though.

maintainer
#6 lore raw
Quoted 13 lines · Andrew Morton
Quoted 10 lines · On Thu, 01 May 2008 17:05:59 -0500 James Bottomley…
Quoted 9 lines · Jiri Slaby
Quoted 7 lines · Andrew Morton
Quoted 2 lines · On Thu, 1 May 2008 17:56:02 +0200 Jiri Slaby <[email protected]> wrote:

megaraid_sas suspend and resume are inappropriatelly placed in __devinit section.

That's a box-killer, isn't it?

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I think so -- the non-CONFIG_HOTPLUG ones.

CONFIG_HOTPLUG is only settable to 'n' if you're CONFIG_EMBEDDED which has a zero set intersection with the users of megaraid, so in practical terms, there's no actual box it could kill.

who suspends and resumes servers?

Well, IBM for one ... although you wouldn't have to try hard to convince me that they do it just to annoy me.

Quoted 8 lines
Quoted 8 lines

this whole

#if CONFIG_PM
define suspend resume
#else
set suspend resume methods to null
#endif

Quoted 6 lines
Quoted 3 lines

Is completely analagous to what we used to do with CONFIG_HOTPLUG before we had the __dev.* sectional annotations. Since the expanding bureacracy is determined to keep the _dev.* sections

ooh, that makes us sound really bad! ("since the server-obsessed embedded-hating bloatmonkeys..."?)

Well, since the __dev.* sections according to the embedded folks are worth about a page possibly two, the __dev.* value to them is minimal (particularly as a lot of them have hotplug anyway for their compact flash, USB and the like).

Quoted 4 lines
Quoted 1 line

in spite of the pain,

What pain? Other people write the dang patches for you! Their main problem is getting them merged.

No, the problem is getting them reviewed. Since everyone seems to have section mismatch fatigue they all seem to land on me.

Quoted 5 lines
Quoted 3 lines

could we not at least make the machinery do something vaguely useful and expand it to confine the pm routines to sections which can be discarded if CONFIG_PM is n?

a) it would need to be discarded at link-time, ideally.

Yes, the same way the exit sections are: as linker discards. We also have the mechanics for runtime discards which is useful for modules

Quoted 2 lines

b) worth investigating. It might lead to lengthy chains of compilation warnings though.

Yes ... but if it was worth the effort to unify all the handrolled CONFIG_HOTPLUG stuff, it should be worth it for all the handrolled CONFIG_PM code.

James

author
#7 lore raw

James Bottomley napsal(a):

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines

could we not at least make the machinery do something vaguely useful and expand it to confine the pm routines to sections which can be discarded if CONFIG_PM is n?

a) it would need to be discarded at link-time, ideally.

Yes, the same way the exit sections are: as linker discards. We also have the mechanics for runtime discards which is useful for modules

No it doesn't, exits are discarded at runtime only. At least on x86.

maintainer
#8 lore raw
Quoted 10 lines · Jiri Slaby

James Bottomley napsal(a):

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines

could we not at least make the machinery do something vaguely useful and expand it to confine the pm routines to sections which can be discarded if CONFIG_PM is n?

a) it would need to be discarded at link-time, ideally.

Yes, the same way the exit sections are: as linker discards. We also have the mechanics for runtime discards which is useful for modules

No it doesn't, exits are discarded at runtime only. At least on x86.

No what doesn't? I said we have the mechanics to discard both at link and at run time.

I think you'll find that .exitcall.exit is link time discarded on x86 and the others are runtime discarded.

James

#9 lore raw
In reply to Andrew Morton

On Thu, 2008-05-01 at 15:30 -0700, Andrew Morton wrote:
[cut]

Quoted 5 lines
Quoted 3 lines

CONFIG_HOTPLUG is only settable to 'n' if you're CONFIG_EMBEDDED which has a zero set intersection with the users of megaraid, so in practical terms, there's no actual box it could kill.

who suspends and resumes servers?

I read an article not long ago about a guy running an AMD renderfarm. He was working on power management techniques, including suspending systems that weren't in use. It made a huge difference in power costs, apparently.

I believe suspend is also used in some virtual server farms where physical systems are resumed and virtuals are migrated to satisfy higher CPU demands.

I could also see using it combined with a load balancer or proxy to bring up backup web or database servers.

Compared to using networked/USB power bars or management controllers to bring systems up and down, suspend/resume provides a faster response.

Signature · 1 line
Zan Lynx <[email protected]>
#10 lore raw
In reply to Andrew Morton

Hi!

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

megaraid_sas suspend and resume are inappropriatelly placed in __devinit section.

That's a box-killer, isn't it?

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I think so -- the non-CONFIG_HOTPLUG ones.

CONFIG_HOTPLUG is only settable to 'n' if you're CONFIG_EMBEDDED which has a zero set intersection with the users of megaraid, so in practical terms, there's no actual box it could kill.

who suspends and resumes servers?

It actually has some silly name like 'green IT'.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html