This is upstream/xen/blkfront at
git://xenbits.xensource.com/people/dstodden/linux.git
Daniel
On Mon, 2010-08-23 at 02:54 -0400, Daniel Stodden wrote:
> 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@xxxxxxxxxx>
> Cc: Tom Kopec <tek@xxxxxxx>
> ---
> 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;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|