[FIX] acpi panic upon resume

看板DFBSD_submit作者時間21年前 (2004/07/04 03:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
--XF85m9dhOBO43t/C Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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? --XF85m9dhOBO43t/C Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="undo-pteobj-elimination.diff" 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); --XF85m9dhOBO43t/C--
文章代碼(AID): #10vmcz00 (DFBSD_submit)
文章代碼(AID): #10vmcz00 (DFBSD_submit)