From: Jon Mason <jon.mason@intel.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
Dave Jiang <dave.jiang@intel.com>,
Nicholas Bellinger <nab@linux-iscsi.org>
Subject: [PATCH 05/21] NTB: No sleeping in interrupt context
Date: Sat, 19 Jan 2013 02:02:19 -0700 [thread overview]
Message-ID: <1358586155-23322-6-git-send-email-jon.mason@intel.com> (raw)
In-Reply-To: <1358586155-23322-1-git-send-email-jon.mason@intel.com>
Move all cancel_delayed_work_sync to a work thread to prevent sleeping
in interrupt context (when the NTB link goes down). Caught via
'Sleep inside atomic section checking'
Signed-off-by: Jon Mason <jon.mason@intel.com>
---
drivers/ntb/ntb_transport.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
index 2823087..bf7ade1 100644
--- a/drivers/ntb/ntb_transport.c
+++ b/drivers/ntb/ntb_transport.c
@@ -110,6 +110,7 @@ struct ntb_transport_qp {
void (*event_handler) (void *data, int status);
struct delayed_work link_work;
+ struct work_struct link_cleanup;
struct dentry *debugfs_dir;
struct dentry *debugfs_stats;
@@ -148,6 +149,7 @@ struct ntb_transport {
unsigned long qp_bitmap;
bool transport_link;
struct delayed_work link_work;
+ struct work_struct link_cleanup;
struct dentry *debugfs_dir;
};
@@ -510,8 +512,11 @@ static int ntb_set_mw(struct ntb_transport *nt, int num_mw, unsigned int size)
return 0;
}
-static void ntb_qp_link_down(struct ntb_transport_qp *qp)
+static void ntb_qp_link_cleanup(struct work_struct *work)
{
+ struct ntb_transport_qp *qp = container_of(work,
+ struct ntb_transport_qp,
+ link_cleanup);
struct ntb_transport *nt = qp->transport;
struct pci_dev *pdev = ntb_query_pdev(nt->ndev);
@@ -531,8 +536,15 @@ static void ntb_qp_link_down(struct ntb_transport_qp *qp)
msecs_to_jiffies(NTB_LINK_DOWN_TIMEOUT));
}
-static void ntb_transport_conn_down(struct ntb_transport *nt)
+static void ntb_qp_link_down(struct ntb_transport_qp *qp)
+{
+ schedule_work(&qp->link_cleanup);
+}
+
+static void ntb_transport_link_cleanup(struct work_struct *work)
{
+ struct ntb_transport *nt = container_of(work, struct ntb_transport,
+ link_cleanup);
int i;
if (nt->transport_link == NTB_LINK_DOWN)
@@ -562,7 +574,7 @@ static void ntb_transport_event_callback(void *data, enum ntb_hw_event event)
schedule_delayed_work(&nt->link_work, 0);
break;
case NTB_EVENT_HW_LINK_DOWN:
- ntb_transport_conn_down(nt);
+ schedule_work(&nt->link_cleanup);
break;
default:
BUG();
@@ -769,6 +781,7 @@ static void ntb_transport_init_queue(struct ntb_transport *nt,
}
INIT_DELAYED_WORK(&qp->link_work, ntb_qp_link_work);
+ INIT_WORK(&qp->link_cleanup, ntb_qp_link_cleanup);
spin_lock_init(&qp->ntb_rx_pend_q_lock);
spin_lock_init(&qp->ntb_rx_free_q_lock);
@@ -814,6 +827,7 @@ int ntb_transport_init(struct pci_dev *pdev)
ntb_transport_init_queue(nt, i);
INIT_DELAYED_WORK(&nt->link_work, ntb_transport_link_work);
+ INIT_WORK(&nt->link_cleanup, ntb_transport_link_cleanup);
rc = ntb_register_event_callback(nt->ndev,
ntb_transport_event_callback);
--
1.7.9.5
next prev parent reply other threads:[~2013-01-19 9:02 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-19 9:02 [PATCH 0/21] NTB and ntb_netdev patches Jon Mason
2013-01-19 9:02 ` [PATCH 01/21] NTB: correct missing readq/writeq errors Jon Mason
2013-01-20 23:40 ` Greg KH
2013-01-21 17:38 ` Jon Mason
2013-01-21 18:23 ` Greg KH
2013-01-21 20:34 ` Ben Hutchings
2013-01-21 20:47 ` Greg KH
2013-01-19 9:02 ` [PATCH 02/21] NTB: Handle ntb client device probes without present hardware Jon Mason
2013-01-19 9:02 ` [PATCH 03/21] NTB: correct memory barrier Jon Mason
2013-01-19 9:02 ` [PATCH 04/21] NTB: separate transmit and receive windows Jon Mason
2013-01-19 9:02 ` Jon Mason [this message]
2013-01-19 9:02 ` [PATCH 06/21] NTB: use simple_open for debugfs Jon Mason
2013-01-19 9:02 ` [PATCH 07/21] NTB: zero PCI driver data Jon Mason
2013-01-20 23:41 ` Greg KH
2013-01-19 9:02 ` [PATCH 08/21] NTB: declare unused variables Jon Mason
2013-01-20 23:42 ` Greg KH
2013-01-21 17:50 ` Jon Mason
2013-01-21 18:25 ` Greg KH
2013-01-19 9:02 ` [PATCH 09/21] NTB: namespacecheck cleanups Jon Mason
2013-01-19 9:02 ` [PATCH 10/21] NTB: whitespace cleanups Jon Mason
2013-01-19 9:02 ` [PATCH 11/21] NTB: correct stack usage warning in debugfs_read Jon Mason
2013-01-19 9:02 ` [PATCH 12/21] NTB: Remove reads across NTB Jon Mason
2013-01-19 9:02 ` [PATCH 13/21] NTB: Out of free receive entries issue Jon Mason
2013-01-19 9:02 ` [PATCH 14/21] NTB: Fix Sparse Warnings Jon Mason
2013-01-20 23:45 ` Greg KH
2013-01-21 21:13 ` Jon Mason
2013-01-21 21:37 ` Greg KH
2013-01-21 22:28 ` Jon Mason
2013-01-19 9:02 ` [PATCH 15/21] NTB: Update Version Jon Mason
2013-01-20 23:47 ` Greg KH
2013-01-21 17:57 ` Jon Mason
2013-01-21 18:26 ` Greg KH
2013-01-19 9:02 ` [PATCH 16/21] ntb_netdev: remove init/exit from probe/remove Jon Mason
2013-01-19 9:02 ` [PATCH 17/21] ntb_netdev: correct skb leak Jon Mason
2013-01-19 9:02 ` [PATCH 18/21] ntb_netdev: remove tx timeout Jon Mason
2013-01-19 9:02 ` [PATCH 19/21] ntb_netdev: declare unused variables and fix missing initializer Jon Mason
2013-01-20 23:47 ` Greg KH
2013-01-19 9:02 ` [PATCH 20/21] ntb_netdev: improve logging Jon Mason
2013-01-19 18:51 ` Joe Perches
2013-01-19 9:02 ` [PATCH 21/21] ntb_netdev: Update Version Jon Mason
2013-01-20 23:48 ` [PATCH 0/21] NTB and ntb_netdev patches Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1358586155-23322-6-git-send-email-jon.mason@intel.com \
--to=jon.mason@intel.com \
--cc=dave.jiang@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nab@linux-iscsi.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).