From owner-acpi-jp@jp.freebsd.org  Thu Dec  6 01:50:04 2001
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id BAA60996;
	Thu, 6 Dec 2001 01:50:04 +0900 (JST)
	(envelope-from owner-acpi-jp@jp.FreeBSD.org)
Received: from thalia.fm.intel.com (fmfdns02.fm.intel.com [132.233.247.11])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id BAA60986;
	Thu, 6 Dec 2001 01:50:01 +0900 (JST)
	(envelope-from robert.moore@intel.com)
Received: from fmsmsxvs043.fm.intel.com (fmsmsxvs043.fm.intel.com [132.233.42.129])
	by thalia.fm.intel.com (8.9.1a+p1/8.9.1/d: relay.m4,v 1.46 2001/10/25 21:02:55 root Exp $) with SMTP id QAA21362;
	Wed, 5 Dec 2001 16:50:01 GMT
Received: from FMSMSX017.fm.intel.com ([132.233.42.196])
 by fmsmsxvs043.fm.intel.com (NAVGW 2.5.1.6) with SMTP id M2001120508491313643
 ; Wed, 05 Dec 2001 08:49:13 -0800
Received: by fmsmsx017.fm.intel.com with Internet Mail Service (5.5.2653.19)
	id <X7DK17YA>; Wed, 5 Dec 2001 08:50:01 -0800
Message-ID: <B9ECACBD6885D5119ADC00508B68C1EA2FE083@orsmsx107.jf.intel.com>
From: "Moore, Robert" <robert.moore@intel.com>
To: "'Mitsuru IWASAKI'" <iwasaki@jp.FreeBSD.org>, acpi-jp@jp.FreeBSD.org,
        "Moore, Robert" <robert.moore@intel.com>
Cc: "Grover, Andrew" <andrew.grover@intel.com>
Date: Wed, 5 Dec 2001 08:49:56 -0800 
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)
Content-Type: text/plain;
	charset="iso-8859-1"
Reply-To: acpi-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+010328
X-Sequence: acpi-jp 1518
Subject: [acpi-jp 1518] RE: problem in AcpiExSystemWaitSemaphore()
Errors-To: owner-acpi-jp@jp.freebsd.org
Sender: owner-acpi-jp@jp.freebsd.org
X-Originator: robert.moore@intel.com


I agree that the actual exception from AcpiOsWaitSemaphore is lost.
However, I don't want to lose the failure exception from EnterInterpreter,
either.  So, I think that I would use two exception codes:

    Status = AcpiOsWaitSemaphore (Semaphore, 1, 0);
    if (ACPI_SUCCESS (Status))
    {
        return_ACPI_STATUS (Status);
    }

    if (Status == AE_TIME)
    {
        /* We must wait, so unlock the interpreter */

        AcpiExExitInterpreter ();

        Status = AcpiOsWaitSemaphore (Semaphore, 1, Timeout);

        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*** Thread awake after blocking,
%s\n",
            AcpiFormatException (Status)));

        /* Reacquire the interpreter */

        Status2 = AcpiExEnterInterpreter ();
        if (ACPI_FAILURE (Status2))
        {
            /* Report fatal error, could not acquire interpreter */

            return_ACPI_STATUS (Status2);
        }
    }
    return_ACPI_STATUS (Status);

-----Original Message-----
From: Mitsuru IWASAKI [mailto:iwasaki@jp.FreeBSD.org]
Sent: Wednesday, December 05, 2001 8:37 AM
To: acpi-jp@jp.FreeBSD.org; robert.moore@intel.com
Cc: andrew.grover@intel.com; iwasaki@jp.FreeBSD.org
Subject: Re: [acpi-jp 1516] RE: problem in AcpiExSystemWaitSemaphore()


Hi,

> This is a *very* degenerate case, and I'm not convinced that it's worth
> adding any additional code to try and "cleanup" on a failure from
> AcpiExEnterInterpreter.
> 
> If the interpreter cannot be locked again, something is very, very
seriously
> wrong.  At the minimum, the currently running method must be aborted, but
> chances are that the entire ACPI subsystem is corrupted, and perhaps even
> the kernel itself is crashed.

OK, I understand that deleting semaphore doesn't make sense in falier case.
However, my point is still 'we must return the status from second
AcpiOsWaitSemaphore() calling w/o any adjustments if we get
interpreter again successfully'.
Currently it seems that we return AE_TIME in usual case.
I've just made simplified patch.  I think it's clearer than before.

Thanks

Index: exsystem.c
===================================================================
RCS file: /home/ncvs/src/sys/contrib/dev/acpica/exsystem.c,v
retrieving revision 1.1.1.7
diff -u -r1.1.1.7 exsystem.c
--- exsystem.c	7 Sep 2001 01:22:24 -0000	1.1.1.7
+++ exsystem.c	5 Dec 2001 16:23:47 -0000
@@ -172,8 +172,7 @@
 
         /* Reacquire the interpreter */
 
-        Status = AcpiExEnterInterpreter ();
-        if (ACPI_SUCCESS (Status))
+        if (ACPI_FAILURE(AcpiExEnterInterpreter ()))
         {
             /* Restore the timeout exception */
 
