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=-9.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 33B75C433ED for ; Thu, 13 May 2021 01:27:26 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8E82C611F0 for ; Thu, 13 May 2021 01:27:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8E82C611F0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8D9MoglBC+A0Zr2J1Q0Ek6tVdMKuUY3GoEqPGnfRy48=; b=GBbnTYW7CPC6ys0P9sg3ZIx96 HtNeg/eDlY2NpC181HLDdn/Le+cI3FtBfqNLZs9oLz1frXwPP045jmgdEMypRaGEGOpeYZyheN+Pj wMxrS3eFIkJUS8V6Lmqs0AvCT3eWr5YzhUBxTFEXW4dNAixglny7yvZea9RAlOCIA6tnVKJhIhxHn E65U2ghyxqi450fse75anqJlB95xyKYkbd5JDwATr0xtQX9FoNDFdITcmXFktym+ZqcLCtk8IDtRM eKN1n+BE50P2eCS284ZOkGD6t1+gIbX4Dp/nT0xYM2QCknidjTmViaibW5BkdJP3b8E+GWyOwTFWr 0ka4cnynw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lh07x-004Nb4-Eq; Thu, 13 May 2021 01:27:01 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lh07s-004Nam-HI for linux-nvme@desiato.infradead.org; Thu, 13 May 2021 01:26:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=0IeOLvkrAZQGTtr6LkMNlIliT+Himhj1UgnIENWNGN4=; b=uqj6rMKk0t4Gd/kpUTYS8sISA8 Acvyj34E2FaytmnHiSuLtuUeAYVpYg/u/quvr3DlN3lQaPPXuAK9jxfMf32qBuqBP0+5z+uXt1pDM cDLlokPj9okxj7HLB1uUinfaHn1DiJ1m5AIjwleaePRaXTibHzMJQsjKf016P9+NObbnoqXC5/sAt GoBVlJuqARlBw4SGkhujw96arORAwljFeHe1BuTbtUTfYH9uUWJz/lh/Bv3nKvT2wzlPB0Hz7rnA3 tnRt98Y53cyC+xr7GcqdiS/AdsZntWcDG7sNAq4c7Qn6z39SqYBJQwd71CMDG5cowZjO+0InzqX8y 3UtYqmgQ==; Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lh07q-00AxJn-0s for linux-nvme@lists.infradead.org; Thu, 13 May 2021 01:26:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620869213; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0IeOLvkrAZQGTtr6LkMNlIliT+Himhj1UgnIENWNGN4=; b=SW//Z+E/Nv7AR/eGCAZrvhG+how9cxrfXK43c8uppYGYFOxt2yp933cJLUX5kXgbTK4a7A 6+7S01hRP0OHtG1c+hOFat4rZrrxYJTRV8Ac4j9dy0tgQznjT5PLjq/uHvMaiZKqVm1t8V 2Rw2fWGTs4FFhiCoB/KVsS+Py4CzfV4= 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-448-Vn8JPlHkNsmVXoreJ5GFCQ-1; Wed, 12 May 2021 21:26:49 -0400 X-MC-Unique: Vn8JPlHkNsmVXoreJ5GFCQ-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 312B5801107; Thu, 13 May 2021 01:26:48 +0000 (UTC) Received: from T590 (ovpn-12-78.pek2.redhat.com [10.72.12.78]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 42FC25D9D7; Thu, 13 May 2021 01:26:34 +0000 (UTC) Date: Thu, 13 May 2021 09:26:30 +0800 From: Ming Lei To: Sagi Grimberg Cc: Christoph Hellwig , Jens Axboe , Jeffle Xu , Damien Le Moal , Keith Busch , "Wunderlich, Mark" , "Vasudevan, Anil" , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-nvme@lists.infradead.org Subject: Re: [PATCH 12/15] block: switch polling to be bio based Message-ID: References: <20210512131545.495160-1-hch@lst.de> <20210512131545.495160-13-hch@lst.de> <45d66945-165c-ae48-69f4-75dc553b0386@grimberg.me> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <45d66945-165c-ae48-69f4-75dc553b0386@grimberg.me> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210512_182654_159243_E24A2F8A X-CRM114-Status: GOOD ( 27.48 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org On Wed, May 12, 2021 at 03:03:40PM -0700, Sagi Grimberg wrote: > > > On 5/12/21 6:15 AM, Christoph Hellwig wrote: > > Replace the blk_poll interface that requires the caller to keep a queue > > and cookie from the submissions with polling based on the bio. > > > > Polling for the bio itself leads to a few advantages: > > > > - the cookie construction can made entirely private in blk-mq.c > > - the caller does not need to remember the request_queue and cookie > > separately and thus sidesteps their lifetime issues > > - keeping the device and the cookie inside the bio allows to trivially > > support polling BIOs remapping by stacking drivers > > - a lot of code to propagate the cookie back up the submission path can > > be removed entirely. > > > > Signed-off-by: Christoph Hellwig ... > > +int bio_poll(struct bio *bio, unsigned int flags) > > +{ > > + struct request_queue *q = bio->bi_bdev->bd_disk->queue; > > + blk_qc_t cookie = READ_ONCE(bio->bi_cookie); > > + > > + if (cookie == BLK_QC_T_NONE || > > + !test_bit(QUEUE_FLAG_POLL, &q->queue_flags)) > > + return 0; > > + > > + if (current->plug) > > + blk_flush_plug_list(current->plug, false); > > + > > + /* not yet implemented, so this should not happen */ > > + if (WARN_ON_ONCE(!queue_is_mq(q))) > > What happens if the I/O wasn't (yet) queued to the bottom device > (i.e. no available path in nvme-mpath)? > > In this case the disk would be the mpath device node (which is > not mq...) ->bi_cookie is only set in blk_mq_start_request() for blk-mq request, if the I/O isn't queued to bottom device, it won't be polled because ->bi_cookie is still BLK_QC_T_NONE. Thanks, Ming _______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme