From owner-freebsd-arch@FreeBSD.ORG Thu Nov 13 02:13:57 2014 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DBBB3C4B for ; Thu, 13 Nov 2014 02:13:57 +0000 (UTC) Received: from mail-wg0-x235.google.com (mail-wg0-x235.google.com [IPv6:2a00:1450:400c:c00::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 70E78BEA for ; Thu, 13 Nov 2014 02:13:57 +0000 (UTC) Received: by mail-wg0-f53.google.com with SMTP id b13so15691530wgh.40 for ; Wed, 12 Nov 2014 18:13:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=zoA9XYvg8iavRLC0byKYEwbPEGLYvv8OrqkQgsBNoVs=; b=MiqWGLBHdaeufIrjqM6TWa9CUnVpVJ1OAFsfdBk4u30NN/LqEnB2eunGKVgvo+d3UZ XtNgDzQXo63HRHZQgk20nsH8bqDHuK6ITQe4QAfAqNef3hbzRTzl64kkqY0U3aHi52AU wMMBB++xj/rcSAE/RnPq3EWR4rj7Te/N4huWHZY5N4cKw3byV6hjzSU1LPW2tgySqSzp eRM4Y0clIxS5dFy2m+5CGzVQ5tqSB2QkifB9452VHmKnJq6oiEw36CcDaWIRPcE2XBzw xGFqekQxLXM89W3ngN9O9gbhsZvgOvGDV2x6g4kmAiCiz8j8p1/WWomwXgwYg+v7kDhG JQ/Q== MIME-Version: 1.0 X-Received: by 10.180.87.33 with SMTP id u1mr53972178wiz.20.1415844835816; Wed, 12 Nov 2014 18:13:55 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.216.106.136 with HTTP; Wed, 12 Nov 2014 18:13:55 -0800 (PST) Date: Wed, 12 Nov 2014 18:13:55 -0800 X-Google-Sender-Auth: EKReAbnRxz_sJ9uJVR2K3Rb3Wgs Message-ID: Subject: Questions about locking; turnstiles and sleeping threads From: Adrian Chadd To: "freebsd-arch@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Nov 2014 02:13:57 -0000 Hi, I have a bit of an odd case here. I'm getting panics in the net80211/ath code, "sleeping thread (X) owns non-sleepable lock." show alllocks just showed one lock held - the net80211 comlock. It's a recursive mutex, that's supposed to be sleepable. The two threads in question look like this: thread X: net80211_newstate_cb (grabs IEEE80211_LOCK()) ath_newstate callout_drain - which grabs the ATH_LOCK as part of the callout drain side of things that enters sleepq_wait() and goes to sleep, waiting for whatever's running the callout to finish thread Y: rx_path in if_ath_rx_edma ath_rx_pkt -> sta_input -> ath_recv_mgmt -> sta_recv_mgmt (grabs IEEE80211_LOCK()) -> panics Thread Y doesn't hold any other locks. It's just trying to grab the IEEE80211_LOCK that is being held by thread X. But thread X is asleep waiting for whatever callout to finish so it can continue. The code in propagate_priority() sees that thread X is sleeping and panics. So, what's really going on? I don't mind (well, "don't mind") having to take another deep dive through all of this to sort it out so it doesn't tickle the callout / turnstile code in this particular fashion, but I'd first like to ensure that it's not some corner case that isn't handled by the check in propagate_priority(). Thanks, -adrian