diff options
author | Tejun Heo <tj@kernel.org> | 2010-10-19 11:24:36 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2011-01-17 00:16:31 -0500 |
commit | f06267104dd9112f11586830d22501d0e26245ea (patch) | |
tree | 8f7c364abc84a5f69269974eaa2b955b24d8f421 /drivers/infiniband/hw | |
parent | 948579cd8c6ea7c8c98c52b79f4470952e182ebd (diff) |
RDMA: Update workqueue usage
* ib_wq is added, which is used as the common workqueue for infiniband
instead of the system workqueue. All system workqueue usages
including flush_scheduled_work() callers are converted to use and
flush ib_wq.
* cancel_delayed_work() + flush_scheduled_work() converted to
cancel_delayed_work_sync().
* qib_wq is removed and ib_wq is used instead.
This is to prepare for deprecation of flush_scheduled_work().
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_driver.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_user_pages.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/hw/qib/qib_iba7220.c | 7 | ||||
-rw-r--r-- | drivers/infiniband/hw/qib/qib_iba7322.c | 14 | ||||
-rw-r--r-- | drivers/infiniband/hw/qib/qib_init.c | 26 | ||||
-rw-r--r-- | drivers/infiniband/hw/qib/qib_qsfp.c | 9 | ||||
-rw-r--r-- | drivers/infiniband/hw/qib/qib_verbs.h | 3 |
7 files changed, 21 insertions, 42 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c index ae92da2d3f56..47db4bf34628 100644 --- a/drivers/infiniband/hw/ipath/ipath_driver.c +++ b/drivers/infiniband/hw/ipath/ipath_driver.c | |||
@@ -755,7 +755,7 @@ static void __devexit ipath_remove_one(struct pci_dev *pdev) | |||
755 | */ | 755 | */ |
756 | ipath_shutdown_device(dd); | 756 | ipath_shutdown_device(dd); |
757 | 757 | ||
758 | flush_scheduled_work(); | 758 | flush_workqueue(ib_wq); |
759 | 759 | ||
760 | if (dd->verbs_dev) | 760 | if (dd->verbs_dev) |
761 | ipath_unregister_ib_device(dd->verbs_dev); | 761 | ipath_unregister_ib_device(dd->verbs_dev); |
diff --git a/drivers/infiniband/hw/ipath/ipath_user_pages.c b/drivers/infiniband/hw/ipath/ipath_user_pages.c index 5e86d73eba2a..bab9f74c0665 100644 --- a/drivers/infiniband/hw/ipath/ipath_user_pages.c +++ b/drivers/infiniband/hw/ipath/ipath_user_pages.c | |||
@@ -220,7 +220,7 @@ void ipath_release_user_pages_on_close(struct page **p, size_t num_pages) | |||
220 | work->mm = mm; | 220 | work->mm = mm; |
221 | work->num_pages = num_pages; | 221 | work->num_pages = num_pages; |
222 | 222 | ||
223 | schedule_work(&work->work); | 223 | queue_work(ib_wq, &work->work); |
224 | return; | 224 | return; |
225 | 225 | ||
226 | bail_mm: | 226 | bail_mm: |
diff --git a/drivers/infiniband/hw/qib/qib_iba7220.c b/drivers/infiniband/hw/qib/qib_iba7220.c index 127a0d5069f0..de799f17cb9e 100644 --- a/drivers/infiniband/hw/qib/qib_iba7220.c +++ b/drivers/infiniband/hw/qib/qib_iba7220.c | |||
@@ -1692,8 +1692,7 @@ static void qib_7220_quiet_serdes(struct qib_pportdata *ppd) | |||
1692 | ppd->lflags &= ~QIBL_IB_AUTONEG_INPROG; | 1692 | ppd->lflags &= ~QIBL_IB_AUTONEG_INPROG; |
1693 | spin_unlock_irqrestore(&ppd->lflags_lock, flags); | 1693 | spin_unlock_irqrestore(&ppd->lflags_lock, flags); |
1694 | wake_up(&ppd->cpspec->autoneg_wait); | 1694 | wake_up(&ppd->cpspec->autoneg_wait); |
1695 | cancel_delayed_work(&ppd->cpspec->autoneg_work); | 1695 | cancel_delayed_work_sync(&ppd->cpspec->autoneg_work); |
1696 | flush_scheduled_work(); | ||
1697 | 1696 | ||
1698 | shutdown_7220_relock_poll(ppd->dd); | 1697 | shutdown_7220_relock_poll(ppd->dd); |
1699 | val = qib_read_kreg64(ppd->dd, kr_xgxs_cfg); | 1698 | val = qib_read_kreg64(ppd->dd, kr_xgxs_cfg); |
@@ -3515,8 +3514,8 @@ static void try_7220_autoneg(struct qib_pportdata *ppd) | |||
3515 | 3514 | ||
3516 | toggle_7220_rclkrls(ppd->dd); | 3515 | toggle_7220_rclkrls(ppd->dd); |
3517 | /* 2 msec is minimum length of a poll cycle */ | 3516 | /* 2 msec is minimum length of a poll cycle */ |
3518 | schedule_delayed_work(&ppd->cpspec->autoneg_work, | 3517 | queue_delayed_work(ib_wq, &ppd->cpspec->autoneg_work, |
3519 | msecs_to_jiffies(2)); | 3518 | msecs_to_jiffies(2)); |
3520 | } | 3519 | } |
3521 | 3520 | ||
3522 | /* | 3521 | /* |
diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c index dbbb0e85afe4..ea46fbc34b17 100644 --- a/drivers/infiniband/hw/qib/qib_iba7322.c +++ b/drivers/infiniband/hw/qib/qib_iba7322.c | |||
@@ -2406,10 +2406,9 @@ static void qib_7322_mini_quiet_serdes(struct qib_pportdata *ppd) | |||
2406 | ppd->lflags &= ~QIBL_IB_AUTONEG_INPROG; | 2406 | ppd->lflags &= ~QIBL_IB_AUTONEG_INPROG; |
2407 | spin_unlock_irqrestore(&ppd->lflags_lock, flags); | 2407 | spin_unlock_irqrestore(&ppd->lflags_lock, flags); |
2408 | wake_up(&ppd->cpspec->autoneg_wait); | 2408 | wake_up(&ppd->cpspec->autoneg_wait); |
2409 | cancel_delayed_work(&ppd->cpspec->autoneg_work); | 2409 | cancel_delayed_work_sync(&ppd->cpspec->autoneg_work); |
2410 | if (ppd->dd->cspec->r1) | 2410 | if (ppd->dd->cspec->r1) |
2411 | cancel_delayed_work(&ppd->cpspec->ipg_work); | 2411 | cancel_delayed_work_sync(&ppd->cpspec->ipg_work); |
2412 | flush_scheduled_work(); | ||
2413 | 2412 | ||
2414 | ppd->cpspec->chase_end = 0; | 2413 | ppd->cpspec->chase_end = 0; |
2415 | if (ppd->cpspec->chase_timer.data) /* if initted */ | 2414 | if (ppd->cpspec->chase_timer.data) /* if initted */ |
@@ -2706,7 +2705,7 @@ static noinline void unknown_7322_gpio_intr(struct qib_devdata *dd) | |||
2706 | if (!(pins & mask)) { | 2705 | if (!(pins & mask)) { |
2707 | ++handled; | 2706 | ++handled; |
2708 | qd->t_insert = get_jiffies_64(); | 2707 | qd->t_insert = get_jiffies_64(); |
2709 | schedule_work(&qd->work); | 2708 | queue_work(ib_wq, &qd->work); |
2710 | } | 2709 | } |
2711 | } | 2710 | } |
2712 | } | 2711 | } |
@@ -4990,8 +4989,8 @@ static void try_7322_autoneg(struct qib_pportdata *ppd) | |||
4990 | set_7322_ibspeed_fast(ppd, QIB_IB_DDR); | 4989 | set_7322_ibspeed_fast(ppd, QIB_IB_DDR); |
4991 | qib_7322_mini_pcs_reset(ppd); | 4990 | qib_7322_mini_pcs_reset(ppd); |
4992 | /* 2 msec is minimum length of a poll cycle */ | 4991 | /* 2 msec is minimum length of a poll cycle */ |
4993 | schedule_delayed_work(&ppd->cpspec->autoneg_work, | 4992 | queue_delayed_work(ib_wq, &ppd->cpspec->autoneg_work, |
4994 | msecs_to_jiffies(2)); | 4993 | msecs_to_jiffies(2)); |
4995 | } | 4994 | } |
4996 | 4995 | ||
4997 | /* | 4996 | /* |
@@ -5121,7 +5120,8 @@ static void try_7322_ipg(struct qib_pportdata *ppd) | |||
5121 | ib_free_send_mad(send_buf); | 5120 | ib_free_send_mad(send_buf); |
5122 | retry: | 5121 | retry: |
5123 | delay = 2 << ppd->cpspec->ipg_tries; | 5122 | delay = 2 << ppd->cpspec->ipg_tries; |
5124 | schedule_delayed_work(&ppd->cpspec->ipg_work, msecs_to_jiffies(delay)); | 5123 | queue_delayed_work(ib_wq, &ppd->cpspec->ipg_work, |
5124 | msecs_to_jiffies(delay)); | ||
5125 | } | 5125 | } |
5126 | 5126 | ||
5127 | /* | 5127 | /* |
diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c index 304bd8038541..ffefb78b8949 100644 --- a/drivers/infiniband/hw/qib/qib_init.c +++ b/drivers/infiniband/hw/qib/qib_init.c | |||
@@ -80,7 +80,6 @@ unsigned qib_wc_pat = 1; /* default (1) is to use PAT, not MTRR */ | |||
80 | module_param_named(wc_pat, qib_wc_pat, uint, S_IRUGO); | 80 | module_param_named(wc_pat, qib_wc_pat, uint, S_IRUGO); |
81 | MODULE_PARM_DESC(wc_pat, "enable write-combining via PAT mechanism"); | 81 | MODULE_PARM_DESC(wc_pat, "enable write-combining via PAT mechanism"); |
82 | 82 | ||
83 | struct workqueue_struct *qib_wq; | ||
84 | struct workqueue_struct *qib_cq_wq; | 83 | struct workqueue_struct *qib_cq_wq; |
85 | 84 | ||
86 | static void verify_interrupt(unsigned long); | 85 | static void verify_interrupt(unsigned long); |
@@ -1044,24 +1043,10 @@ static int __init qlogic_ib_init(void) | |||
1044 | if (ret) | 1043 | if (ret) |
1045 | goto bail; | 1044 | goto bail; |
1046 | 1045 | ||
1047 | /* | ||
1048 | * We create our own workqueue mainly because we want to be | ||
1049 | * able to flush it when devices are being removed. We can't | ||
1050 | * use schedule_work()/flush_scheduled_work() because both | ||
1051 | * unregister_netdev() and linkwatch_event take the rtnl lock, | ||
1052 | * so flush_scheduled_work() can deadlock during device | ||
1053 | * removal. | ||
1054 | */ | ||
1055 | qib_wq = create_workqueue("qib"); | ||
1056 | if (!qib_wq) { | ||
1057 | ret = -ENOMEM; | ||
1058 | goto bail_dev; | ||
1059 | } | ||
1060 | |||
1061 | qib_cq_wq = create_singlethread_workqueue("qib_cq"); | 1046 | qib_cq_wq = create_singlethread_workqueue("qib_cq"); |
1062 | if (!qib_cq_wq) { | 1047 | if (!qib_cq_wq) { |
1063 | ret = -ENOMEM; | 1048 | ret = -ENOMEM; |
1064 | goto bail_wq; | 1049 | goto bail_dev; |
1065 | } | 1050 | } |
1066 | 1051 | ||
1067 | /* | 1052 | /* |
@@ -1091,8 +1076,6 @@ bail_unit: | |||
1091 | idr_destroy(&qib_unit_table); | 1076 | idr_destroy(&qib_unit_table); |
1092 | bail_cq_wq: | 1077 | bail_cq_wq: |
1093 | destroy_workqueue(qib_cq_wq); | 1078 | destroy_workqueue(qib_cq_wq); |
1094 | bail_wq: | ||
1095 | destroy_workqueue(qib_wq); | ||
1096 | bail_dev: | 1079 | bail_dev: |
1097 | qib_dev_cleanup(); | 1080 | qib_dev_cleanup(); |
1098 | bail: | 1081 | bail: |
@@ -1116,7 +1099,6 @@ static void __exit qlogic_ib_cleanup(void) | |||
1116 | 1099 | ||
1117 | pci_unregister_driver(&qib_driver); | 1100 | pci_unregister_driver(&qib_driver); |
1118 | 1101 | ||
1119 | destroy_workqueue(qib_wq); | ||
1120 | destroy_workqueue(qib_cq_wq); | 1102 | destroy_workqueue(qib_cq_wq); |
1121 | 1103 | ||
1122 | qib_cpulist_count = 0; | 1104 | qib_cpulist_count = 0; |
@@ -1289,7 +1271,7 @@ static int __devinit qib_init_one(struct pci_dev *pdev, | |||
1289 | 1271 | ||
1290 | if (qib_mini_init || initfail || ret) { | 1272 | if (qib_mini_init || initfail || ret) { |
1291 | qib_stop_timers(dd); | 1273 | qib_stop_timers(dd); |
1292 | flush_scheduled_work(); | 1274 | flush_workqueue(ib_wq); |
1293 | for (pidx = 0; pidx < dd->num_pports; ++pidx) | 1275 | for (pidx = 0; pidx < dd->num_pports; ++pidx) |
1294 | dd->f_quiet_serdes(dd->pport + pidx); | 1276 | dd->f_quiet_serdes(dd->pport + pidx); |
1295 | if (qib_mini_init) | 1277 | if (qib_mini_init) |
@@ -1338,8 +1320,8 @@ static void __devexit qib_remove_one(struct pci_dev *pdev) | |||
1338 | 1320 | ||
1339 | qib_stop_timers(dd); | 1321 | qib_stop_timers(dd); |
1340 | 1322 | ||
1341 | /* wait until all of our (qsfp) schedule_work() calls complete */ | 1323 | /* wait until all of our (qsfp) queue_work() calls complete */ |
1342 | flush_scheduled_work(); | 1324 | flush_workqueue(ib_wq); |
1343 | 1325 | ||
1344 | ret = qibfs_remove(dd); | 1326 | ret = qibfs_remove(dd); |
1345 | if (ret) | 1327 | if (ret) |
diff --git a/drivers/infiniband/hw/qib/qib_qsfp.c b/drivers/infiniband/hw/qib/qib_qsfp.c index 35b3604b691d..3374a52232c1 100644 --- a/drivers/infiniband/hw/qib/qib_qsfp.c +++ b/drivers/infiniband/hw/qib/qib_qsfp.c | |||
@@ -485,7 +485,7 @@ void qib_qsfp_init(struct qib_qsfp_data *qd, | |||
485 | goto bail; | 485 | goto bail; |
486 | /* We see a module, but it may be unwise to look yet. Just schedule */ | 486 | /* We see a module, but it may be unwise to look yet. Just schedule */ |
487 | qd->t_insert = get_jiffies_64(); | 487 | qd->t_insert = get_jiffies_64(); |
488 | schedule_work(&qd->work); | 488 | queue_work(ib_wq, &qd->work); |
489 | bail: | 489 | bail: |
490 | return; | 490 | return; |
491 | } | 491 | } |
@@ -493,10 +493,9 @@ bail: | |||
493 | void qib_qsfp_deinit(struct qib_qsfp_data *qd) | 493 | void qib_qsfp_deinit(struct qib_qsfp_data *qd) |
494 | { | 494 | { |
495 | /* | 495 | /* |
496 | * There is nothing to do here for now. our | 496 | * There is nothing to do here for now. our work is scheduled |
497 | * work is scheduled with schedule_work(), and | 497 | * with queue_work(), and flush_workqueue() from remove_one |
498 | * flush_scheduled_work() from remove_one will | 498 | * will block until all work setup with queue_work() |
499 | * block until all work ssetup with schedule_work() | ||
500 | * completes. | 499 | * completes. |
501 | */ | 500 | */ |
502 | } | 501 | } |
diff --git a/drivers/infiniband/hw/qib/qib_verbs.h b/drivers/infiniband/hw/qib/qib_verbs.h index 63b22a9a7feb..95e5b47223b3 100644 --- a/drivers/infiniband/hw/qib/qib_verbs.h +++ b/drivers/infiniband/hw/qib/qib_verbs.h | |||
@@ -805,7 +805,6 @@ static inline int qib_send_ok(struct qib_qp *qp) | |||
805 | !(qp->s_flags & QIB_S_ANY_WAIT_SEND)); | 805 | !(qp->s_flags & QIB_S_ANY_WAIT_SEND)); |
806 | } | 806 | } |
807 | 807 | ||
808 | extern struct workqueue_struct *qib_wq; | ||
809 | extern struct workqueue_struct *qib_cq_wq; | 808 | extern struct workqueue_struct *qib_cq_wq; |
810 | 809 | ||
811 | /* | 810 | /* |
@@ -814,7 +813,7 @@ extern struct workqueue_struct *qib_cq_wq; | |||
814 | static inline void qib_schedule_send(struct qib_qp *qp) | 813 | static inline void qib_schedule_send(struct qib_qp *qp) |
815 | { | 814 | { |
816 | if (qib_send_ok(qp)) | 815 | if (qib_send_ok(qp)) |
817 | queue_work(qib_wq, &qp->s_work); | 816 | queue_work(ib_wq, &qp->s_work); |
818 | } | 817 | } |
819 | 818 | ||
820 | static inline int qib_pkey_ok(u16 pkey1, u16 pkey2) | 819 | static inline int qib_pkey_ok(u16 pkey1, u16 pkey2) |