Skip to contentSkip to conversation

Average power consumption in S3?

DISCUSSION Moritz Muehlenhoff 7 participants 13 messages Mar 9, 2005 – Mar 12, 2005

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi,
I'm using an IBM Thinkpad X31. With stock 2.6.11 and the additional radeontool to power-off the backlight in suspend, S3 works very well and reliable. During S3 I've measured a power consumption of 1400 to 1500 mWh (using 512 megabytes of RAM). Is there still room for optimization? What's the typical amount of energy required for suspend- to-ram? From friends using iBooks with MacOS X I've heard that they left the notebook in suspend when leaving for a week and could still use it after return.

Cheers,
Moritz

#1 lore raw
Quoted 8 lines · Moritz Muehlenhoff

I'm using an IBM Thinkpad X31. With stock 2.6.11 and the additional radeontool to power-off the backlight in suspend, S3 works very well and reliable. During S3 I've measured a power consumption of 1400 to 1500 mWh (using 512 megabytes of RAM). Is there still room for optimization? What's the typical amount of energy required for suspend- to-ram? From friends using iBooks with MacOS X I've heard that they left the notebook in suspend when leaving for a week and could still use it after return.

Radeons don't actually power down in D3 unless some registers are set, and even then the kernel doesn't currently have any code that would put the Radeon in D3. If you're willing to test something, could you try the code at

http://www.srcf.ucam.org/~mjg59/radeon/

and do

radeontool power off

immediately before putting the machine into suspend? Make sure that you do this from something other than X.

Signature · 1 line
Matthew Garrett | [email protected]
#2 lore raw
Quoted 9 lines · Matthew Garrett

Radeons don't actually power down in D3 unless some registers are set, and even then the kernel doesn't currently have any code that would put the Radeon in D3. If you're willing to test something, could you try the code at

http://www.srcf.ucam.org/~mjg59/radeon/

immediately before putting the machine into suspend? Make sure that you do this from something other than X.

This reduces power consumption from ca. 1500 to ca. 1200 mWh, so it's already a huge improvement, but with 1.5 days of maximal suspend still pretty far away from a week.

Cheers,
Moritz

#3 lore raw
In reply to Matthew Garrett
Quoted 15 lines · Matthew Garrett
Quoted 8 lines · Moritz Muehlenhoff

I'm using an IBM Thinkpad X31. With stock 2.6.11 and the additional radeontool to power-off the backlight in suspend, S3 works very well and reliable. During S3 I've measured a power consumption of 1400 to 1500 mWh (using 512 megabytes of RAM). Is there still room for optimization? What's the typical amount of energy required for suspend- to-ram? From friends using iBooks with MacOS X I've heard that they left the notebook in suspend when leaving for a week and could still use it after return.

Radeons don't actually power down in D3 unless some registers are set, and even then the kernel doesn't currently have any code that would put the Radeon in D3. If you're willing to test something, could you try the code at

Quoted 8 lines

http://www.srcf.ucam.org/~mjg59/radeon/

and do

radeontool power off

immediately before putting the machine into suspend? Make sure that you do this from something other than X.

Small question, can this tool do what the boot-radeon tool can? That way I can scrap another one in my suspend-to-ram tricks ;p

Jan

Signature · 1 line
  I tripped over a hole that was sticking up out of the ground.
#4 lore raw
In reply to Moritz Muehlenhoff
Quoted 9 lines · Moritz Muehlenhoff

Hi,
I'm using an IBM Thinkpad X31. With stock 2.6.11 and the additional radeontool to power-off the backlight in suspend, S3 works very well and reliable. During S3 I've measured a power consumption of 1400 to 1500 mWh (using 512 megabytes of RAM). Is there still room for optimization? What's the typical amount of energy required for suspend- to-ram? From friends using iBooks with MacOS X I've heard that they left the notebook in suspend when leaving for a week and could still use it after return.

I also have an X31 and I noticed that the e1000 has Wake-On-Lan enabled by default and the S3 code doesn't disable that (kind of defeats the purpose :)
Disabling that will make the e1000 driver power down the chip during S3.

ethtool -s ethX wol d

