From patchwork Wed Sep 9 20:42:21 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland Dreier X-Patchwork-Id: 46457 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n89KgPhZ002942 for ; Wed, 9 Sep 2009 20:42:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752924AbZIIUmV (ORCPT ); Wed, 9 Sep 2009 16:42:21 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753018AbZIIUmV (ORCPT ); Wed, 9 Sep 2009 16:42:21 -0400 Received: from sj-iport-6.cisco.com ([171.71.176.117]:48534 "EHLO sj-iport-6.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752924AbZIIUmU (ORCPT ); Wed, 9 Sep 2009 16:42:20 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqIGAPevp0qrR7PE/2dsb2JhbACDA8MfiEMBkGEFhBg X-IronPort-AV: E=Sophos;i="4.44,360,1249257600"; d="scan'208";a="385418727" Received: from sj-dkim-4.cisco.com ([171.71.179.196]) by sj-iport-6.cisco.com with ESMTP; 09 Sep 2009 20:42:24 +0000 Received: from sj-core-5.cisco.com (sj-core-5.cisco.com [171.71.177.238]) by sj-dkim-4.cisco.com (8.12.11/8.12.11) with ESMTP id n89KgOEO026671; Wed, 9 Sep 2009 13:42:24 -0700 Received: from xbh-sjc-211.amer.cisco.com (xbh-sjc-211.cisco.com [171.70.151.144]) by sj-core-5.cisco.com (8.13.8/8.14.3) with ESMTP id n89KgNeE025375; Wed, 9 Sep 2009 20:42:24 GMT Received: from xfe-sjc-212.amer.cisco.com ([171.70.151.187]) by xbh-sjc-211.amer.cisco.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 9 Sep 2009 13:42:22 -0700 Received: from roland-conroe ([10.33.42.9]) by xfe-sjc-212.amer.cisco.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 9 Sep 2009 13:42:21 -0700 Received: by roland-conroe (Postfix, from userid 33217) id 735B0E71D8; Wed, 9 Sep 2009 13:42:21 -0700 (PDT) From: Roland Dreier To: Bart Van Assche , Sean Hefty , Hal Rosenstock Cc: linux-rdma@vger.kernel.org, general@lists.openfabrics.org Subject: [PATCH/RFC] IB/mad: Fix lock-lock-timer deadlock in RMPP code (was: [NEW PATCH] IB/mad: Fix possible lock-lock-timer deadlock) References: X-Message-Flag: Warning: May contain useful information Date: Wed, 09 Sep 2009 13:42:21 -0700 In-Reply-To: (Bart Van Assche's message of "Tue, 8 Sep 2009 21:09:42 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.91 (gnu/linux) MIME-Version: 1.0 X-OriginalArrivalTime: 09 Sep 2009 20:42:21.0657 (UTC) FILETIME=[07A0B490:01CA318E] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; l=1487; t=1252528944; x=1253392944; c=relaxed/simple; s=sjdkim4002; h=Content-Type:From:Subject:Content-Transfer-Encoding:MIME-Version; d=cisco.com; i=rdreier@cisco.com; z=From:=20Roland=20Dreier=20 |Subject:=20[PATCH/RFC]=20IB/mad=3A=20Fix=20lock-lock-timer =20deadlock=20in=20RMPP=20code=20(was=3A=20[NEW=20PATCH]=20I B/mad=3A=20Fix=20possible=20lock-lock-timer=20deadlock) |Sender:=20; bh=P98hF5BDc6UfrE0tbvTYqXfLiK8YLADcji3mSpI27hw=; b=ZbYbKjJj74QXpASgOw/899NFYlH0UcN4r7Fc9wt2gX3dZl7iSQeVhfjpfd 0LHpSNjHIMXLzhS+LXHUUVF76avXePfXZdK2EVYIWXuyWATFPZdu+MFmH6Gq R1J1nSBV/h; Authentication-Results: sj-dkim-4; header.From=rdreier@cisco.com; dkim=pass ( sig from cisco.com/sjdkim4002 verified; ); Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Holding agent->lock across cancel_delayed_work() (which does del_timer_sync()) in ib_cancel_rmpp_recvs() leads to lockdep reports of possible lock-timer deadlocks if a consumer ever does something that connects agent->lock to a lock taken in IRQ context (cf http://marc.info/?l=linux-rdma&m=125243699026045). However, it seems this locking is not necessary here, since the locking did not prevent the rmpp_list from having an item added immediately after the lock is dropped -- so there must be sufficient synchronization protecting the rmpp_list without the locking here. Therefore, we can fix the lockdep issue by simply deleting the locking. Hal/Sean, does this look right to you? --- drivers/infiniband/core/mad_rmpp.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/infiniband/core/mad_rmpp.c b/drivers/infiniband/core/mad_rmpp.c index 57a3c6f..865c109 100644 --- a/drivers/infiniband/core/mad_rmpp.c +++ b/drivers/infiniband/core/mad_rmpp.c @@ -85,12 +85,10 @@ void ib_cancel_rmpp_recvs(struct ib_mad_agent_private *agent) struct mad_rmpp_recv *rmpp_recv, *temp_rmpp_recv; unsigned long flags; - spin_lock_irqsave(&agent->lock, flags); list_for_each_entry(rmpp_recv, &agent->rmpp_list, list) { cancel_delayed_work(&rmpp_recv->timeout_work); cancel_delayed_work(&rmpp_recv->cleanup_work); } - spin_unlock_irqrestore(&agent->lock, flags); flush_workqueue(agent->qp_info->port_priv->wq);