From owner-freebsd-acpi@FreeBSD.ORG Fri Jun 18 13:51:02 2004 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 84F7E16A4CE for ; Fri, 18 Jun 2004 13:51:02 +0000 (GMT) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id D98F243D54 for ; Fri, 18 Jun 2004 13:50:55 +0000 (GMT) (envelope-from avg@icyb.net.ua) Received: from [212.40.38.87] (oddity.topspin.kiev.ua [212.40.38.87]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id QAA06163 for ; Fri, 18 Jun 2004 16:49:45 +0300 (EEST) (envelope-from avg@icyb.net.ua) Message-ID: <40D2F2F8.6070601@icyb.net.ua> Date: Fri, 18 Jun 2004 16:49:44 +0300 From: Andriy Gapon User-Agent: Mozilla Thunderbird 0.6 (X11/20040525) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-acpi@freebsd.org References: <40C8438C.7050709@icyb.net.ua> <40C9A3A9.6010508@icyb.net.ua> In-Reply-To: <40C9A3A9.6010508@icyb.net.ua> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: kernel trap with ACPI on 4.10-release X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jun 2004 13:51:02 -0000 on 11.06.2004 15:20 Andriy Gapon said the following: > ... > Having no knowledge in ACPI internals and very little knowledge in > kernel internals I can not dare suggest what would be most appropriate > to do. Nevertheless, it seems that (1) would be too intrusive and > global; (3) is complex and might not be too reliable; (2) seems to be > the easiest, one line change from "taskqueue_swi" to "taskqueue_thread" > in OsdSchedule.c > > I hope my investigation has something helpful in it, and any feedback > would also be very helpful for my self-education on kernel matters. I looked into the problem more carefully and thoughtfully and now I understand that I was looking in a completely wrong place for a completely wrong stuff. There should not have been any parallel execution thanks to proper splhigh() locking, *but there was*! And I think I know why. I added some debugging printf-s and determined that tasks on taskqueue_swi were executed while acpi_tz_thread "held" splhigh(), this led me to idea that this kernel thread somewhere willingfully gave up its priority, like in tsleep(). In my DSTD _TMP() accesses Winbond HWM chip to read current temperature and its access routine has calls to Stall(). If I understand Intel ACPICA code correctly this call is executed in AcpiExSystemDoStall() function (/usr/src/sys/contrib/dev/acpica/exsystem.c). Looking at the code present in 4.10 (file revision 75) it seems that it is entirely backwards: it calls AcpiOsStall() for long delays and AcpiOsSleep() for short delays, also incorrectly converts units for the latter case, not speaking of the fact that ACPI standard commands that Stall should not be used for delays longer than 100 microseconds and CPU should not be given up. I see that this function was made sane in the code imported in CURRENT (file revision 80). I realize that this is a contributed, vendor code, but I think AcpiExSystemDoStall() should be patched for STABLE too, because the way it is now, it is outright buggy and dangerous. -- Andriy Gapon