On Wed, Jan 10, 2007 at 01:00:53PM +0900, YONETANI Tomokazu wrote:
[spinlock remains held for no reason]
> From the debugging output, I know the spinlock holder is always
> the line 592 of AcpiHwReadRegister(), and the only caller of this function
> with ACPI_MTX_LOCK is AcpiRegisterRead() in AcpiEnterSleepState():
> 
>     /* Wait until we enter sleep state */
> 
>     do
>     {
        AcpiOsStall(1000);      <== INSERT THIS
>       Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue);
>       if (ACPI_FAILURE (Status))
>       {
>           return_ACPI_STATUS (Status);
>       }
> 
>       /* Spin until we wake */
> 
>     } while (!InValue);

While looking around, I found that AcpiEnterSleepStateS4Bios() has
similar spin loop at the bottom, but with a call to AcpiOsStall()
(== DELAY()) before AcpiGetRegister().  So I tried adding it to
AcpiEnterSleepState() too, and to my amazement, the problem went away.
I tried several ten times of suspending and waking up the laptop,
but I'm no longer able to reproduce it.  My question, though, is why
why just a DELAY() makes any difference (ISTR making gd_spinlocks_wr
volatile didn't solve the problem).

Anyway, new version is here:
  http://les.ath.cx/DragonFly/acpi-20061109-19.diff

Cheers.

Reply via email to