I don't know if you have the e1000 or e100 in your machine, but I think the e100 driver does the same.

I've had mine suspended for 2-3 days at most, actually havn't left it alone for longer than that in S3 so I'm not really sure how much power it consumes, but I'd say it's 1-2 percent of the total capacity per hour, so somewhere below 1000mW.

I also use the standard radeontool to disable the backlight, I'll test the version Matthew pointed out some day.

Signature · 1 line
/Martin
#5 lore raw
Quoted 9 lines · Martin Josefsson

I also have an X31 and I noticed that the e1000 has Wake-On-Lan enabled by default and the S3 code doesn't disable that (kind of defeats the purpose :)
Disabling that will make the e1000 driver power down the chip during S3.

I've had mine suspended for 2-3 days at most, actually havn't left it alone for longer than that in S3 so I'm not really sure how much power it consumes, but I'd say it's 1-2 percent of the total capacity per hour, so somewhere below 1000mW.

I've got the e100 and with WOL disabled and Matthew's hacked radeontool power consumption decreases to 970 mWh.

Cheers,
Moritz

#6 lore raw
Quoted 2 lines · Moritz Muehlenhoff

I've got the e100 and with WOL disabled and Matthew's hacked radeontool power consumption decreases to 970 mWh.

I have a T40p, and with the following patches (versus 2.6.11) and the following sleep script, I have power consuption down to 580 mWh.

The 05-radeonfb-Thinkpad-Power.patch will have to patched with your specific Thinkpad model number, or booted with the force_sleep option. See the Linux thinkpad mailing list ([email protected]) archives for more information.

Warning: The 05-radeonfb-Thinkpad-Power.patch is not quite ready for merging, but compared to completely pathetic battery life when using ACPI's suspend-to-memory without them, it's definitely worth it.

- Ted

From: Christian Borntraeger <[email protected]>

During the wakeup from suspend-to-ram I get several warnings.

---

 25-akpm/drivers/acpi/osl.c      |    4 ++--
 25-akpm/drivers/acpi/pci_link.c |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/acpi/osl.c renamed from drivers/acpi/osl.c~acpi-sleep-while-atomic-during-s3-resume-from-ram +2 -2
