Kernel panic when unpluggin AC adaptor

Giovanni Trematerra giovanni.trematerra at gmail.com
Wed May 12 03:44:59 UTC 2010


On Fri, May 7, 2010 at 8:33 PM, Demelier David <demelier.david at gmail.com> wrote:
> Le Vendredi 07 mai 2010 à 18:22 +0200, Giovanni Trematerra a écrit :
>> On Fri, May 7, 2010 at 2:08 PM, Demelier David <demelier.david at gmail.com> wrote:
>> > Hi,
>> >        I noticed that pluggin the AC adaptor when I boot without it does not
>> >        panic. It only panic when removing it.
>> >
>> >        Maybe that could help ?
>> >
>>
>> Good to know. The problem lies somewhere when performance state change.
>> In your case it happens when you remove AC adaptor. Let's hope someone on
>> acpi@ ml comes up with a good idea.
>>
>
> Okay so for the moment no change, I'll wait for someone with an idea
> that could solve my problem. For me because the panic only happens when
> changing profile from ac plugged -> ac unplugged (and not the reverse) I
> would think it's a cpu related acpi issue.
>

I looked deeper and it seems to me that when you unplug the AC
adapter, acpi_cpu_notify calls acpi_cpu_cx_cst that try to allocate a
new cx_ptr->p_lvlx  via acpi_PkgGas.
If acpi_PkgGas set cx_ptr->p_lvlx to NULL for any reasons you'll have
the panic that you reported.
A solution would be to set acpi_cpu_hook to NULL so acpi_cpu_idle won't call it.
I need some time to have a patch because of the possible race between
acpi_cpu_notify and
acpi_cpu_idle during set acpi_cpu_hook to NULL.
if you have time and want panic your system you could try the attached
patch, just to be
sure that we catch it.

Thanks

--
Gianni
-------------- next part --------------
Index: sys/dev/acpica/acpi_cpu.c
===================================================================
--- sys/dev/acpica/acpi_cpu.c	(revision 207947)
+++ sys/dev/acpica/acpi_cpu.c	(working copy)
@@ -609,7 +609,9 @@ acpi_cpu_generic_cx_probe(struct acpi_cpu_softc *s
 	    cx_ptr->trans_lat = AcpiGbl_FADT.C2Latency;
 	    cx_ptr++;
 	    sc->cpu_cx_count++;
-	}
+	} else
+		panic("%s: Cannot allocate resource %d for C3 state", __func__, 
+		    cx_ptr->res_type);
     }
     if (sc->cpu_p_blk_len < 6)
 	return;
@@ -625,7 +627,9 @@ acpi_cpu_generic_cx_probe(struct acpi_cpu_softc *s
 	    cx_ptr->trans_lat = AcpiGbl_FADT.C3Latency;
 	    cx_ptr++;
 	    sc->cpu_cx_count++;
-	}
+	} else
+		panic("%s: Cannot allocate resource %d for C3 state", __func__, 
+		    cx_ptr->res_type);
     }
 }
 
@@ -732,7 +736,8 @@ acpi_cpu_cx_cst(struct acpi_cpu_softc *sc)
 			     cx_ptr->trans_lat));
 	    cx_ptr++;
 	    sc->cpu_cx_count++;
-	}
+	} else
+		panic("Got it! acpi_PkgGas set p_lvlx to NULL");
     }
     AcpiOsFree(buf.Pointer);
 


More information about the freebsd-stable mailing list