Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Jul 2012 17:39:43 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Attilio Rao <attilio@freebsd.org>
Cc:        Davide Italiano <davide@freebsd.org>, svn-src-projects@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r238907 - projects/calloutng/sys/kern
Message-ID:  <20120730143943.GY2676@deviant.kiev.zoral.com.ua>
In-Reply-To: <CAJ-FndBmXkyJJ=fCkEpVm84E56A2_EoM6kbch03e4RMEM6WCGQ@mail.gmail.com>
References:  <201207301350.q6UDobCI099069@svn.freebsd.org> <CAJ-FndBJNNBNDUEDsDBUvwoVExZpnXmoJmpY58gE3QQbw3hRGA@mail.gmail.com> <CACYV=-HmOwZ=E8Pw3-mUw0994SbvZaA3eMfcwM0fDTu_zykBJg@mail.gmail.com> <CAJ-FndBmXkyJJ=fCkEpVm84E56A2_EoM6kbch03e4RMEM6WCGQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--zNkIgqbxA+tiK/WQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Jul 30, 2012 at 03:24:26PM +0100, Attilio Rao wrote:
> On 7/30/12, Davide Italiano <davide@freebsd.org> wrote:
> > On Mon, Jul 30, 2012 at 4:02 PM, Attilio Rao <attilio@freebsd.org> wrot=
e:
> > Thanks for the comment, Attilio.
> > Yes, it's exactly what you thought. If direct flag is equal to one
> > you're sure you're processing a callout which runs directly from
> > hardware interrupt context. In this case, the running thread cannot
> > sleep and it's likely you have TDP_NOSLEEPING flags set, failing the
> > KASSERT() in THREAD_NO_SLEEPING() and leading to panic if kernel is
> > compiled with INVARIANTS.
> > In case you're running from SWI context (direct equals to zero) code
> > remains the same as before.
> > I think what I'm doing works due the assumption thread running never
> > sleeps. Do you suggest some other way to handle this?
>=20
> Possibly the quicker way to do this is to have a way to deal with the
> TDP_NOSLEEPING flag in recursed way, thus implement the same logic as
> VFS_LOCK_GIANT() does, for example.
> You will need to change the few callers of THREAD_NO_SLEEPING(), but
> the patch should be no longer than 10/15 lines.

There are already curthread_pflags_set/restore KPI designed exactly to hand=
le
nested private thread flags.

Also, I wonder, should you assert somehow that direct dispatch cannot block
as well ?

--zNkIgqbxA+tiK/WQ
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (FreeBSD)

iEYEARECAAYFAlAWnK8ACgkQC3+MBN1Mb4j5WwCg6LbznxGnAdFUAWhKH4tuWs5/
e7YAnj9sBgT6t3r7sfRJ09cMmmu0Rlq3
=YxNw
-----END PGP SIGNATURE-----

--zNkIgqbxA+tiK/WQ--



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