Skip to contentSkip to conversation

Need advice on amd76x_pm [patch included]

PATCH Joerg Sommrey 2 participants 2 messages Feb 8, 2005 ACPI

lore
Share & tools
lore
#0 lore raw

Hi all,

can anybody comment on some amd76x_pm issues? I've played around with this module for months and I'm quite satisfied with it now, but a couple of questions remain.

The changes I made:
- rediffed to 2.6.10
- new module macro syntax
- renamed module parameter l to lazy_idle
- added C3 counter in sysfs (if enabled)
- tried to make it preemp-safe
- added a "dummy operation" after wake up

There were problems with the module wrt system clock stability. To solve these I took a look at the ACPI C2/C3 stuff. They enter C2/C3 with local_irq_disable(), so this seems sane. Some tests with preempt_disable() showed worse clock stability, so I kept using local_irq_disable(). From Documentation/preempt-locking.txt I got the impression that preempt_check_resched() is needed after local_irq_enable(). Is this true? It is not done in the ACPI code.

The ACPI code does a "dummy operation" after returning from C2/C3. I don't know what this is good for, but I coded something similar in amd76x_pm. Clock stability seems to be a bit better with this dummy inb().

I'm still unsure if the code is correct for a preemptible kernel.

Regarding C3: A JH comment in the source states, that the C3 code never was reached. Reducing lazy_idle to < 6 results in entering C3 on my box. However, on one side there was no additional temperature reduction with C3 and on the other side I need lazy_idle > 100 to have a clock with acceptable stability. (Currently I use lazy_idle=128.) That's why I didn't enable C3 in the code.

Another issue: On Ingo's RT-kernels this module caused a real bad system clock stability. ntpd was even unable to syncronize the system clock with an attached radio clock.

The patch was tested on AMD768 only and surely needs some testing on other hardware.

Are there any chances for this patch to be merged into mainline in the future and what needs to be done to achieve this?

-jo

amd76x_pm.2.6.10.patch:

drivers/acpi/Kconfig +16 -1
diff -uNr linux-2.6.10/drivers/acpi/Kconfig linux-2.6.10-jo1/drivers/acpi/Kconfig
@@ -325,5 +325,20 @@
 	  kernel logs, and/or you are using this on a notebook which
 	  does not yet have an HPET, you should say "Y" here.
 
-endmenu
+config AMD76X_PM
+        tristate "AMD76x Native Power Management support"
+	default n
+        depends on X86 && PCI
+        ---help---
+          This driver enables Power Management on AMD760MP & AMD760MPX chipsets.
+	  This is about same as ACPI C2, except that ACPI folks don't do SMP ATM.
+	  In /sys/devices/pci0000:00/0000:00:00.0/ is a statistics C2_cnt
+	  (RO) and lazy_idle (RW) file.
+
+	  To compile this driver as a module ( = code which can be inserted in
+	  and removed from the running kernel whenever you want), say M
+	  here.  The module will be called amd76x_pm.
 
+	  If unsure, say N.
+
+endmenu
drivers/acpi/Makefile +5 -0
diff -uNr linux-2.6.10/drivers/acpi/Makefile linux-2.6.10-jo1/drivers/acpi/Makefile
@@ -48,3 +48,8 @@
 obj-$(CONFIG_ACPI_IBM)		+= ibm_acpi.o
 obj-$(CONFIG_ACPI_TOSHIBA)	+= toshiba_acpi.o
 obj-$(CONFIG_ACPI_BUS)		+= scan.o motherboard.o
+
+#
+# not really ACPI thing, until they handle SMP.
+#
+obj-$(CONFIG_AMD76X_PM)		+= amd76x_pm.o
drivers/acpi/amd76x_pm.c +771 -0

771 lines not on this page · raw message

include/linux/amd76x_pm.h +59 -0

59 lines not on this page · raw message

#1 lore raw
Quoted 6 lines · Joerg Sommrey

Hi all,

can anybody comment on some amd76x_pm issues? I've played around with this module for months and I'm quite satisfied with it now, but a couple of questions remain.

Quoted 7 lines

The changes I made:
- rediffed to 2.6.10
- new module macro syntax
- renamed module parameter l to lazy_idle
- added C3 counter in sysfs (if enabled)
- tried to make it preemp-safe
- added a "dummy operation" after wake up

Nice to hear you've done some more work on it! I haven't spent much time on this because of the ACPI/BIOS problems on my s2460 make the box go to sleep when I load the module...

Quoted 8 lines

There were problems with the module wrt system clock stability. To solve these I took a look at the ACPI C2/C3 stuff. They enter C2/C3 with local_irq_disable(), so this seems sane. Some tests with preempt_disable() showed worse clock stability, so I kept using local_irq_disable(). From Documentation/preempt-locking.txt I got the impression that preempt_check_resched() is needed after local_irq_enable(). Is this true? It is not done in the ACPI code.

Quoted 6 lines

The ACPI code does a "dummy operation" after returning from C2/C3. I don't know what this is good for, but I coded something similar in amd76x_pm. Clock stability seems to be a bit better with this dummy inb().
I'm still unsure if the code is correct for a preemptible kernel.

OK. Maybe you can check out the idle loop in my recent dyn-tick patch? [1] You should be able to modify the idle loop from dyn-tick patch for amx76x_pm.c. The locking should be better. Then see also cpu_idle_wait() for unloading the module for kernels > 2.6.10.

Quoted 6 lines

Regarding C3: A JH comment in the source states, that the C3 code never was reached. Reducing lazy_idle to < 6 results in entering C3 on my box. However, on one side there was no additional temperature reduction with C3 and on the other side I need lazy_idle > 100 to have a clock with acceptable stability. (Currently I use lazy_idle=128.) That's why I didn't enable C3 in the code.

OK.

Quoted 3 lines

Another issue: On Ingo's RT-kernels this module caused a real bad system clock stability. ntpd was even unable to syncronize the system clock with an attached radio clock.

Is this also with the ACPI PM timer?

Quoted 2 lines

The patch was tested on AMD768 only and surely needs some testing on other hardware.

I'll try it out here on my S2460 also. (Assuming I can get my system woken up after I load the module :)

Quoted 2 lines

Are there any chances for this patch to be merged into mainline in the future and what needs to be done to achieve this?

Considering that's it's been in 2.4 for few years now, It should be safe to merge after some changes I suggested above.

Regards,

Tony

[1] http://lkml.org/lkml/2005/2/5/216