svn commit: r222060 - in user/avg/xcpu/sys: kern sys

mdf at FreeBSD.org mdf at FreeBSD.org
Wed May 18 20:43:46 UTC 2011


On Wed, May 18, 2011 at 1:06 PM, Attilio Rao <attilio at freebsd.org> wrote:
> 2011/5/18 Andriy Gapon <avg at freebsd.org>:
>> 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.

Cheers,
matthew


More information about the svn-src-user mailing list