Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 May 2011 12:41:24 -0400
From:      Attilio Rao <attilio@freebsd.org>
To:        Andriy Gapon <avg@freebsd.org>
Cc:        Matthew Fleming <mdf@freebsd.org>, 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:  <BANLkTi=m4x2H2vvn48nCv%2BT2--HfSaT2Gw@mail.gmail.com>
In-Reply-To: <4DDE7555.7090500@FreeBSD.org>
References:  <201105181508.p4IF8UoS096841@svn.freebsd.org> <20110518182441.GB2273@garage.freebsd.pl> <4DD4243C.4070301@FreeBSD.org> <BANLkTikAnB-3XbvDwGHgyqyJquH9BhqzOQ@mail.gmail.com> <4DDD13F9.5040800@FreeBSD.org> <4DDE7555.7090500@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
2011/5/26 Andriy Gapon <avg@freebsd.org>:
> on 25/05/2011 17:36 Andriy Gapon said the following:
>> on 18/05/2011 23:06 Attilio Rao said the following:
>>> 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've been thinking about this.
>> I think that in the new world where only one thread runs after panic we =
could just
>> reduce TD_IS_INPANIC to panicstr !=3D NULL, TDF_INPANIC could be removed=
 altogether
>> along with the check in =C2=A0choosethread(). =C2=A0But for some initial=
 period I would like
>> to have an option to disable CPU stopping (to protect from possible bugs=
,
>> regressions, etc) and for that I would like to keep TDF_INPANIC. =C2=A0T=
he flag could
>> be set without thread_lock() because we still allow only one thread to b=
e in/after
>> panic. =C2=A0But I completely agree with you that it is cleaner to move =
TDF_INPANIC to
>> private flags.
>>
>> So the first step:
>> TDF_INPANIC =3D> to private flags
>>
>> Some time in the future:
>> TDF_INPANIC =3D> removed
>> TD_IS_INPANIC =3D> panicstr !=3D NULL
>>
>
> Ehm... =C2=A0After discussing this issue with you on IRC I realized absur=
dity of my
> interim suggestion.
>
> New proposal:
> #define TD_IS_INPANIC() \
> =C2=A0 =C2=A0 =C2=A0 =C2=A0(panicstr !=3D NULL && stop_cpus_on_panic)
>
> When/if stop_cpus_on_panic knob is removed, then TD_IS_INPANIC will natur=
ally be
> reduced to (panicstr !=3D NULL) and TDF_INPANIC flag will also go as we w=
ill be
> guaranteed that the scheduler will not be running.

Yes, that is a much better proposal.

> Given the above, maybe TD_IS_INPANIC should change name again as it doesn=
't check
> properties of a particular thread, but rather the whole system state? =C2=
=A0Also,
> sys/proc.h doesn't seem like the best location for it anymore.

Yes, I think it would be better something like SYSTEM_IN_PANIC() or such.
The natural location for this would be kern_shutdown.c but it really
doesn't have a corresponding header (maybe sys/reboot.h could be, with
some more lifting, but for the moment, no), thus you can still pickup
something easy to use like proc.h or systm.h.

It is your decision, anyway, I don't have strong opinion on where to put th=
is.

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?BANLkTi=m4x2H2vvn48nCv%2BT2--HfSaT2Gw>