linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: linux-rdma@vger.kernel.org
Cc: sagig@dev.mellanox.co.il, bart.vanassche@sandisk.com,
	axboe@fb.com, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 03/13] irq_poll: fold irq_poll_sched_prep into irq_poll_sched
Date: Mon,  7 Dec 2015 12:51:42 -0800	[thread overview]
Message-ID: <1449521512-22921-4-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1449521512-22921-1-git-send-email-hch@lst.de>

There is no good reason to keep them apart, and this makes using the API
a bit simpler.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/scsi/be2iscsi/be_main.c |  6 ++----
 drivers/scsi/ipr.c              |  3 +--
 include/linux/irq_poll.h        | 13 -------------
 lib/irq_poll.c                  | 10 +++++++---
 4 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 471e2b9..cb9072a8 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -910,8 +910,7 @@ static irqreturn_t be_isr_msix(int irq, void *dev_id)
 	num_eq_processed = 0;
 	while (eqe->dw[offsetof(struct amap_eq_entry, valid) / 32]
 				& EQE_VALID_MASK) {
-		if (!irq_poll_sched_prep(&pbe_eq->iopoll))
-			irq_poll_sched(&pbe_eq->iopoll);
+		irq_poll_sched(&pbe_eq->iopoll);
 
 		AMAP_SET_BITS(struct amap_eq_entry, valid, eqe, 0);
 		queue_tail_inc(eq);
@@ -972,8 +971,7 @@ static irqreturn_t be_isr(int irq, void *dev_id)
 			spin_unlock_irqrestore(&phba->isr_lock, flags);
 			num_mcceq_processed++;
 		} else {
-			if (!irq_poll_sched_prep(&pbe_eq->iopoll))
-				irq_poll_sched(&pbe_eq->iopoll);
+			irq_poll_sched(&pbe_eq->iopoll);
 			num_ioeq_processed++;
 		}
 		AMAP_SET_BITS(struct amap_eq_entry, valid, eqe, 0);
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 402e4ca..82031e0 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -5692,8 +5692,7 @@ static irqreturn_t ipr_isr_mhrrq(int irq, void *devp)
 	if (ioa_cfg->iopoll_weight && ioa_cfg->sis64 && ioa_cfg->nvectors > 1) {
 		if ((be32_to_cpu(*hrrq->hrrq_curr) & IPR_HRRQ_TOGGLE_BIT) ==
 		       hrrq->toggle_bit) {
-			if (!irq_poll_sched_prep(&hrrq->iopoll))
-				irq_poll_sched(&hrrq->iopoll);
+			irq_poll_sched(&hrrq->iopoll);
 			spin_unlock_irqrestore(hrrq->lock, hrrq_flags);
 			return IRQ_HANDLED;
 		}
diff --git a/include/linux/irq_poll.h b/include/linux/irq_poll.h
index 0cf7c26..73d7c20 100644
--- a/include/linux/irq_poll.h
+++ b/include/linux/irq_poll.h
@@ -18,19 +18,6 @@ enum {
 	IRQ_POLL_F_DISABLE	= 1,
 };
 
-/*
- * Returns 0 if we successfully set the IRQ_POLL_F_SCHED bit, indicating
- * that we were the first to acquire this iop for scheduling. If this iop
- * is currently disabled, return "failure".
- */
-static inline int irq_poll_sched_prep(struct irq_poll *iop)
-{
-	if (!test_bit(IRQ_POLL_F_DISABLE, &iop->state))
-		return test_and_set_bit(IRQ_POLL_F_SCHED, &iop->state);
-
-	return 1;
-}
-
 static inline int irq_poll_disable_pending(struct irq_poll *iop)
 {
 	return test_bit(IRQ_POLL_F_DISABLE, &iop->state);
diff --git a/lib/irq_poll.c b/lib/irq_poll.c
index 88af879..13cb149 100644
--- a/lib/irq_poll.c
+++ b/lib/irq_poll.c
@@ -21,13 +21,17 @@ static DEFINE_PER_CPU(struct list_head, blk_cpu_iopoll);
  *
  * Description:
  *     Add this irq_poll structure to the pending poll list and trigger the
- *     raise of the blk iopoll softirq. The driver must already have gotten a
- *     successful return from irq_poll_sched_prep() before calling this.
+ *     raise of the blk iopoll softirq.
  **/
 void irq_poll_sched(struct irq_poll *iop)
 {
 	unsigned long flags;
 
+	if (test_bit(IRQ_POLL_F_DISABLE, &iop->state))
+		return;
+	if (!test_and_set_bit(IRQ_POLL_F_SCHED, &iop->state))
+		return;
+
 	local_irq_save(flags);
 	list_add_tail(&iop->list, this_cpu_ptr(&blk_cpu_iopoll));
 	__raise_softirq_irqoff(IRQ_POLL_SOFTIRQ);
@@ -58,7 +62,7 @@ EXPORT_SYMBOL(__irq_poll_complete);
  * Description:
  *     If a driver consumes less than the assigned budget in its run of the
  *     iopoll handler, it'll end the polled mode by calling this function. The
- *     iopoll handler will not be invoked again before irq_poll_sched_prep()
+ *     iopoll handler will not be invoked again before irq_poll_schedp()
  *     is called.
  **/
 void irq_poll_complete(struct irq_poll *iop)
-- 
1.9.1

  parent reply	other threads:[~2015-12-07 20:51 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-07 20:51 completion queue abstraction V2 Christoph Hellwig
2015-12-07 20:51 ` [PATCH 01/13] irq_poll: make blk-iopoll available outside the block layer Christoph Hellwig
2015-12-10 18:41   ` Bart Van Assche
2015-12-07 20:51 ` [PATCH 02/13] irq_poll: don't disable new irq_poll instances Christoph Hellwig
2015-12-10 18:41   ` Bart Van Assche
2015-12-07 20:51 ` Christoph Hellwig [this message]
2015-12-10 18:41   ` [PATCH 03/13] irq_poll: fold irq_poll_sched_prep into irq_poll_sched Bart Van Assche
     [not found]   ` <1449521512-22921-4-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2015-12-29  9:54     ` Bart Van Assche
     [not found]       ` <5682584A.5030708-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-12-30  9:42         ` Christoph Hellwig
     [not found]           ` <20151230094253.GB12904-jcswGhMUV9g@public.gmane.org>
2016-01-20  7:02             ` Andrew Donnellan
     [not found]               ` <569F3106.7000205-8fk3Idey6ehBDgjK7y7TUQ@public.gmane.org>
2016-01-20  7:15                 ` Andrew Donnellan
     [not found] ` <1449521512-22921-1-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2015-12-07 20:51   ` [PATCH 04/13] irq_poll: fold irq_poll_disable_pending into irq_poll_softirq Christoph Hellwig
2015-12-10 18:41     ` Bart Van Assche
2015-12-13 10:25   ` completion queue abstraction V2 Sagi Grimberg
2015-12-07 20:51 ` [PATCH 05/13] irq_poll: mark __irq_poll_complete static Christoph Hellwig
2015-12-10 18:42   ` Bart Van Assche
2015-12-07 20:51 ` [PATCH 06/13] irq_poll: remove unused data and max fields Christoph Hellwig
     [not found]   ` <1449521512-22921-7-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2015-12-10 18:42     ` Bart Van Assche
2015-12-07 20:51 ` [PATCH 07/13] IB: add a proper completion queue abstraction Christoph Hellwig
2015-12-10 18:42   ` Bart Van Assche
2015-12-11 14:17     ` Christoph Hellwig
     [not found]   ` <1449521512-22921-8-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-01-15 13:54     ` Parav Pandit
2016-01-17  9:24       ` Sagi Grimberg
     [not found]         ` <569B5DE3.1010908-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-01-17 11:01           ` Parav Pandit
2016-01-17 11:06             ` Sagi Grimberg
2016-01-17 11:09               ` Parav Pandit
2015-12-07 20:51 ` [PATCH 08/13] IB/srpt: chain RDMA READ/WRITE requests Christoph Hellwig
2015-12-10 18:42   ` Bart Van Assche
2015-12-29  9:58   ` Bart Van Assche
     [not found]     ` <56825940.5070404-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-12-30  9:43       ` Christoph Hellwig
2015-12-07 20:51 ` [PATCH 09/13] IB/srpt: use the new CQ API Christoph Hellwig
2015-12-10 18:42   ` Bart Van Assche
2015-12-07 20:51 ` [PATCH 10/13] IB/srp: " Christoph Hellwig
2015-12-10 18:42   ` Bart Van Assche
2015-12-11 14:22     ` Christoph Hellwig
     [not found]       ` <20151211142220.GB20201-jcswGhMUV9g@public.gmane.org>
2015-12-11 17:59         ` Doug Ledford
2015-12-12  8:08           ` Christoph Hellwig
     [not found]             ` <20151212080833.GA32638-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-12-13 10:26               ` Sagi Grimberg
2015-12-14 16:26                 ` Doug Ledford
2015-12-07 20:51 ` [PATCH 11/13] IB/iser: Use a dedicated descriptor for login Christoph Hellwig
2015-12-07 20:51 ` [PATCH 12/13] IB/iser: Use helper for container_of Christoph Hellwig
2015-12-07 20:51 ` [PATCH 13/13] IB/iser: Convert to CQ abstraction Christoph Hellwig
2015-12-23 19:44 ` completion queue abstraction V2 Doug Ledford
2015-12-29  9:51 ` Bart Van Assche

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=1449521512-22921-4-git-send-email-hch@lst.de \
    --to=hch@lst.de \
    --cc=axboe@fb.com \
    --cc=bart.vanassche@sandisk.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sagig@dev.mellanox.co.il \
    /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).