[issue557] 1.9.0-DEVELOPMENT hangs with ACPI enabled

YONETANI Tomokazu qhwt+dfly at les.ath.cx
Wed Feb 28 03:55:35 PST 2007


On Mon, Feb 26, 2007 at 09:55:40AM -0300, Mariano Aliaga wrote:
> On 2/24/07, YONETANI Tomokazu <bugs at lists.dragonflybsd.org> wrote:
> >
> >hw.acpi.cpu sysctl knob?  The picture is somewhat overwrapped, but it
> >seems that acpi_pcpu_get_id() failed for both units.  You saw 4
> >"acpi_pcpu_get_id() failed" message, right?  I think the lock-up occurred
> >somewhere other than acpi_cpu_probe(), after returning from it, but
> >whether it locks up or not depends on what acpi_cpu_probe() does.
> >
> 
> Yes, "acpi_pcpu_get_id() failed" appears 4 times.
> 
> >I wrote another patch to find it.  Please apply attached patch after
> >reverting the previous change, and install the driver.  Boot into the
> >boot loader prompt, and type(without other debug.acpi variables set)
> >the following two lines to boot into single-user mode:
> >  set debug.acpi.cpu.knob=5
> >  boot -sv
> >if it locks up, write down(or take a picture of) lines containing "ProcId",
> >which looks like this:
> >  cpu0: ProcId 1: acpi_id=0, cpu_id=0
> >or
> >  cpu0: ProcId 1: can't find cpu_id
> >
> 
> With debug.acpi.cpu.knob=5 I get 2 of this messages (dmesg attached),
> and the system doesn't lock up. I tried 4, 3, 2, 1 just in case, but
> Procid messages don't appear and the system also doesn't lock up.

Does this reliably reproduce?  I mean it always yields the same result,
across reboot or after power-cycle?  I see 6 ProcId lines in dmesg output,
not 4, and none of them failed, unlike it did in the last picture.

If it does, please try yet another patch attached to this message(after
reverting the last patches).  Also please make sure that the files in
/sys/dev/acpica5 or /sys/platform/pc32/acpica5 are up to date before
rebuilding the acpi driver.  This time you are going to try 6 to 11 for
debug.acpi.cpu.knob and see when it locks up.  If I'm not mistaken,
it should lock up before reaching to 11.

Cheers.
Index: acpi_cpu.c
===================================================================
RCS file: /home/source/dragonfly/cvs/src/sys/dev/acpica5/acpi_cpu.c,v
retrieving revision 1.19
diff -u -p -r1.19 acpi_cpu.c
--- acpi_cpu.c	22 Feb 2007 04:02:50 -0000	1.19
+++ acpi_cpu.c	28 Feb 2007 11:40:57 -0000
@@ -182,10 +182,15 @@ static devclass_t acpi_cpu_devclass;
 DRIVER_MODULE(cpu, acpi, acpi_cpu_driver, acpi_cpu_devclass, 0, 0);
 MODULE_DEPEND(cpu, acpi, 1, 1, 1);
 
+static int acpi_cpu_probe_debug_knob = 0;
+TUNABLE_INT("debug.acpi.cpu.knob", &acpi_cpu_probe_debug_knob);
+#define DEBUG_KNOB(n)	\
+    if (acpi_cpu_probe_debug_knob == (n)) return(ENXIO)
+
 static int
 acpi_cpu_probe(device_t dev)
 {
-    int			   acpi_id, cpu_id, cx_count;
+    int			   acpi_id, cpu_id, proc_id, cx_count;
     ACPI_BUFFER		   buf;
     ACPI_HANDLE		   handle;
     char		   msg[32];
@@ -196,14 +201,16 @@ acpi_cpu_probe(device_t dev)
 	return (ENXIO);
 
     handle = acpi_get_handle(dev);
+DEBUG_KNOB(1);
     if (cpu_softc == NULL)
 	cpu_softc = kmalloc(sizeof(struct acpi_cpu_softc *) *
 	    SMP_MAXCPU, M_TEMP /* XXX */, M_INTWAIT | M_ZERO);
-
+DEBUG_KNOB(2);
     /* Get our Processor object. */
     buf.Pointer = NULL;
     buf.Length = ACPI_ALLOCATE_BUFFER;
     status = AcpiEvaluateObject(handle, NULL, NULL, &buf);
+DEBUG_KNOB(3);
     if (ACPI_FAILURE(status)) {
 	device_printf(dev, "probe failed to get Processor obj - %s\n",
 		      AcpiFormatException(status));
@@ -221,23 +228,31 @@ acpi_cpu_probe(device_t dev)
      * ProcId as a key, however, some boxes do not have the same values
      * in their Processor object as the ProcId values in the MADT.
      */
-    acpi_id = obj->Processor.ProcId;
+    acpi_id = proc_id = obj->Processor.ProcId;
     AcpiOsFree(obj);
-    if (acpi_pcpu_get_id(device_get_unit(dev), &acpi_id, &cpu_id) != 0)
+DEBUG_KNOB(4);
+    if (acpi_pcpu_get_id(device_get_unit(dev), &acpi_id, &cpu_id) != 0) {
+	if (bootverbose)
+	    device_printf(dev, "ProcId %d: can't find cpu_id\n", proc_id);
 	return (ENXIO);
-
+    }
+    if (bootverbose) {
+	device_printf(dev, "ProcId %d: acpi_id=%d, cpu_id=%d\n", proc_id,
+		      acpi_id, cpu_id);
+    }
     /*
      * Check if we already probed this processor.  We scan the bus twice
      * so it's possible we've already seen this one.
      */
     if (cpu_softc[cpu_id] != NULL)
 	return (ENXIO);
-
+DEBUG_KNOB(5);
     /* Get a count of Cx states for our device string. */
     cx_count = 0;
     buf.Pointer = NULL;
     buf.Length = ACPI_ALLOCATE_BUFFER;
     status = AcpiEvaluateObject(handle, "_CST", NULL, &buf);
+DEBUG_KNOB(6);
     if (ACPI_SUCCESS(status)) {
 	obj = (ACPI_OBJECT *)buf.Pointer;
 	if (ACPI_PKG_VALID(obj, 2))
@@ -251,15 +266,19 @@ acpi_cpu_probe(device_t dev)
 	if (cx_count > 0)
 	    cx_count++;
     }
+DEBUG_KNOB(7);
     if (cx_count > 0)
 	ksnprintf(msg, sizeof(msg), "ACPI CPU (%d Cx states)", cx_count);
     else
 	strlcpy(msg, "ACPI CPU", sizeof(msg));
+DEBUG_KNOB(8);
     device_set_desc_copy(dev, msg);
+DEBUG_KNOB(9);
 
     /* Mark this processor as in-use and save our derived id for attach. */
     cpu_softc[cpu_id] = (void *)1;
     acpi_set_magic(dev, cpu_id);
+DEBUG_KNOB(10);
 
     return (0);
 }
@@ -278,6 +297,7 @@ acpi_cpu_attach(device_t dev)
 
     ACPI_ASSERTLOCK;
 
+DEBUG_KNOB(11);
     sc = device_get_softc(dev);
     sc->cpu_dev = dev;
     sc->cpu_handle = acpi_get_handle(dev);
@@ -326,6 +346,7 @@ acpi_cpu_attach(device_t dev)
 
     return_VALUE (0);
 }
+#undef DEBUG_KNOB
 
 /*
  * Find the nth present CPU and return its pc_cpuid as well as set the




More information about the Bugs mailing list