xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Stodden <daniel.stodden@citrix.com>
To: Xen <xen-devel@lists.xensource.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>, Tom Kopec <tek@acm.org>,
	Daniel Stodden <daniel.stodden@citrix.com>
Subject: [PATCH] blkfront: Move blkif_interrupt into a tasklet.
Date: Sun, 22 Aug 2010 23:54:30 -0700	[thread overview]
Message-ID: <1282546470-5547-2-git-send-email-daniel.stodden@citrix.com> (raw)
In-Reply-To: <1282546470-5547-1-git-send-email-daniel.stodden@citrix.com>

Response processing doesn't really belong into hard irq context.

Another potential problem this avoids is that switching interrupt cpu
affinity in Xen domains can presently lead to event loss, if
RING_FINAL_CHECK is run from hard irq context.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
Cc: Tom Kopec <tek@acm.org>
---
 drivers/block/xen-blkfront.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 6c00538..75576d3 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -86,6 +86,7 @@ struct blkfront_info
 	struct blkif_front_ring ring;
 	struct scatterlist sg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
 	unsigned int evtchn, irq;
+	struct tasklet_struct tasklet;
 	struct request_queue *rq;
 	struct work_struct work;
 	struct gnttab_free_callback callback;
@@ -676,13 +677,14 @@ static void blkif_completion(struct blk_shadow *s)
 		gnttab_end_foreign_access(s->req.seg[i].gref, 0, 0UL);
 }
 
-static irqreturn_t blkif_interrupt(int irq, void *dev_id)
+static void
+blkif_do_interrupt(unsigned long data)
 {
+	struct blkfront_info *info = (struct blkfront_info *)data;
 	struct request *req;
 	struct blkif_response *bret;
 	RING_IDX i, rp;
 	unsigned long flags;
-	struct blkfront_info *info = (struct blkfront_info *)dev_id;
 	int error;
 
 	spin_lock_irqsave(&info->io_lock, flags);
@@ -743,6 +745,15 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id)
 
 out:
 	spin_unlock_irqrestore(&info->io_lock, flags);
+}
+
+
+static irqreturn_t
+blkif_interrupt(int irq, void *dev_id)
+{
+	struct blkfront_info *info = (struct blkfront_info *)dev_id;
+
+	tasklet_schedule(&info->tasklet);
 
 	return IRQ_HANDLED;
 }
@@ -893,6 +904,7 @@ static int blkfront_probe(struct xenbus_device *dev,
 	info->connected = BLKIF_STATE_DISCONNECTED;
 	INIT_WORK(&info->work, blkif_restart_queue);
 	spin_lock_init(&info->io_lock);
+	tasklet_init(&info->tasklet, blkif_do_interrupt, (unsigned long)info);
 
 	for (i = 0; i < BLK_RING_SIZE; i++)
 		info->shadow[i].req.id = i+1;
-- 
1.7.0.4

  reply	other threads:[~2010-08-23  6:54 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-23  6:54 Fix the occasional xen-blkfront deadlock, when irqbalancing Daniel Stodden
2010-08-23  6:54 ` Daniel Stodden [this message]
2010-08-23  7:01   ` [PATCH] blkfront: Move blkif_interrupt into a tasklet Daniel Stodden
2010-09-02 22:46   ` Jeremy Fitzhardinge
2010-09-02 23:08     ` Daniel Stodden
2010-09-07  1:39       ` blktap lockdep hiccup Jeremy Fitzhardinge
2010-09-07  1:46         ` Daniel Stodden
2010-09-08  2:03       ` [PATCH] blkfront: Move blkif_interrupt into a tasklet Jeremy Fitzhardinge
2010-09-08  2:21         ` Daniel Stodden
2010-09-08  6:37           ` Jeremy Fitzhardinge
2010-09-23 16:08     ` Andrew Jones
2010-09-23 16:23       ` Jeremy Fitzhardinge
2010-09-23 16:38         ` Paolo Bonzini
2010-09-23 18:36           ` Jeremy Fitzhardinge
2010-09-24  7:14             ` Andrew Jones
2010-09-24 18:50               ` Jeremy Fitzhardinge
2010-09-27  7:41                 ` Andrew Jones
2010-09-27  9:46                   ` Daniel Stodden
2010-09-27 10:21                     ` Andrew Jones
2011-08-16 11:26             ` imammedo
2011-08-16 14:57               ` Konrad Rzeszutek Wilk
2011-08-17  2:38               ` Konrad Rzeszutek Wilk
2011-08-17  7:30                 ` Paolo Bonzini
2011-08-17  9:07                 ` Igor Mammedov
2011-08-24 15:36                   ` Konrad Rzeszutek Wilk
2011-08-24 16:36                     ` Igor Mammedov
2011-08-29 19:46                       ` Konrad Rzeszutek Wilk
2011-08-31 23:47                         ` [PATCH] xen: x86_32: do not enable iterrupts when returning from exception in interrupt context Igor Mammedov
2011-08-31 22:37                           ` Jeremy Fitzhardinge
2011-09-01  8:19                             ` Igor Mammedov
2011-09-01 11:46                             ` [PATCH v2] " Igor Mammedov
2011-09-01 15:45                               ` Konrad Rzeszutek Wilk
2011-09-01 16:46                               ` Jeremy Fitzhardinge
2011-09-02  8:18                                 ` Igor Mammedov
2011-09-02 13:40                                   ` Konrad Rzeszutek Wilk
2011-09-02 14:01                                     ` [Xen-devel] " Igor Mammedov
2011-09-02 14:47                                       ` Konrad Rzeszutek Wilk
2011-09-06  9:16                                         ` Igor Mammedov
2011-09-02  9:19                               ` Igor Mammedov
2011-09-02 10:00                                 ` Keir Fraser
2010-08-23 21:09 ` Fix the occasional xen-blkfront deadlock, when irqbalancing Jeremy Fitzhardinge

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=1282546470-5547-2-git-send-email-daniel.stodden@citrix.com \
    --to=daniel.stodden@citrix.com \
    --cc=jeremy@goop.org \
    --cc=tek@acm.org \
    --cc=xen-devel@lists.xensource.com \
    /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).