From owner-svn-src-user@FreeBSD.ORG Thu May 19 16:32:40 2011 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45BE5106566B; Thu, 19 May 2011 16:32:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id B2A4E8FC19; Thu, 19 May 2011 16:32:38 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id TAA17276; Thu, 19 May 2011 19:32:37 +0300 (EEST) (envelope-from avg@FreeBSD.org) Message-ID: <4DD54624.5050202@FreeBSD.org> Date: Thu, 19 May 2011 19:32:36 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.17) Gecko/20110504 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: Attilio Rao References: <201105181508.p4IF8UoS096841@svn.freebsd.org> <20110518182441.GB2273@garage.freebsd.pl> <4DD4243C.4070301@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: mdf@FreeBSD.org, src-committers@FreeBSD.org, Pawel Jakub Dawidek , svn-src-user@FreeBSD.org Subject: Re: svn commit: r222060 - in user/avg/xcpu/sys: kern sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 May 2011 16:32:40 -0000 on 18/05/2011 23:50 Attilio Rao said the following: > 2011/5/18 : >> On Wed, May 18, 2011 at 1:06 PM, Attilio Rao wrote: >>> 2011/5/18 Andriy Gapon : >>>> on 18/05/2011 21:24 Pawel Jakub Dawidek said the following: >>>>> On Wed, May 18, 2011 at 03:08:30PM +0000, Andriy Gapon wrote: >>>>> [...] >>>>>> --- user/avg/xcpu/sys/sys/proc.h Wed May 18 15:07:36 2011 (r222059) >>>>>> +++ user/avg/xcpu/sys/sys/proc.h Wed May 18 15:08:30 2011 (r222060) >>>>>> @@ -781,7 +781,7 @@ MALLOC_DECLARE(M_SUBPROC); >>>>>> * Otherwise, the kernel will deadlock since the scheduler isn't >>>>>> * going to run the thread that holds the lock we need. >>>>>> */ >>>>>> -#define THREAD_PANICED() \ >>>>>> +#define TD_IS_INPANIC() \ >>>>>> (panicstr != NULL && (curthread->td_flags & TDF_INPANIC) != 0) >>>>> >>>>> Does TDF_INPANIC make sense without panicstr being set? >>>> >>>> Very good observation. It seems that TDF_INPANIC can never be set unless >>>> panicstr is set. So, I guess it should be OK to simplify the macro further. >>>> Thank you. >>> >>> However I think that TDF_INPANIC handling is not optimal. >>> You should really acquire thread_lock otherwise you are going to break >>> choosethread() concurrency. >>> >>> I would prefer to make TDF_INPANIC a private flag and just use it with >>> curthread, if possible, but I still don't have a good way to resolve >>> choosethread() (I would dig the runqueue adding path and resolve the >>> problem later in the codeflow, I think). >> >> I know it's almost required now (sync on reboot?!?!), but I would >> strongly question, from an architectural standpoint, why the scheduler >> should be running at all in panic. Once a thread pulls the panic >> trigger, nothing else should run except ddb in that thread's context. This is true. The code that I propose makes sure that there is only one CPU and only one thread running when TDF_INPANIC is set. If someone decides to enable sync-on-panic and expect it to work, I can only pray for them. Yes, there most likely will be a knob to turn off CPU stopping for panic, but I plan it mostly as a quick way to switch back to legacy (present) behavior if a need arises (bugs, tec). It may work to the same degree as panic on SMP works now, but without any guarantees. > Yes, I mostly agree, so for avg's purpose he should maybe assert > choosethread() doesn't pickup the TDF_INPANIC threads (or just skip > the check at all, as it should be made private). Unfortunately I can not understand your concern and proposal. Not sure why choosethread() would be called at all, why it shouldn't pick up TDF_INPANIC thread(s), and which check could/should be skipped and what should be made private. Sorry :( -- Andriy Gapon