diff -puN drivers/acpi/osl.c~acpi-sleep-while-atomic-during-s3-resume-from-ram drivers/acpi/osl.c
@@ -145,7 +145,7 @@ acpi_os_vprintf(const char *fmt, va_list
 void *
 acpi_os_allocate(acpi_size size)
 {
-	return kmalloc(size, GFP_KERNEL);
+	return kmalloc(size, GFP_ATOMIC);
 }
 
 void
@@ -905,7 +905,7 @@ acpi_os_wait_semaphore(
 
 	ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", handle, units, timeout));
 
-	if (in_atomic())
+	if (in_atomic() || irqs_disabled())
 		timeout = 0;
 
 	switch (timeout)
drivers/acpi/pci_link.c renamed from drivers/acpi/pci_link.c~acpi-sleep-while-atomic-during-s3-resume-from-ram +1 -1
diff -puN drivers/acpi/pci_link.c~acpi-sleep-while-atomic-during-s3-resume-from-ram drivers/acpi/pci_link.c
@@ -315,7 +315,7 @@ acpi_pci_link_set (
 	if (!link || !irq)
 		return_VALUE(-EINVAL);
 
-	resource = kmalloc( sizeof(*resource)+1, GFP_KERNEL);
+	resource = kmalloc( sizeof(*resource)+1, GFP_ATOMIC);
 	if(!resource)
 		return_VALUE(-ENOMEM);
 

_

This is needed to remove another sleeping function called from invalid context error message when resuming from sleep.

drivers/acpi/utils.c +1 -1
Index: src/drivers/acpi/utils.c
===================================================================
@@ -252,7 +252,7 @@
 	if (!data)
 		return_ACPI_STATUS(AE_BAD_PARAMETER);
 
-	element = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
+	element = kmalloc(sizeof(union acpi_object), GFP_ATOMIC);
 	if(!element)
 		return_ACPI_STATUS(AE_NO_MEMORY);
 

===== drivers/video/aty/radeon_base.c 1.40 vs edited =====

drivers/video/aty/radeon_base.c +9 -0
@@ -273,6 +273,9 @@
 #ifdef CONFIG_MTRR
 static int nomtrr = 0;
 #endif
+#if defined(CONFIG_PM) && defined(CONFIG_X86)
+int radeon_force_sleep = 0;
+#endif
 
 /*
  * prototypes
@@ -2535,6 +2538,10 @@
 			force_measure_pll = 1;
 		} else if (!strncmp(this_opt, "ignore_edid", 11)) {
 			ignore_edid = 1;
+#if defined(CONFIG_PM) && defined(CONFIG_X86)
+		} else if (!strncmp(this_opt, "force_sleep", 11)) {
+			radeon_force_sleep = 1;
+#endif
 		} else
 			mode_option = this_opt;
 	}
@@ -2574,3 +2581,5 @@
 MODULE_PARM_DESC(panel_yres, "int: set panel yres");
 module_param(mode_option, charp, 0);
 MODULE_PARM_DESC(mode_option, "Specify resolution as \"<xres>x<yres>[-<bpp>][@<refresh>]\" ");
+module_param(radeon_force_sleep, int, 0);
+MODULE_PARM_DESC(radeon_force_sleep, "bool: force ACPI sleep mode on untested machines");

===== drivers/video/aty/radeon_pm.c 1.10 vs edited =====

drivers/video/aty/radeon_pm.c +120 -0

146 lines not on this page · raw message

#!/bin/bash

echo "--------" >> /tmp/suspend.log
echo "Suspending to memory..." >> /tmp/suspend.log date >> /tmp/suspend.log
cat /proc/acpi/battery/BAT0/state >> /tmp/suspend.log

echo "7 blink" >/proc/acpi/ibm/led
echo "4 off" >/proc/acpi/ibm/led

/sbin/hotplug stop

/sbin/hwclock --systohc

statedir=/root/s3/state
curcons=fgconsole
fuser /dev/tty$curcons 2>/dev/null|xargs ps -o comm= -p|grep -q X && chvt 2 cat /dev/vcsa >$statedir/vcsa
ethtool -s ethX wol d
sync
echo 3 >/proc/acpi/sleep

echo "Resuming... " >> /tmp/suspend.log
date >> /tmp/suspend.log
cat /proc/acpi/battery/BAT0/state >> /tmp/suspend.log

sync

/sbin/hwclock --hctosys

/sbin/hotplug start

echo "4 on" >/proc/acpi/ibm/led
echo "7 off" >/proc/acpi/ibm/led

vbetool post
vbetool vbestate restore <$statedir/vbe
cat $statedir/vcsa >/dev/vcsa
#rckbd restart
chvt $[curcons%6+1]
chvt $curcons

echo "Resume finished... " >> /tmp/suspend.log date >> /tmp/suspend.log
cat /proc/acpi/battery/BAT0/state >> /tmp/suspend.log

#7 lore raw
Quoted 7 lines · Theodore Ts'o
Quoted 2 lines · Moritz Muehlenhoff

I've got the e100 and with WOL disabled and Matthew's hacked radeontool power consumption decreases to 970 mWh.

I have a T40p, and with the following patches (versus 2.6.11) and the following sleep script, I have power consuption down to 580 mWh.

Quoted 8 lines

The 05-radeonfb-Thinkpad-Power.patch will have to patched with your specific Thinkpad model number, or booted with the force_sleep option. See the Linux thinkpad mailing list ([email protected]) archives for more information.

Warning: The 05-radeonfb-Thinkpad-Power.patch is not quite ready for merging, but compared to completely pathetic battery life when using ACPI's suspend-to-memory without them, it's definitely worth it.

Hi Ted !

Hopefully, somebody is gathering those patches. I intend to merge them all at one point, though I can't promise it will happen before 2.6.12.

It would be good to "ping" me regulary though ;)

I've sort-of been waiting for ATI to tell me how to retreive the proper memory register setting from the BIOS, since the code in there currently is quite powerbook specific, and might not write the exact correct value on all models. I suppose it works fine on yours so far, but I'd rather have a way to know the right value ... unfortunately, they didn't reply on this request.

Ben.

#8 lore raw
Quoted 6 lines · Benjamin Herrenschmidt

I've sort-of been waiting for ATI to tell me how to retreive the proper memory register setting from the BIOS, since the code in there currently is quite powerbook specific, and might not write the exact correct value on all models. I suppose it works fine on yours so far, but I'd rather have a way to know the right value ... unfortunately, they didn't reply on this request.

There have been probably about 40 or 50 positive reports from people on a wide variety of Thinkpad laptops (most generally recent models) where it has worked. There were two that didn't, but it wasn't clear at least to me whether they were true incompatibilities or unrelated problems caused by old BIOS levels, et. al.

What I would suggest doing is changing the code to use a blacklist instead of a whitelist, and make it optional with a CONFIG option that is marked experimental, and then get it into the mainline for additional testing. If we can get ATI to give us the right way to do it, great, but if they aren't being responsive, maybe we should just do it empirically.

- Ted

#9 lore raw
Quoted 7 lines

What I would suggest doing is changing the code to use a blacklist instead of a whitelist, and make it optional with a CONFIG option that is marked experimental, and then get it into the mainline for additional testing. If we can get ATI to give us the right way to do it, great, but if they aren't being responsive, maybe we should just do it empirically.

I'm hesitant to switch a whitelist because of a couple of settings in there that are specific to the way the chip is wired on the mobo. Apparently, thinkpads are similar enough to Macs, but I wouldn't bet on this beeing "commmon"...

Also, the code in there switches to D2, not D3 and is only for M6,M7 and M9 for now. I may be able to produce code for the M10 as well based on some dumps we did from the MacOS driver, paulus wrote something that we ended up not using because the chip is actually powered down on Macs with the M10.

Then, there is the problem of machines where the chip is powered down during sleep... I can re-POST an rv280 (M9+) and an M10 but only in "graphics" mode, not the VGA side for which I know nothing about, with the same possible issue about video RAM mode register setting.

Ben.

#10 lore raw
Quoted 5 lines · Benjamin Herrenschmidt

I'm hesitant to switch a whitelist because of a couple of settings in there that are specific to the way the chip is wired on the mobo. Apparently, thinkpads are similar enough to Macs, but I wouldn't bet on this beeing "commmon"...

If this is true, then ATI probably won't be able to tell us anything useful, so we're only going to find out if people in the Thinkpad division are willing to tell us something useful (and their track record for being helpful has not been particularly stellar).

And what I was thinking about doing was having the CONFIG option only do it for machines that were detected as being IBM Thinkpads, not all Radeon chips. The blacklist would be for specific IBM thinkpad models; what I'm guessing here is that it's likely that all or most modern IBM thinkpads are going to be wired the same way on the motherboard.

- Ted

#11 lore raw
Quoted 11 lines · Theodore Ts'o

If this is true, then ATI probably won't be able to tell us anything useful, so we're only going to find out if people in the Thinkpad division are willing to tell us something useful (and their track record for being helpful has not been particularly stellar).

And what I was thinking about doing was having the CONFIG option only do it for machines that were detected as being IBM Thinkpads, not all Radeon chips. The blacklist would be for specific IBM thinkpad models; what I'm guessing here is that it's likely that all or most modern IBM thinkpads are going to be wired the same way on the motherboard.

Fine with me then.

#12 lore raw
In reply to Benjamin Herrenschmidt
Quoted 6 lines · Benjamin Herrenschmidt

I've sort-of been waiting for ATI to tell me how to retreive the proper memory register setting from the BIOS, since the code in there currently is quite powerbook specific, and might not write the exact correct value on all models. I suppose it works fine on yours so far, but I'd rather have a way to know the right value ... unfortunately, they didn't reply on this request.

Any chance that it will apply to other Radeon based machines? I have an ASUS (1681) using the 8700 chipset. At the moment suspecd doesn't work at all, but at least somewhere in 2.6.10+ turning off the backlight started working with the screen saver.

I guess it's better than my Dell and Toshiba laptops, which suspecnd but don't resume :-(

Signature · 3 lines
   -bill davidsen ([email protected])
"The secret to procrastination is to put things off until the
 last possible moment - but no longer"  -me