Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 May 2011 16:06:18 -0400
From:      Attilio Rao <attilio@freebsd.org>
To:        Andriy Gapon <avg@freebsd.org>
Cc:        src-committers@freebsd.org, Pawel Jakub Dawidek <pjd@freebsd.org>, svn-src-user@freebsd.org
Subject:   Re: svn commit: r222060 - in user/avg/xcpu/sys: kern sys
Message-ID:  <BANLkTikAnB-3XbvDwGHgyqyJquH9BhqzOQ@mail.gmail.com>
In-Reply-To: <4DD4243C.4070301@FreeBSD.org>
References:  <201105181508.p4IF8UoS096841@svn.freebsd.org> <20110518182441.GB2273@garage.freebsd.pl> <4DD4243C.4070301@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
2011/5/18 Andriy Gapon <avg@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 =C2=A0 =C2=A0 Wed May 18 15:07:36 2011=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r222059)
>>> +++ user/avg/xcpu/sys/sys/proc.h =C2=A0 =C2=A0 Wed May 18 15:08:30 2011=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r222060)
>>> @@ -781,7 +781,7 @@ MALLOC_DECLARE(M_SUBPROC);
>>> =C2=A0 * Otherwise, the kernel will deadlock since the scheduler isn't
>>> =C2=A0 * going to run the thread that holds the lock we need.
>>> =C2=A0 */
>>> -#define =C2=A0 =C2=A0 THREAD_PANICED() =C2=A0 =C2=A0 =C2=A0 =C2=A0\
>>> +#define =C2=A0 =C2=A0 TD_IS_INPANIC() \
>>> =C2=A0 =C2=A0 =C2=A0(panicstr !=3D NULL && (curthread->td_flags & TDF_I=
NPANIC) !=3D 0)
>>
>> Does TDF_INPANIC make sense without panicstr being set?
>
> Very good observation. =C2=A0It seems that TDF_INPANIC can never be set u=
nless
> panicstr is set. =C2=A0So, 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).

Attilio


--=20
Peace can only be achieved by understanding - A. Einstein



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BANLkTikAnB-3XbvDwGHgyqyJquH9BhqzOQ>