From: Jens Axboe <jens.axboe@oracle.com>
To: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Cc: dm-devel@redhat.com, mchristi@redhat.com,
linux-kernel@vger.kernel.org, agk@redhat.com
Subject: Re: [RFC PATCH 1/8] rqbased-dm: allow blk_get_request() to be called from interrupt context
Date: Wed, 20 Dec 2006 14:48:49 +0100 [thread overview]
Message-ID: <20061220134848.GF10535@kernel.dk> (raw)
In-Reply-To: <20061219.171119.18572687.k-ueda@ct.jp.nec.com>
On Tue, Dec 19 2006, Kiyoshi Ueda wrote:
> Currently, blk_get_request() is not ready for being called from
> interrupt context because it enables interrupt forcibly in it.
>
> Request-based device-mapper sometimes needs to get a request
> in interrupt context to create a clone.
> Calling blk_get_request() from interrupt context should be OK
> because blk_get_request() returns NULL without sleep if no memory
> unless __GFP_WAIT mask is specified, and then the interrupt context
> can plug queue to retry after and return immediately.
>
> So this patch allows blk_get_request() to be called from interrupt
> context by save/restore current state of irq.
>
>
> Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
> Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
>
> diff -rupN 2.6.19.1/block/ll_rw_blk.c 1-blk-get-request-irqrestore/block/ll_rw_blk.c
> --- 2.6.19.1/block/ll_rw_blk.c 2006-12-11 14:32:53.000000000 -0500
> +++ 1-blk-get-request-irqrestore/block/ll_rw_blk.c 2006-12-15 10:21:29.000000000 -0500
> @@ -2064,9 +2064,10 @@ static void freed_request(request_queue_
> * Get a free request, queue_lock must be held.
> * Returns NULL on failure, with queue_lock held.
> * Returns !NULL on success, with queue_lock *not held*.
> + * If flags is given, the irq state is kept when unlocking the queue_lock.
> */
> static struct request *get_request(request_queue_t *q, int rw, struct bio *bio,
> - gfp_t gfp_mask)
> + gfp_t gfp_mask, unsigned long *flags)
> {
> struct request *rq = NULL;
> struct request_list *rl = &q->rq;
> @@ -2119,7 +2120,10 @@ static struct request *get_request(reque
> if (priv)
> rl->elvpriv++;
>
> - spin_unlock_irq(q->queue_lock);
> + if (flags)
> + spin_unlock_irqrestore(q->queue_lock, *flags);
> + else
> + spin_unlock_irq(q->queue_lock);
Big NACK on this - it's not only really ugly, it's also buggy to pass
interrupt flags as function arguments. As you also mention in the 0/1
mail, this also breaks CFQ.
Why do you need in-interrupt request allocation?
--
Jens Axboe
WARNING: multiple messages have this Message-ID (diff)
From: Jens Axboe <jens.axboe@oracle.com>
To: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Cc: agk@redhat.com, mchristi@redhat.com,
linux-kernel@vger.kernel.org, dm-devel@redhat.com,
j-nomura@ce.jp.nec.com
Subject: Re: [RFC PATCH 1/8] rqbased-dm: allow blk_get_request() to be called from interrupt context
Date: Wed, 20 Dec 2006 14:48:49 +0100 [thread overview]
Message-ID: <20061220134848.GF10535@kernel.dk> (raw)
In-Reply-To: <20061219.171119.18572687.k-ueda@ct.jp.nec.com>
On Tue, Dec 19 2006, Kiyoshi Ueda wrote:
> Currently, blk_get_request() is not ready for being called from
> interrupt context because it enables interrupt forcibly in it.
>
> Request-based device-mapper sometimes needs to get a request
> in interrupt context to create a clone.
> Calling blk_get_request() from interrupt context should be OK
> because blk_get_request() returns NULL without sleep if no memory
> unless __GFP_WAIT mask is specified, and then the interrupt context
> can plug queue to retry after and return immediately.
>
> So this patch allows blk_get_request() to be called from interrupt
> context by save/restore current state of irq.
>
>
> Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
> Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
>
> diff -rupN 2.6.19.1/block/ll_rw_blk.c 1-blk-get-request-irqrestore/block/ll_rw_blk.c
> --- 2.6.19.1/block/ll_rw_blk.c 2006-12-11 14:32:53.000000000 -0500
> +++ 1-blk-get-request-irqrestore/block/ll_rw_blk.c 2006-12-15 10:21:29.000000000 -0500
> @@ -2064,9 +2064,10 @@ static void freed_request(request_queue_
> * Get a free request, queue_lock must be held.
> * Returns NULL on failure, with queue_lock held.
> * Returns !NULL on success, with queue_lock *not held*.
> + * If flags is given, the irq state is kept when unlocking the queue_lock.
> */
> static struct request *get_request(request_queue_t *q, int rw, struct bio *bio,
> - gfp_t gfp_mask)
> + gfp_t gfp_mask, unsigned long *flags)
> {
> struct request *rq = NULL;
> struct request_list *rl = &q->rq;
> @@ -2119,7 +2120,10 @@ static struct request *get_request(reque
> if (priv)
> rl->elvpriv++;
>
> - spin_unlock_irq(q->queue_lock);
> + if (flags)
> + spin_unlock_irqrestore(q->queue_lock, *flags);
> + else
> + spin_unlock_irq(q->queue_lock);
Big NACK on this - it's not only really ugly, it's also buggy to pass
interrupt flags as function arguments. As you also mention in the 0/1
mail, this also breaks CFQ.
Why do you need in-interrupt request allocation?
--
Jens Axboe
next prev parent reply other threads:[~2006-12-20 13:48 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-19 22:11 [RFC PATCH 1/8] rqbased-dm: allow blk_get_request() to be called from interrupt context Kiyoshi Ueda
2006-12-19 22:11 ` Kiyoshi Ueda
2006-12-20 13:48 ` Jens Axboe [this message]
2006-12-20 13:48 ` Jens Axboe
2006-12-20 17:50 ` Kiyoshi Ueda
2006-12-20 17:50 ` Kiyoshi Ueda
2006-12-20 18:49 ` Jens Axboe
2006-12-20 18:49 ` Jens Axboe
2006-12-20 21:55 ` Kiyoshi Ueda
2006-12-20 21:55 ` Kiyoshi Ueda
2006-12-21 7:53 ` Jens Axboe
2006-12-21 7:53 ` Jens Axboe
2006-12-21 17:59 ` Mike Christie
2006-12-21 17:59 ` [dm-devel] " Mike Christie
2006-12-21 18:13 ` Mike Christie
2006-12-21 18:13 ` [dm-devel] " Mike Christie
2006-12-21 18:24 ` Jens Axboe
2006-12-21 18:24 ` [dm-devel] " Jens Axboe
2006-12-21 18:30 ` Mike Christie
2006-12-21 18:30 ` [dm-devel] " Mike Christie
2006-12-21 18:36 ` Mike Christie
2006-12-21 18:36 ` [dm-devel] " Mike Christie
2006-12-21 18:42 ` Jens Axboe
2006-12-21 18:42 ` [dm-devel] " Jens Axboe
2006-12-21 18:57 ` Mike Christie
2006-12-21 18:57 ` [dm-devel] " Mike Christie
2006-12-21 19:19 ` Jens Axboe
2006-12-21 19:19 ` [dm-devel] " Jens Axboe
2006-12-21 22:22 ` Mike Christie
2006-12-21 22:22 ` [dm-devel] " Mike Christie
2006-12-21 18:40 ` Jens Axboe
2006-12-21 18:40 ` [dm-devel] " Jens Axboe
2006-12-21 18:11 ` Kiyoshi Ueda
2006-12-21 18:11 ` Kiyoshi Ueda
2006-12-21 18:21 ` Jens Axboe
2006-12-21 18:21 ` Jens Axboe
2006-12-20 19:11 ` Chen, Kenneth W
2006-12-20 19:11 ` Chen, Kenneth W
2006-12-20 19:17 ` Jens Axboe
2006-12-20 19:17 ` Jens Axboe
2006-12-22 14:01 ` Christoph Hellwig
2006-12-22 14:01 ` Christoph Hellwig
2006-12-22 17:32 ` Jens Axboe
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=20061220134848.GF10535@kernel.dk \
--to=jens.axboe@oracle.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=k-ueda@ct.jp.nec.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mchristi@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.