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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74E0DC433F5 for ; Tue, 5 Apr 2022 06:02:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229685AbiDEGEc (ORCPT ); Tue, 5 Apr 2022 02:04:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229746AbiDEGEb (ORCPT ); Tue, 5 Apr 2022 02:04:31 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CBC41658C for ; Mon, 4 Apr 2022 23:02:32 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id D454768BEB; Tue, 5 Apr 2022 08:02:25 +0200 (CEST) Date: Tue, 5 Apr 2022 08:02:24 +0200 From: Christoph Hellwig To: Kanchan Joshi Cc: Christoph Hellwig , Kanchan Joshi , Jens Axboe , io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, Pavel Begunkov , Ming Lei , Luis Chamberlain , Pankaj Raghav , Javier =?iso-8859-1?Q?Gonz=E1lez?= , Anuj Gupta Subject: Re: [RFC 5/5] nvme: wire-up support for async-passthru on char-device. Message-ID: <20220405060224.GE23698@lst.de> References: <20220401110310.611869-1-joshi.k@samsung.com> <20220401110310.611869-6-joshi.k@samsung.com> <20220404072016.GD444@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org On Mon, Apr 04, 2022 at 07:55:05PM +0530, Kanchan Joshi wrote: > > Something like this (untested) patch should help to separate > > the much better: > > It does, thanks. But the only thing is - it would be good to support > vectored-passthru too (i.e. NVME_IOCTL_IO64_CMD_VEC) for this path. > For the new opcode "NVME_URING_CMD_IO" , either we can change the > cmd-structure or flag-based handling so that vectored-io is supported. > Or we introduce NVME_URING_CMD_IO_VEC also for that. > Which one do you prefer? I agree vectored I/O support is useful. Do we even need to support the non-vectored case? Also I think we'll want admin command passthrough on /dev/nvmeX as well, but I'm fine solving the other items first. > > +static int nvme_ioctl_finish_metadata(struct bio *bio, int ret, > > + void __user *meta_ubuf) > > +{ > > + struct bio_integrity_payload *bip = bio_integrity(bio); > > + > > + if (bip) { > > + void *meta = bvec_virt(bip->bip_vec); > > + > > + if (!ret && bio_op(bio) == REQ_OP_DRV_IN && > > + copy_to_user(meta_ubuf, meta, bip->bip_vec->bv_len)) > > + ret = -EFAULT; > > Maybe it is better to move the check "bio_op(bio) != REQ_OP_DRV_IN" outside. > Because this can be common, and for that we can avoid entering into > the function call itself (i.e. nvme_ioctl_finish_metadata). Function calls are pretty cheap, but I'll see what we can do. I'll try to come up with a prep series to refactor the passthrough support for easier adding of the io_uring in the next days.