Re: [dm-devel] [PATCH V3 04/13] block: create io poll context for submission and poll task

2021-03-24 Thread Ming Lei
On Thu, Mar 25, 2021 at 10:34:02AM +0800, JeffleXu wrote: > > > On 3/24/21 8:19 PM, Ming Lei wrote: > > Create per-task io poll context for both IO submission and poll task > > if the queue is bio based and supports polling. > > > > This io polling context includes two queues: > > > > 1)

Re: [dm-devel] md/dm-mpath: check whether all pgpaths have same uuid in multipath_ctr()

2021-03-24 Thread Zhiqiang Liu
On 2021/3/22 22:22, Mike Snitzer wrote: > On Mon, Mar 22 2021 at 4:11am -0400, > Christoph Hellwig wrote: > >> On Sat, Mar 20, 2021 at 03:19:23PM +0800, Zhiqiang Liu wrote: >>> From: Zhiqiang Liu >>> >>> When we make IO stress test on multipath device, there will >>> be a metadata err

Re: [dm-devel] md/dm-mpath: check whether all pgpaths have same uuid in multipath_ctr()

2021-03-24 Thread Zhiqiang Liu
On 2021/3/24 1:11, Ewan D. Milne wrote: > On Tue, 2021-03-23 at 15:47 +0800, lixiaokeng wrote: >> >> On 2021/3/22 22:22, Mike Snitzer wrote: >>> On Mon, Mar 22 2021 at 4:11am -0400, >>> Christoph Hellwig wrote: >>> On Sat, Mar 20, 2021 at 03:19:23PM +0800, Zhiqiang Liu wrote: > From:

Re: [dm-devel] [PATCH V3 05/13] block: add req flag of REQ_POLL_CTX

2021-03-24 Thread Ming Lei
On Wed, Mar 24, 2021 at 04:32:31PM +0100, Hannes Reinecke wrote: > On 3/24/21 1:19 PM, Ming Lei wrote: > > Add one req flag REQ_POLL_CTX which will be used in the following patch for > > supporting bio based IO polling. > > > > Exactly this flag can help us to do: > > > > 1) request flag is

Re: [dm-devel] [PATCH V3 03/13] block: add helper of blk_create_io_context

2021-03-24 Thread Ming Lei
On Wed, Mar 24, 2021 at 07:17:02PM +0100, Christoph Hellwig wrote: > On Wed, Mar 24, 2021 at 08:19:17PM +0800, Ming Lei wrote: > > Add one helper for creating io context and prepare for supporting > > efficient bio based io poll. > > Looking at what gets added later here I do not think this

Re: [dm-devel] [PATCH V3 01/13] block: add helper of blk_queue_poll

2021-03-24 Thread Christoph Hellwig
On Wed, Mar 24, 2021 at 08:19:15PM +0800, Ming Lei wrote: > There has been 3 users, and will be more, so add one such helper. > > Reviewed-by: Chaitanya Kulkarni > Signed-off-by: Ming Lei Can't say I'm a huge fan of these wrappers that obsfucate what actually is checked here. But it does fit

Re: [dm-devel] [PATCH V3 03/13] block: add helper of blk_create_io_context

2021-03-24 Thread Christoph Hellwig
On Wed, Mar 24, 2021 at 08:19:17PM +0800, Ming Lei wrote: > Add one helper for creating io context and prepare for supporting > efficient bio based io poll. Looking at what gets added later here I do not think this helper is a good idea. Having a separate one for creating any needed poll-only

Re: [dm-devel] [PATCH v3 01/11] pagemap: Introduce ->memory_failure()

2021-03-24 Thread Dan Williams
On Wed, Mar 24, 2021 at 10:39 AM Christoph Hellwig wrote: > > On Wed, Mar 24, 2021 at 09:37:01AM -0700, Dan Williams wrote: > > > Eww. As I said I think the right way is that the file system (or > > > other consumer) can register a set of callbacks for opening the device. > > > > How does that

Re: [dm-devel] [PATCH v3 01/11] pagemap: Introduce ->memory_failure()

2021-03-24 Thread Christoph Hellwig
On Wed, Mar 24, 2021 at 09:37:01AM -0700, Dan Williams wrote: > > Eww. As I said I think the right way is that the file system (or > > other consumer) can register a set of callbacks for opening the device. > > How does that solve the problem of the driver being notified of all > pfn failure

Re: [dm-devel] [PATCH v3 01/11] pagemap: Introduce ->memory_failure()

2021-03-24 Thread Dan Williams
On Wed, Mar 24, 2021 at 12:48 AM Christoph Hellwig wrote: > > On Tue, Mar 23, 2021 at 07:19:28PM -0700, Dan Williams wrote: > > So I think the path forward is: > > > > - teach memory_failure() to allow for ranged failures > > > > - let interested drivers register for memory failure events via a >

Re: [dm-devel] [RFC PATCH V2 09/13] block: use per-task poll context to implement bio based io poll

2021-03-24 Thread Sagi Grimberg
Well, when it will failover, it will probably be directed to the poll queues. Maybe I'm missing something... In this patchset, because it isn't submitted directly from FS, there isn't one polling context associated with this bio, so its HIPRI flag will be cleared, then fallback to irq mode.

Re: [dm-devel] [PATCH V3 05/13] block: add req flag of REQ_POLL_CTX

2021-03-24 Thread Hannes Reinecke
On 3/24/21 1:19 PM, Ming Lei wrote: Add one req flag REQ_POLL_CTX which will be used in the following patch for supporting bio based IO polling. Exactly this flag can help us to do: 1) request flag is cloned in bio_fast_clone(), so if we mark one FS bio as REQ_POLL_CTX, all bios cloned from

Re: [dm-devel] [PATCH V3 06/13] block: add new field into 'struct bvec_iter'

2021-03-24 Thread Hannes Reinecke
On 3/24/21 1:19 PM, Ming Lei wrote: There is a hole at the end of 'struct bvec_iter', so put a new field here and we can save cookie returned from submit_bio() here for supporting bio based polling. This way can avoid to extend bio unnecessarily. Meantime add two helpers to get/set this field.

Re: [dm-devel] [PATCH V3 01/13] block: add helper of blk_queue_poll

2021-03-24 Thread Hannes Reinecke
On 3/24/21 1:19 PM, Ming Lei wrote: There has been 3 users, and will be more, so add one such helper. Reviewed-by: Chaitanya Kulkarni Signed-off-by: Ming Lei --- block/blk-core.c | 2 +- block/blk-mq.c | 3 +-- drivers/nvme/host/core.c | 2 +- include/linux/blkdev.h |

Re: [dm-devel] [PATCH V3 04/13] block: create io poll context for submission and poll task

2021-03-24 Thread Hannes Reinecke
On 3/24/21 1:19 PM, Ming Lei wrote: Create per-task io poll context for both IO submission and poll task if the queue is bio based and supports polling. This io polling context includes two queues: 1) submission queue(sq) for storing HIPRI bio, written by submission task and read by poll

Re: [dm-devel] [PATCH V3 03/13] block: add helper of blk_create_io_context

2021-03-24 Thread Hannes Reinecke
On 3/24/21 1:19 PM, Ming Lei wrote: Add one helper for creating io context and prepare for supporting efficient bio based io poll. Meantime move the code of creating io_context before checking bio's REQ_HIPRI flag because the following patch may change to clear REQ_HIPRI if io_context can't be

Re: [dm-devel] [PATCH V3 02/13] block: add one helper to free io_context

2021-03-24 Thread Hannes Reinecke
On 3/24/21 1:19 PM, Ming Lei wrote: Prepare for putting bio poll queue into io_context, so add one helper for free io_context. Signed-off-by: Ming Lei --- block/blk-ioc.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) Reviewed-by: Hannes Reinecke Cheers, Hannes --

[dm-devel] [PATCH V3 11/13] block: add queue_to_disk() to get gendisk from request_queue

2021-03-24 Thread Ming Lei
From: Jeffle Xu Sometimes we need to get the corresponding gendisk from request_queue. It is preferred that block drivers store private data in gendisk->private_data rather than request_queue->queuedata, e.g. see: commit c4a59c4e5db3 ("dm: stop using ->queuedata"). So if only request_queue is

[dm-devel] [PATCH V3 13/13] dm: support IO polling for bio-based dm device

2021-03-24 Thread Ming Lei
From: Jeffle Xu IO polling is enabled when all underlying target devices are capable of IO polling. The sanity check supports the stacked device model, in which one dm device may be build upon another dm device. In this case, the mapped device will check if the underlying dm target device

[dm-devel] [PATCH V3 12/13] block: add poll_capable method to support bio-based IO polling

2021-03-24 Thread Ming Lei
From: Jeffle Xu This method can be used to check if bio-based device supports IO polling or not. For mq devices, checking for hw queue in polling mode is adequate, while the sanity check shall be implementation specific for bio-based devices. For example, dm device needs to check if all

[dm-devel] [PATCH V3 09/13] block: use per-task poll context to implement bio based io polling

