Date: Wed, 27 Jan 2010 09:59:08 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r203061 - head/sys/kern Message-ID: <201001270959.o0R9x8YB074696@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Wed Jan 27 09:59:08 2010 New Revision: 203061 URL: http://svn.freebsd.org/changeset/base/203061 Log: KASSERT that return value of interrupt filter complies with contract For example a return value of zero could lead to a stuck level-triggered interrupt line. Reviewed by: jhb (for INTR_FILTER case) MFC after: 3 weeks Modified: head/sys/kern/kern_intr.c Modified: head/sys/kern/kern_intr.c ============================================================================== --- head/sys/kern/kern_intr.c Wed Jan 27 09:45:07 2010 (r203060) +++ head/sys/kern/kern_intr.c Wed Jan 27 09:59:08 2010 (r203061) @@ -1378,6 +1378,12 @@ intr_event_handle(struct intr_event *ie, ret = ih->ih_filter(frame); else ret = ih->ih_filter(ih->ih_argument); + KASSERT(ret == FILTER_STRAY || + ((ret & (FILTER_SCHEDULE_THREAD | FILTER_HANDLED)) != 0 && + (ret & ~(FILTER_SCHEDULE_THREAD | FILTER_HANDLED)) == 0), + ("%s: incorrect return value %#x from %s", __func__, ret, + ih->ih_name)); + /* * Wrapper handler special handling: * @@ -1546,7 +1552,11 @@ intr_filter_loop(struct intr_event *ie, thread_only = 1; continue; } - + KASSERT(ret == FILTER_STRAY || + ((ret & (FILTER_SCHEDULE_THREAD | FILTER_HANDLED)) != 0 && + (ret & ~(FILTER_SCHEDULE_THREAD | FILTER_HANDLED)) == 0), + ("%s: incorrect return value %#x from %s", __func__, ret, + ih->ih_name)); if (ret & FILTER_STRAY) continue; else {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001270959.o0R9x8YB074696>