From owner-acpi-jp@jp.freebsd.org  Sun Oct 28 17:51:46 2001
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id RAA98690;
	Sun, 28 Oct 2001 17:51:46 +0900 (JST)
	(envelope-from owner-acpi-jp@jp.FreeBSD.org)
Received: from funasoul.arch.info.mie-u.ac.jp (user1093.ztv.ne.jp [210.236.161.94])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with SMTP id RAA98685
	for <acpi-jp@jp.freebsd.org>; Sun, 28 Oct 2001 17:51:43 +0900 (JST)
	(envelope-from funa@funa.org)
Received: (qmail 15915 invoked from network); 28 Oct 2001 08:51:32 -0000
Received: from localhost (127.0.0.1)
  by localhost with SMTP; 28 Oct 2001 08:51:32 -0000
Date: Sun, 28 Oct 2001 17:51:31 +0900 (JST)
Message-Id: <20011028.175131.26310311.funa@funa.org>
To: acpi-jp@jp.freebsd.org
Cc: jhb@FreeBSD.org
From: Akira Funahashi <funa@funa.org>
In-Reply-To: <20011028.005304.41626165.iwasaki@jp.FreeBSD.org>
References: <20011016.015324.78789081.funa@funa.org>
	<20011028.005304.41626165.iwasaki@jp.FreeBSD.org>
X-Mailer: Mew version 2.0 on Emacs 21.1 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Reply-To: acpi-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+010328
X-Sequence: acpi-jp 1386
Subject: [acpi-jp 1386] Re: Libretto L2
Errors-To: owner-acpi-jp@jp.freebsd.org
Sender: owner-acpi-jp@jp.freebsd.org
X-Originator: funa@funa.org

Hi, 

Mitsuru IWASAKI <iwasaki@jp.freebsd.org> wrote:
> # Please help me, kernel hackers!
[snip]
> > When I execute "acpiconf -s 1", it says
> > 
> >   acpi0: AcpiHwObtainSleepTypeRegisterData failed - AE_NOT_FOUND
> > 
> > and nothing happens.
> 
> No problem, there is no _S1 object in your DSDT, means not supported.

Oops, I'm sorry. On my laptop, "hw.acpi.lid_switch_state" is set to
"S1", so I've thought that my laptop has _S1 object. I've had to check
the ASL first.

> > When I execute "acpiconf -s 4", the message(as shown below) will show up
> [snip]
> >   acpi0: AcpiEnterSleepState failed - AE_NOT_EXIST
> 
> Your DSDT has _S4 but not support S4BIOS so failed I guess.

Sorry, I've misunderstood something. Is "acpiconf -s 4" only supports
S4BIOS now?

> > When I execute "acpiconf -s 3", Libretto seems to be in sleeping state
> > (LED is blinking), but when it wakes up, it causes a kernel panic.
> > Here is a log of this situation.
> 
> This is real problem...

Yes. This laptop (LibrettoL2) doesn't have APM, so it won't
suspend/resume now. I must shutdown my laptop when I want to
carry it ;-)

> >   ata0: resetting devices .. ata0-slave: ATA identify retries exceeded
> >   done
> >   ata1: resetting devices .. done
> 
> I'm sure that ata_resume() causes process switching by tsleep() in
> ata_command().  I guess this causes double fault panic.
> I'm not sure how to disable process switching currently, but
> could you try to surround DEVICE_RESUME(root_bus) in
> acpi_SetSleepState() with mtx_lock_spin(&sched_lock) and
> mtx_unlock_spin(&sched_lock)?