2021-03-24 Thread Ming Lei
Currently bio based IO polling needs to poll all hw queue blindly, this way is very inefficient, and one big reason is that we can't pass any bio submission result to blk_poll(). In IO submission context, track associated underlying bios by per-task submission queue and store returned 'cookie' in

[dm-devel] [PATCH V3 08/13] block: prepare for supporting bio_list via other link

2021-03-24 Thread Ming Lei
So far bio list helpers always use .bi_next to traverse the list, we will support to link bios by other bio field. Prepare for such support by adding a macro so that users can define another helpers for linking bios by other bio field. Signed-off-by: Ming Lei --- include/linux/bio.h | 132

[dm-devel] [PATCH V3 10/13] blk-mq: limit hw queues to be polled in each blk_poll()

2021-03-24 Thread Ming Lei
Limit at most 8 queues are polled in each blk_pull(), avoid to add extra latency when queue depth is high. Signed-off-by: Ming Lei --- block/blk-mq.c | 73 -- 1 file changed, 53 insertions(+), 20 deletions(-) diff --git a/block/blk-mq.c

[dm-devel] [PATCH V3 07/13] block/mq: extract one helper function polling hw queue

2021-03-24 Thread Ming Lei
From: Jeffle Xu Extract the logic of polling one hw queue and related statistics handling out as the helper function. Signed-off-by: Jeffle Xu Signed-off-by: Ming Lei --- block/blk-mq.c | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/block/blk-mq.c

[dm-devel] [PATCH V3 06/13] block: add new field into 'struct bvec_iter'

2021-03-24 Thread Ming Lei
There is a hole at the end of 'struct bvec_iter', so put a new field here and we can save cookie returned from submit_bio() here for supporting bio based polling. This way can avoid to extend bio unnecessarily. Meantime add two helpers to get/set this field. Signed-off-by: Ming Lei ---

[dm-devel] [PATCH V3 05/13] block: add req flag of REQ_POLL_CTX

2021-03-24 Thread Ming Lei
Add one req flag REQ_POLL_CTX which will be used in the following patch for supporting bio based IO polling. Exactly this flag can help us to do: 1) request flag is cloned in bio_fast_clone(), so if we mark one FS bio as REQ_POLL_CTX, all bios cloned from this FS bio will be marked as

[dm-devel] [PATCH V3 02/13] block: add one helper to free io_context

2021-03-24 Thread Ming Lei
Prepare for putting bio poll queue into io_context, so add one helper for free io_context. Signed-off-by: Ming Lei --- block/blk-ioc.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/block/blk-ioc.c b/block/blk-ioc.c index 57299f860d41..b0cde18c4b8c 100644 ---

[dm-devel] [PATCH V3 04/13] block: create io poll context for submission and poll task

2021-03-24 Thread Ming Lei
Create per-task io poll context for both IO submission and poll task if the queue is bio based and supports polling. This io polling context includes two queues: 1) submission queue(sq) for storing HIPRI bio, written by submission task and read by poll task. 2) polling queue(pq) for holding

[dm-devel] [PATCH V3 03/13] block: add helper of blk_create_io_context

2021-03-24 Thread Ming Lei
Add one helper for creating io context and prepare for supporting efficient bio based io poll. Meantime move the code of creating io_context before checking bio's REQ_HIPRI flag because the following patch may change to clear REQ_HIPRI if io_context can't be created. Signed-off-by: Ming Lei ---

[dm-devel] [PATCH V3 01/13] block: add helper of blk_queue_poll

2021-03-24 Thread Ming Lei
There has been 3 users, and will be more, so add one such helper. Reviewed-by: Chaitanya Kulkarni Signed-off-by: Ming Lei --- block/blk-core.c | 2 +- block/blk-mq.c | 3 +-- drivers/nvme/host/core.c | 2 +- include/linux/blkdev.h | 1 + 4 files changed, 4 insertions(+), 4

[dm-devel] [PATCH V3 00/13] block: support bio based io polling

2021-03-24 Thread Ming Lei
Hi, Add per-task io poll context for holding HIPRI blk-mq/underlying bios queued from bio based driver's io submission context, and reuse one bio padding field for storing 'cookie' returned from submit_bio() for these bios. Also explicitly end these bios in poll context by adding two new bio

Re: [dm-devel] [PATCH v3 01/11] pagemap: Introduce ->memory_failure()

2021-03-24 Thread Christoph Hellwig
On Tue, Mar 23, 2021 at 07:19:28PM -0700, Dan Williams wrote: > So I think the path forward is: > > - teach memory_failure() to allow for ranged failures > > - let interested drivers register for memory failure events via a > blocking_notifier_head Eww. As I said I think the right way is that