Michal Čihař - Archive for Nov. 15, 2005

Suspend s nvidií a 2.6.14

Kernel 2.6.14 konečně vyřešil můj problém s memory leakem kdesi v ACPI, takže nezbylo než upgradovat :-). Ovšem nvidiacký modul se poté zuřivě bránil suspendu do paměti, přestože to dříve fungovalo.

Samozřejmě řešení je jednoduché, stačí se podívat, jaké eventy se posílají:

 /*
 * There are 4 important states driver can be in:
 * ON     -- driver is working
 * FREEZE -- stop operations and apply whatever policy is applicable to a
 *           suspended driver of that class, freeze queues for block like IDE
 *           does, drop packets for ethernet, etc... stop DMA engine too etc...
 *           so a consistent image can be saved; but do not power any hardware
 *           down.
 * SUSPEND - like FREEZE, but hardware is doing as much powersaving as
 *           possible. Roughly pci D3.
 *
 * Unfortunately, current drivers only recognize numeric values 0 (ON) and 3
 * (SUSPEND).  We'll need to fix the drivers. So yes, putting 3 to all different
 * defines is intentional, and will go away as soon as drivers are fixed.  Also
 * note that typedef is neccessary, we'll probably want to switch to
 *   typedef struct pm_message_t { int event; int flags; } pm_message_t
 * or something similar soon.
 */

A příslušně opravit nvidiácké zdrojáky:

 --- orig/nv/nv.c  2005-07-19 01:58:40.000000000 +0200
+++ mod/nv/nv.c        2005-11-15 15:28:46.500089000 +0100
@@ -3624,12 +3624,13 @@
 
     switch (state)
     {
-        case PM_SUSPEND_MEM:
+        case PM_EVENT_SUSPEND:
+        case PM_EVENT_FREEZE:
             nv_printf(NV_DBG_INFO, "NVRM: ACPI: received suspend event\n");
             status = rm_power_management(nv, 0, NV_PM_ACPI_STANDBY);
             break;
 
-        case PM_SUSPEND_ON:
+        case PM_EVENT_ON:
             nv_printf(NV_DBG_INFO, "NVRM: ACPI: received resume event\n");
             status = rm_power_management(nv, 0, NV_PM_ACPI_RESUME);
             break;