More strange thing is that after I've cvsup'ed on Oct 20, my laptop
won't wake up from S3 state any more. By using Oct 16's kernel and
waking up from S3 state, it will shows a prompt (#) and resets the ATA
device and then cause a panic. But now, it just cause a kernel panic
on vm_zone.c:504( calling mtx_lock(&z->zmtx)in zfree()). Here is the
log which I've tested on today's cvsup'ed kernel.

  odebu# acpiconf -s 3
  ======== acpi_printcpu() debug dump ========
  gdt[0077:c036c300] idt[0407:c03660c0] ldt[0028] tr[0020] efl[00000006]
  eax[bfc00020] ebx[00000000] ecx[00000001] edx[00008627]
  esi[c0ade600] edi[c789952c] ebp[c82d0b10] esp[c82d0ae4]
  cr0[e005003b] cr2[280a41d4] cr3[01713000] cr4[00000011]
  cs[0008] ds[0010] es[0010] fs[0018] gs[002f] ss[0010]
  ======== acpi_printcpu() debug dump ========
  gdt[0077:c036c300] idt[0407:c03660c0] ldt[0028] tr[0020] efl[00000002]
  eax[00000008] ebx[00000000] ecx[00008000] edx[00008627]
  esi[c0ade600] edi[c789952c] ebp[c82d0b10] esp[c82d0af4]
  cr0[e005003b] cr2[280a41d4] cr3[01713000] cr4[00000011]
  cs[0008] ds[0010] es[0010] fs[0018] gs[002f] ss[0010]
  panic: blockable sleep lock (sleep mutex) zone @ ../../../vm/vm_zone.c:504
  Debugger("panic")
  Stopped at      Debugger+0x44:   pushl   %ebx
  db> t
  Debugger(c02d4bbb) at Debugger+0x44
  panic(c02d7720,c02d3ba0,c02e5eea,c02e5ed4,1f8) at panic+0x70
  witness_lock(c03676e0,8,c02e5ed4,1f8,c0a894d8) at witness_lock+0xbe
  _mtx_lock_flags(c03676e0,0,c02e5ed4,1f8,c0a894d8) at _mtx_lock_flags+0x8f
  zfree(c03676e0,c0a894d8,8627,c085c1a4,c789952c,8000) at zfree+0x3e
  pmap_remove_entry(c789952c,c085c1a4,8000,c789952c,8000) at pmap_remove_entry+0xd4
  pmap_remove_pte(c789952c,bfc00020,8000,8000,9000) at pmap_remove_pte+0x84
  pmap_remove_page(c789952c,8000,0,c0ade600,c789952c) at pmap_remove_page+0x38
  pmap_remove(c789952c,8000,9000) at pmap_remove+0x47
  acpi_sleep_machdep(c0ade600,3,0,c82d0c6c,c7e23604) at acpi_sleep_machdep+0x2c9
  acpi_SetSleepState(c0ade600,3,c82d0c6c,c032dd10,c82d0b80) at acpi_SetSleepState+0x15a
  acpiioctl(c032dd10,80045003,c82d0c6c,3,c7e23604) at acpiioctl+0x98
  spec_ioctl(c82d0ba4,c82d0c34,c0217c8b,c82d0ba4,c1397040) at spec_ioctl+0x26
  spec_vnoperate(c82d0ba4,c1397040,4,c82d0c6c,c02f5740) at spec_vnoperate+0x15
  vn_ioctl(c13a02c0,80045003,c8280c6c,c7e21104,c7e21208) at vn_ioctl+0x10f
  ioctl(c7e23604,c82d0d20,3,3,3) at ioctl+0x20c
  syscall(2f,2f,2f,3,3) at syscall+0x24c
  syscall_with_err_pushed() at syscall_with_err_pushed+0x1b
  --- syscall (54, FreeBSD ELF, ioctl), eip = 0x280a4c9c, esp = 0xbfbffbb0, ebp = 0xbfbffbdc ---
  db> 

So it won't come back to "ata0: resetting devices .. " anymore.
It will cause kernel panic before it reaches to ATA reset.

Anyway, I've applied the following patch to /sys/dev/acpica/acpi.c
and run "acpiconf -s 3".

--- dev/acpica/acpi.c.dist	Fri Oct  5 10:25:02 2001
+++ dev/acpica/acpi.c	Sun Oct 28 04:26:41 2001
@@ -1284,7 +1284,9 @@
 	     *     followed by a "real thing" pass would be better, but the
 	     *     current bus interface does not provide for this.
 	     */
+	    mtx_lock_spin(&sched_lock);
 	    DEVICE_RESUME(root_bus);
+	    mtx_unlock_spin(&sched_lock);
 	    return_ACPI_STATUS(AE_ERROR);
 	}
 	sc->acpi_sstate = state;
@@ -1321,7 +1323,9 @@
 	    }
 	}
 	AcpiLeaveSleepState((UINT8)state);
+	mtx_lock_spin(&sched_lock);
 	DEVICE_RESUME(root_bus);
+	mtx_unlock_spin(&sched_lock);
 	sc->acpi_sstate = ACPI_STATE_S0;
 	acpi_enable_fixed_events(sc);
 	break;

But unfortunately, nothing changed...
It still cause a kernel panic on vm_zone.c:504. I don't know what has
changed since Oct 16, but my laptop won't show the prompt when it came
back from S3 state anymore.

> > Here, I'll attach the dmesg, ASL and DSDT file(which is tar+gzipped).
> > Any help is welcome.
> 
> Thanks, I will commit this.
> BTW, what's the exact model name of your Libretto?

I'm sorry. I've missed the information too.
The model name of my Libretto is "Libretto L2/060TNML" and its model
number is "PAL2060TNML".
-- 
Akira Funahashi/[funa@funa.org]
