tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: passive references



   Date: Tue, 9 Feb 2016 20:33:51 +0900
   From: Kengo NAKAHARA <k-nakahara%iij.ad.jp@localhost>

   Is "target->prt_draining = false;" required at the end of psref_target_drain()?
   Or, shouldn't psref_target_drain() be called twice?
   My kernel paniced with the following message.
   ====================
   kernel diagnostic assertion "!target->prt_draining" failed: file "sys/kern/subr_psref.c", line 395
   ====================

You shouldn't call psref_target_drain twice, unless you have already
called psref_target_destroy and psref_target_init again.  You should:

1. Guarantee that no new references can be made.  For example, remove
the object in question from a list.

2. Call psref_target_drain (once) to wait for existing references to
drain.

3. Call psref_target_destroy to destroy the psref target.

See the updated example I gave here for illustration:
<https://mail-index.netbsd.org/tech-kern/2016/02/09/msg020184.html>.

   I am implementing ip_encap with passive reference. I use passive reference
   to exclude encaptab list because ep->func (in encap[46]_lookup) can sleep.

Cool!


Home | Main Index | Thread Index | Old Index