Date: Fri, 2 Feb 2018 18:10:45 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328802 - stable/11/sys/kern Message-ID: <201802021810.w12IAjnQ014516@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Fri Feb 2 18:10:45 2018 New Revision: 328802 URL: https://svnweb.freebsd.org/changeset/base/328802 Log: Partial MFC of r311039 (by sbruno): - add INVARIANTS debugging hooks to gtaskqueue enqueue (mmacy) Modified: stable/11/sys/kern/subr_gtaskqueue.c Modified: stable/11/sys/kern/subr_gtaskqueue.c ============================================================================== --- stable/11/sys/kern/subr_gtaskqueue.c Fri Feb 2 18:04:57 2018 (r328801) +++ stable/11/sys/kern/subr_gtaskqueue.c Fri Feb 2 18:10:45 2018 (r328802) @@ -101,6 +101,15 @@ struct gtaskqueue { } while (0) #define TQ_ASSERT_UNLOCKED(tq) mtx_assert(&(tq)->tq_mutex, MA_NOTOWNED) +#ifdef INVARIANTS +static void +gtask_dump(struct gtask *gtask) +{ + printf("gtask: %p ta_flags=%x ta_priority=%d ta_func=%p ta_context=%p\n", + gtask, gtask->ta_flags, gtask->ta_priority, gtask->ta_func, gtask->ta_context); +} +#endif + static __inline int TQ_SLEEP(struct gtaskqueue *tq, void *p, struct mtx *m, int pri, const char *wm, int t) @@ -174,6 +183,12 @@ gtaskqueue_free(struct gtaskqueue *queue) int grouptaskqueue_enqueue(struct gtaskqueue *queue, struct gtask *gtask) { +#ifdef INVARIANTS + if (queue == NULL) { + gtask_dump(gtask); + panic("queue == NULL"); + } +#endif TQ_LOCK(queue); if (gtask->ta_flags & TASK_ENQUEUED) { TQ_UNLOCK(queue);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802021810.w12IAjnQ014516>