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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 67B20C76196 for ; Mon, 10 Apr 2023 11:26:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:References:Content-Type: In-Reply-To:MIME-Version:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UHIxLy9rr2FhoG6rYbGSve7hP2xwzs8NruR/TyQFIMM=; b=FD2sPczMto0pMRTc4dgayy2H8q +0oJ3zozAju96TkhlgIGGnaxnyLoxQLPgaq1+lGP8eTlztuH9Ejjq5VjWnAjBh3vOa5yb06qO6Nlt P4NUIZnaqiNaW++nBpOZAtiAtRG18tyLIFWwJHs2MFu2b08s5A4G5tBzBgR3jERbHsPXvitJuAPXo Bm9SRI8K4+2FqqO8fOJVt+3m4gYmmnU6Qz/p0owxhlXCC3Xw+noDDCTYn1CWf+Ij5XbDV/OdJGncm qAwO9OidXZGre8KgdGsTQ0Qwx1XI6S8utadUNHGOoiG3uUxUGmEesZLxvlAAwkcFQQNWRQGt9HTE9 mljJGJ5Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1plpf3-00F9gJ-2Z; Mon, 10 Apr 2023 11:26:13 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1plpf0-00F9fV-1Y for linux-nvme@lists.infradead.org; Mon, 10 Apr 2023 11:26:12 +0000 Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230410112558epoutp03c1775b3c83f5ca53aa5913c95404c423~Ujyb0mFbA2546525465epoutp03B for ; Mon, 10 Apr 2023 11:25:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230410112558epoutp03c1775b3c83f5ca53aa5913c95404c423~Ujyb0mFbA2546525465epoutp03B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1681125958; bh=UHIxLy9rr2FhoG6rYbGSve7hP2xwzs8NruR/TyQFIMM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Vvozc/AX+2UFkrE+m2OcNf4q65qf2xw32IL3ehSFZp5VeUxoFGaKZo3Wj7G7gkL0i X8sapoO/2iHGZ+1eiV5iLmfCnCnD57XWYTE4zC4Wn+SLbotCV/IKVKPdHB5f6emif3 NCMO0tlBX/KwiFBi08bov4U294zx5byClF4smXf8= Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20230410112558epcas5p1a0b28653aae0af8be020cd6dff0fd2ef~Ujybe8Jay0835008350epcas5p1k; Mon, 10 Apr 2023 11:25:58 +0000 (GMT) Received: from epsmtip1.samsung.com (unknown [182.195.34.30]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230410112558epsmtrp20642811a51e760e70ba63e118986d2ff~Ujybebwfu3173131731epsmtrp2Y; Mon, 10 Apr 2023 11:25:58 +0000 (GMT) Received: from green5 (unknown [107.110.206.5]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230410112556epsmtip1c29299c2d6bd2368d392525783eafae0~UjyaK_cPT2849828498epsmtip1N; Mon, 10 Apr 2023 11:25:56 +0000 (GMT) Date: Mon, 10 Apr 2023 16:55:03 +0530 From: Kanchan Joshi To: Keith Busch Cc: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, io-uring@vger.kernel.org, axboe@kernel.dk, hch@lst.de, sagi@grimberg.me, Keith Busch Subject: Re: [PATCHv2 2/5] nvme: simplify passthrough bio cleanup Message-ID: <20230410112503.GA16047@green5> MIME-Version: 1.0 In-Reply-To: <20230407191636.2631046-3-kbusch@meta.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-CMS-MailID: 20230410112558epcas5p1a0b28653aae0af8be020cd6dff0fd2ef X-Msg-Generator: CA Content-Type: multipart/mixed; boundary="----6TPaBgSVJHTP5aYW_KCyJfD-AyyqAIDIArT8HI0pnVcs47o3=_5835_" CMS-TYPE: 105P X-CMS-RootMailID: 20230407191711epcas5p3b9b27aa2477b12ec116b85ea3c7d54b7 References: <20230407191636.2631046-1-kbusch@meta.com> <20230407191636.2631046-3-kbusch@meta.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230410_042610_846757_46BDD836 X-CRM114-Status: GOOD ( 10.63 ) 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: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org ------6TPaBgSVJHTP5aYW_KCyJfD-AyyqAIDIArT8HI0pnVcs47o3=_5835_ Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Disposition: inline On Fri, Apr 07, 2023 at 12:16:33PM -0700, Keith Busch wrote: >From: Keith Busch > >Set the bio's bi_end_io to handle the cleanup so that uring_cmd doesn't >need this complex pdu->{bio,req} switchero and restore. > >Signed-off-by: Keith Busch >--- > drivers/nvme/host/ioctl.c | 26 +++++++++----------------- > 1 file changed, 9 insertions(+), 17 deletions(-) > >diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c >index d24ea2e051564..278c57ee0db91 100644 >--- a/drivers/nvme/host/ioctl.c >+++ b/drivers/nvme/host/ioctl.c >@@ -159,6 +159,11 @@ static struct request *nvme_alloc_user_request(struct request_queue *q, > return req; > } > >+static void nvme_uring_bio_end_io(struct bio *bio) >+{ >+ blk_rq_unmap_user(bio); >+} >+ > static int nvme_map_user_request(struct request *req, u64 ubuffer, > unsigned bufflen, void __user *meta_buffer, unsigned meta_len, > u32 meta_seed, void **metap, struct io_uring_cmd *ioucmd, >@@ -204,6 +209,7 @@ static int nvme_map_user_request(struct request *req, u64 ubuffer, > *metap = meta; > } > >+ bio->bi_end_io = nvme_uring_bio_end_io; > return ret; > > out_unmap: >@@ -249,8 +255,6 @@ static int nvme_submit_user_cmd(struct request_queue *q, > if (meta) > ret = nvme_finish_user_metadata(req, meta_buffer, meta, > meta_len, ret); >- if (bio) >- blk_rq_unmap_user(bio); Is it safe to call blk_rq_unamp_user in irq context? Agree that current code does some complex stuff, but that's to ensure what the code-comment [1] says. Also for polled-io, new-code will hit this warn-on [2] on calling bio_put_percpu_cache. [1] 623 * A matching blk_rq_unmap_user() must be issued at the end of I/O, while 624 * still in process context. 625 */ 626 int blk_rq_map_user_iov(struct request_queue *q, struct request *rq, 627 struct rq_map_data *map_data, [2] 773 if ((bio->bi_opf & REQ_POLLED) && !WARN_ON_ONCE(in_interrupt())) { 774 bio->bi_next = cache->free_list; ------6TPaBgSVJHTP5aYW_KCyJfD-AyyqAIDIArT8HI0pnVcs47o3=_5835_ Content-Type: text/plain; charset="utf-8" ------6TPaBgSVJHTP5aYW_KCyJfD-AyyqAIDIArT8HI0pnVcs47o3=_5835_--