Home | History | Annotate | Download | only in kern

Lines Matching refs:psref

45  *	space, a struct psref object.  Sleeping while a passive
78 #include <sys/psref.h>
83 SLIST_HEAD(psref_head, psref);
121 struct psref *prdi_psref;
130 static void psref_debug_acquire(struct psref *);
131 static void psref_debug_release(struct psref *);
231 psref_exist(struct psref_cpu *pcpu, struct psref *psref)
233 struct psref *_psref;
236 if (_psref == psref)
243 psref_check_duplication(struct psref_cpu *pcpu, struct psref *psref,
248 found = psref_exist(pcpu, psref);
250 panic("The psref is already in the list (acquiring twice?): "
251 "psref=%p target=%p", psref, target);
256 psref_check_existence(struct psref_cpu *pcpu, struct psref *psref,
261 found = psref_exist(pcpu, psref);
263 panic("The psref isn't in the list (releasing unused psref?): "
264 "psref=%p target=%p", psref, target);
270 * psref_acquire(psref, target, class)
284 psref_acquire(struct psref *psref, const struct psref_target *target,
295 KASSERTMSG(!target->prt_draining, "psref target already destroyed: %p",
298 "mismatched psref target class: %p (ref) != %p (expected)",
306 /* Sanity-check if the target is already acquired with the same psref. */
307 psref_check_duplication(pcpu, psref, target);
311 SLIST_INSERT_HEAD(&pcpu->pcpu_head, psref, psref_entry);
312 psref->psref_target = target;
313 psref->psref_lwp = curlwp;
314 psref->psref_cpu = curcpu();
324 psref_debug_acquire(psref);
329 * psref_release(psref, target, class)
338 psref_release(struct psref *psref, const struct psref_target *target,
350 "mismatched psref target class: %p (ref) != %p (expected)",
353 /* Make sure the psref looks sensible. */
354 KASSERTMSG((psref->psref_target == target),
356 psref->psref_target, target);
357 KASSERTMSG((psref->psref_lwp == curlwp),
359 psref->psref_lwp, curlwp);
360 KASSERTMSG((psref->psref_cpu == curcpu()),
362 cpu_index(psref->psref_cpu), cpu_index(curcpu()));
365 * Block interrupts and remove the psref from the current CPU's
374 psref_check_existence(pcpu, psref, target);
376 SLIST_REMOVE(&pcpu->pcpu_head, psref, psref, psref_entry);
385 psref_debug_release(psref);
405 psref_copy(struct psref *pto, const struct psref *pfrom,
428 "mismatched psref target class: %p (ref) != %p (expected)",
453 * Global state for draining a psref target.
467 * If we hold a psref to the target, then answer true.
493 * Ask all CPUs to say whether they hold a psref to the
518 KASSERTMSG(!target->prt_draining, "psref target already destroyed: %p",
521 "mismatched psref target class: %p (ref) != %p (expected)",
550 const struct psref *psref;
560 "mismatched psref target class: %p (ref) != %p (expected)",
568 SLIST_FOREACH(psref, &pcpu->pcpu_head, psref_entry) {
570 KASSERTMSG((psref->psref_cpu == curcpu()),
572 cpu_index(psref->psref_cpu), cpu_index(curcpu()));
575 if (psref->psref_target != target)
584 KASSERTMSG((lwp_mismatch_ok || psref->psref_lwp == curlwp),
586 psref->psref_lwp, curlwp);
632 psref_debug_acquire(struct psref *psref)
640 psref->psref_debug = NULL;
654 prdi->prdi_caller = psref->psref_debug;
655 prdi->prdi_psref = psref;
656 psref->psref_debug = prdi;
665 psref_debug_release(struct psref *psref)
670 if (__predict_true(psref->psref_debug != NULL)) {
671 struct psref_debug_item *prdi = psref->psref_debug;
693 panic("psref leaked: lwp(%p) acquired at %p", l, prdi->prdi_caller);