From owner-freebsd-hackers@FreeBSD.ORG Thu Feb 21 22:15:59 2013 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2CDF5FC9 for ; Thu, 21 Feb 2013 22:15:59 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-oa0-f54.google.com (mail-oa0-f54.google.com [209.85.219.54]) by mx1.freebsd.org (Postfix) with ESMTP id F3BC7FF0 for ; Thu, 21 Feb 2013 22:15:58 +0000 (UTC) Received: by mail-oa0-f54.google.com with SMTP id n12so23632oag.27 for ; Thu, 21 Feb 2013 14:15:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=agMl34Dirz7VgnCG+iQVaCWBSuC87j1lzPkjEML/HCo=; b=onJTY+o0ov0UJZ789q5j30jxDhBt+6pIVGmlzK+SW+pVkz2tGf9K5vv6ubLQzUlING uL/ByqMSLPPv5wvibgppcgL4FtUT3DEN3fy8YLWE+qf5rOHkIwLnSa4Zz3bfy4bs3GT2 HVpNYXnRWqYxe+NlpOjxvAksKh+9TMHut5jUSBYbwp26cIoqWA08Pws/8YG15lPpWt6Y xQLR7wE6NdTLwZrG2FZ3VgQDOCvrM2pJlU2ENmQWmE3BuPAWwGn1z0IPLRwqzDTL12mt E79qd3x6ZoDm1Qby+u/bN+CO3VZN8va0y0GdggBwcP9kgQVqRrQ0gtvhS3L+sPKuXOaO QZ2Q== MIME-Version: 1.0 X-Received: by 10.182.112.34 with SMTP id in2mr11700378obb.80.1361484644876; Thu, 21 Feb 2013 14:10:44 -0800 (PST) Received: by 10.76.109.236 with HTTP; Thu, 21 Feb 2013 14:10:44 -0800 (PST) Date: Thu, 21 Feb 2013 17:10:44 -0500 Message-ID: Subject: intr_event_handle never sends EOI if we fail to schedule ithread From: Ryan Stone To: FreeBSD Hackers Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 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: Thu, 21 Feb 2013 22:15:59 -0000 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? [1] http://svnweb.freebsd.org/base?view=revision&revision=239095