From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2A1DC43381 for ; Fri, 8 Jan 2021 03:13:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7C663236F9 for ; Fri, 8 Jan 2021 03:13:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727276AbhAHDNK (ORCPT ); Thu, 7 Jan 2021 22:13:10 -0500 Received: from out30-45.freemail.mail.aliyun.com ([115.124.30.45]:53756 "EHLO out30-45.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727003AbhAHDNK (ORCPT ); Thu, 7 Jan 2021 22:13:10 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R921e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=alimailimapcm10staff010182156082;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0UL14Hmt_1610075546; Received: from admindeMacBook-Pro-2.local(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0UL14Hmt_1610075546) by smtp.aliyun-inc.com(127.0.0.1); Fri, 08 Jan 2021 11:12:26 +0800 Subject: Re: [dm-devel] [PATCH RFC 7/7] dm: add support for IO polling From: JeffleXu To: snitzer@redhat.com Cc: linux-block@vger.kernel.org, dm-devel@redhat.com, io-uring@vger.kernel.org References: <20201223112624.78955-1-jefflexu@linux.alibaba.com> <20201223112624.78955-8-jefflexu@linux.alibaba.com> Message-ID: Date: Fri, 8 Jan 2021 11:12:26 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20201223112624.78955-8-jefflexu@linux.alibaba.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org On 12/23/20 7:26 PM, Jeffle Xu wrote: > Enable iopoll when all underlying target devices supports iopoll. > > Signed-off-by: Jeffle Xu > --- > drivers/md/dm-table.c | 28 ++++++++++++++++++++++++++++ > drivers/md/dm.c | 1 + > 2 files changed, 29 insertions(+) > > diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c > index 188f41287f18..b0cd5bf58c3c 100644 > --- a/drivers/md/dm-table.c > +++ b/drivers/md/dm-table.c > @@ -1791,6 +1791,31 @@ static bool dm_table_requires_stable_pages(struct dm_table *t) > return false; > } > > +static int device_supports_poll(struct dm_target *ti, struct dm_dev *dev, > + sector_t start, sector_t len, void *data) > +{ > + struct request_queue *q = bdev_get_queue(dev->bdev); > + > + return q && test_bit(QUEUE_FLAG_POLL, &q->queue_flags); > +} > + > +static bool dm_table_supports_poll(struct dm_table *t) > +{ > + struct dm_target *ti; > + unsigned int i; > + > + /* Ensure that all targets support iopoll. */ > + for (i = 0; i < dm_table_get_num_targets(t); i++) { > + ti = dm_table_get_target(t, i); > + > + if (!ti->type->iterate_devices || > + !ti->type->iterate_devices(ti, device_supports_poll, NULL)) > + return false; > + } > + > + return true; > +} > + > void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, > struct queue_limits *limits) > { > @@ -1883,6 +1908,9 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, > #endif > > blk_queue_update_readahead(q); > + > + if (dm_table_supports_poll(t)) > + blk_queue_flag_set(QUEUE_FLAG_POLL, q); > } > This works in arbitrary bio-based DM stacking. Suppose the following device stack: dm0 dm1 nvme0 nvme1 dm 0 will check if dm1 has QUEUE_FLAG_POLL flag set. > unsigned int dm_table_get_num_targets(struct dm_table *t) > diff --git a/drivers/md/dm.c b/drivers/md/dm.c > index 03c2b867acaa..ffd2c5ead256 100644 > --- a/drivers/md/dm.c > +++ b/drivers/md/dm.c > @@ -3049,6 +3049,7 @@ static const struct pr_ops dm_pr_ops = { > }; > > static const struct block_device_operations dm_blk_dops = { > + .iopoll = blk_bio_poll, > .submit_bio = dm_submit_bio, > .open = dm_blk_open, > .release = dm_blk_close, > -- Thanks, Jeffle From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08943C433DB for ; Fri, 8 Jan 2021 10:31:56 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1FA9B23770 for ; Fri, 8 Jan 2021 10:31:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1FA9B23770 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=dm-devel-bounces@redhat.com Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-256-gcIVcM8jNKG2a-rpJ_v4Wg-1; Fri, 08 Jan 2021 05:31:51 -0500 X-MC-Unique: gcIVcM8jNKG2a-rpJ_v4Wg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AA229801817; Fri, 8 Jan 2021 10:31:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 66FCD5D9C0; Fri, 8 Jan 2021 10:31:47 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 971D34BB7B; Fri, 8 Jan 2021 10:31:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1083CgIh002249 for ; Thu, 7 Jan 2021 22:12:42 -0500 Received: by smtp.corp.redhat.com (Postfix) id EDBC82026D49; Fri, 8 Jan 2021 03:12:41 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E8A2B2026D46 for ; Fri, 8 Jan 2021 03:12:39 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BD2A0101A53F for ; Fri, 8 Jan 2021 03:12:39 +0000 (UTC) Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-198-eOxrm8krOWWPS9mY8Cp5aQ-1; Thu, 07 Jan 2021 22:12:35 -0500 X-MC-Unique: eOxrm8krOWWPS9mY8Cp5aQ-1 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R921e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=alimailimapcm10staff010182156082; MF=jefflexu@linux.alibaba.com; NM=1; PH=DS; RN=4; SR=0; TI=SMTPD_---0UL14Hmt_1610075546 Received: from admindeMacBook-Pro-2.local(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0UL14Hmt_1610075546) by smtp.aliyun-inc.com(127.0.0.1); Fri, 08 Jan 2021 11:12:26 +0800 From: JeffleXu To: snitzer@redhat.com References: <20201223112624.78955-1-jefflexu@linux.alibaba.com> <20201223112624.78955-8-jefflexu@linux.alibaba.com> Message-ID: Date: Fri, 8 Jan 2021 11:12:26 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20201223112624.78955-8-jefflexu@linux.alibaba.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Fri, 08 Jan 2021 05:31:42 -0500 Cc: linux-block@vger.kernel.org, dm-devel@redhat.com, io-uring@vger.kernel.org Subject: Re: [dm-devel] [PATCH RFC 7/7] dm: add support for IO polling X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On 12/23/20 7:26 PM, Jeffle Xu wrote: > Enable iopoll when all underlying target devices supports iopoll. > > Signed-off-by: Jeffle Xu > --- > drivers/md/dm-table.c | 28 ++++++++++++++++++++++++++++ > drivers/md/dm.c | 1 + > 2 files changed, 29 insertions(+) > > diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c > index 188f41287f18..b0cd5bf58c3c 100644 > --- a/drivers/md/dm-table.c > +++ b/drivers/md/dm-table.c > @@ -1791,6 +1791,31 @@ static bool dm_table_requires_stable_pages(struct dm_table *t) > return false; > } > > +static int device_supports_poll(struct dm_target *ti, struct dm_dev *dev, > + sector_t start, sector_t len, void *data) > +{ > + struct request_queue *q = bdev_get_queue(dev->bdev); > + > + return q && test_bit(QUEUE_FLAG_POLL, &q->queue_flags); > +} > + > +static bool dm_table_supports_poll(struct dm_table *t) > +{ > + struct dm_target *ti; > + unsigned int i; > + > + /* Ensure that all targets support iopoll. */ > + for (i = 0; i < dm_table_get_num_targets(t); i++) { > + ti = dm_table_get_target(t, i); > + > + if (!ti->type->iterate_devices || > + !ti->type->iterate_devices(ti, device_supports_poll, NULL)) > + return false; > + } > + > + return true; > +} > + > void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, > struct queue_limits *limits) > { > @@ -1883,6 +1908,9 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, > #endif > > blk_queue_update_readahead(q); > + > + if (dm_table_supports_poll(t)) > + blk_queue_flag_set(QUEUE_FLAG_POLL, q); > } > This works in arbitrary bio-based DM stacking. Suppose the following device stack: dm0 dm1 nvme0 nvme1 dm 0 will check if dm1 has QUEUE_FLAG_POLL flag set. > unsigned int dm_table_get_num_targets(struct dm_table *t) > diff --git a/drivers/md/dm.c b/drivers/md/dm.c > index 03c2b867acaa..ffd2c5ead256 100644 > --- a/drivers/md/dm.c > +++ b/drivers/md/dm.c > @@ -3049,6 +3049,7 @@ static const struct pr_ops dm_pr_ops = { > }; > > static const struct block_device_operations dm_blk_dops = { > + .iopoll = blk_bio_poll, > .submit_bio = dm_submit_bio, > .open = dm_blk_open, > .release = dm_blk_close, > -- Thanks, Jeffle -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel