From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 26 22:09:27 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1F093FB1; Tue, 26 Feb 2013 22:09:27 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id D71B4341; Tue, 26 Feb 2013 22:09:26 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 0F391B95E; Tue, 26 Feb 2013 17:09:26 -0500 (EST) From: John Baldwin To: freebsd-hackers@freebsd.org Subject: Re: intr_event_handle never sends EOI if we fail to schedule ithread Date: Tue, 26 Feb 2013 15:25:48 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p25; KDE/4.5.5; amd64; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201302261525.48603.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 26 Feb 2013 17:09:26 -0500 (EST) Cc: FreeBSD Hackers , Ryan Stone X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Feb 2013 22:09:27 -0000 On Thursday, February 21, 2013 5:10:44 pm Ryan Stone wrote: > I recently saw an issue where all interrupts from a particular interrupt > vector were never raised. After investigating it appears that I ran into > the bug fixed in r239095[1], where an interrupt handler that uses an > ithread was added to the list of interrupt handlers for a particular event > before the ithread was allocated. If an interrupt for this event > (presumably for a different device sharing the same interrupt line) comes > in after the handler is added to the list but before the ithread has been > allocated we hit the following code: > > if (thread) { > if (ie->ie_pre_ithread != NULL) > ie->ie_pre_ithread(ie->ie_source); > } else { > if (ie->ie_post_filter != NULL) > ie->ie_post_filter(ie->ie_source); > } > > /* Schedule the ithread if needed. */ > if (thread) { > error = intr_event_schedule_thread(ie); > #ifndef XEN > KASSERT(error == 0, ("bad stray interrupt")); > #else > if (error != 0) > log(LOG_WARNING, "bad stray interrupt"); > #endif > } > > thread is true, so we will not run ie_post_filter (which would send the > EOI). However because the ithread has not been allocated > intr_event_schedule_thread will return an error. If INVARIANTS is not > defined we skip the KASSERT and return. > > Now, r239095 fixes this scenario, but I think that we should call > ie_post_filter whenever intr_event_schedule_thread fails to ensure that we > don't block an interrupt vector indefinitely. Any comments? Actually, I think you want to call post_ithread as you've already called pre_ithread? Also, pre_ithread should already EOI the interrupt, the problem is that it leaves it masked, and you need to invoke post_ithread to unmask it. -- John Baldwin