DragonFly BSD
DragonFly submit List (threaded) for 2004-07
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

[FIX] acpi panic upon resume


From: YONETANI Tomokazu <qhwt+dragonfly-submit@xxxxxxxxxx>
Date: Sat, 3 Jul 2004 20:15:32 +0900

Hello.
Reading through FreeBSD-CURRENT's commitlogs, I've found the cause of
panic when resuming from sleep state via sleep button or lid switch.
acpi_wakeup.c in /sys/i386/acpica contains the following codes:

        if (pm->pm_pteobj == NULL) {
                pm->pm_pteobj = vm_object_allocate(OBJT_DEFAULT, PTDPTDI + 1);
                pteobj_allocated = 1;
        }

			:

        if (pteobj_allocated) {
                vm_object_deallocate(pm->pm_pteobj);
                pm->pm_pteobj = NULL;
        }

This is needed for us or FreeBSD 4.x because acpi_sleep_machdep() is
called with pm_pteobj == NULL when it's called via eventhandler.

And this is from CVSROOT/commitlogs/sys.20031201.gz:
|alc         2003/09/24 19:51:06 PDT
|
|  FreeBSD src repository
|
|  Modified files:
|    sys/i386/i386        pmap.c
|    sys/i386/include     pmap.h
|    sys/i386/acpica      acpi_wakeup.c
|  Log:
|   - Eliminate the pte object.
|   - Use kmem_alloc_nofault() rather than kmem_alloc_pageable() to allocate
|     KVA space for the page directory page(s).  Submitted by: tegge
|
|  Revision  Changes    Path
|  1.27      +0 -9      src/sys/i386/acpica/acpi_wakeup.c
|  1.436     +18 -18    src/sys/i386/i386/pmap.c
|  1.100     +0 -1      src/sys/i386/include/pmap.h
|

Our pmap.c hasn't experienced the elimination of pte object, but
unfortunately our acpica5 code is based on the code after this commit,
thus the panic. The attached patch fixes the panic by undo-ing the
acpi_wakeup.c 1.27. If we are to follow the above commit, the patch
will eventually be backed out, but patching acpi_wakeup.c is safer
than patching pmap.c, because the latter is more critical and we can
live without acpi after all. What do you think?
Index: i386/acpica5/acpi_wakeup.c
===================================================================
RCS file: /home/source/dragonfly/cvs/src/sys/i386/acpica5/acpi_wakeup.c,v
retrieving revision 1.2
diff -u -r1.2 acpi_wakeup.c
--- i386/acpica5/acpi_wakeup.c	27 Jun 2004 08:52:45 -0000	1.2
+++ i386/acpica5/acpi_wakeup.c	3 Jul 2004 10:26:52 -0000
@@ -187,6 +187,7 @@
 	vm_page_t		page;
 	static vm_page_t	opage = NULL;
 	int			ret = 0;
+ 	int			pteobj_allocated = 0;
 	uint32_t		cr3;
 	u_long			ef;
 	struct proc		*p;
@@ -209,6 +210,10 @@
 #else
 	load_cr3(vtophys(pm->pm_pdir));
 #endif
+	if (pm->pm_pteobj == NULL) {
+		pm->pm_pteobj = vm_object_allocate(OBJT_DEFAULT, PTDPTDI + 1);
+		pteobj_allocated = 1;
+	}
 
 	oldphys = pmap_extract(pm, sc->acpi_wakephys);
 	if (oldphys)
@@ -288,6 +293,10 @@
 			   VM_PROT_READ | VM_PROT_WRITE, 0);
 	}
 
+	if (pteobj_allocated) {
+		vm_object_deallocate(pm->pm_pteobj);
+		pm->pm_pteobj = NULL;
+	}
 	load_cr3(cr3);
 
 	write_eflags(ef);


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]