Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp590932pxb; Wed, 27 Jan 2021 16:04:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJxO3lrH9BPyKhaR8GOUw63STH1YNqFyeh194LPwZJm0QxmHNT5xCpsqKbistsaOPZ3TXoBs X-Received: by 2002:a17:906:694c:: with SMTP id c12mr8568085ejs.358.1611792256290; Wed, 27 Jan 2021 16:04:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611792256; cv=none; d=google.com; s=arc-20160816; b=XNbNLD8+BTYZKFe/ePFS50uoqZ7ZkGEsZ4Tyf0VKU0FrtIIO3R6rgP4alFR2EB4B5L AvEFJ2MDXt/x4kIBJc3NezYl+NjfBgoFsOxf3b4C9m43YTUA4V7zaP5sBvLGPX2dcAIZ YJ81ggJttvUMIgOYb9/TBmewCwD8GYizRjzCnkMyljuDwkZ6CMp5psEZx/98oQpJ1tvs 3WBYQ8DJVHGx7CmdI8OCDCoez6a+16idHOrvSGBFOwDi+45CtFSL/Xh5OosPxDSY+2r0 45mtmM7RA/E8SazbcA3QfLnsrArkx1+Fd/bCI7Cfghj4fQyd+jbyD+I3diOaxHtDBMf5 hU7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:autocrypt:from :references:cc:to:subject:dkim-signature; bh=R6ZtaEsn6Sf5kkQW+eu8pA6vL+665kl4n5FmAL3X834=; b=PtaAj0fgRWzdcDWGZRmduj81fq/QlqF9kWxCGSq9plhL2GuH1VVp4CpBLOHGrY9TtE kgEiTAFIjQi3EO0TBt0xc7jHCudCA4/IDxjdaH80zaHlcRLkpJPqmOOj4WMGxijpsdI8 oYf15uBuXVm8TSeZJrG63lSA2qWF0ZaC/y/azXQq6hWiDMqGud/vU5km/oT3Gw+wCIHk ej4dkOwC+xlB7XcyTrzmfjBYzBp8hfdy6cEojrTr4RFaGH3HtH/6J/7DpghjRUEzeUyE ++yJ3xg2hXeT/qT8HJMgf6BHlfRvuvcmhhr64hUYlnCNuVsVC1SaY1RrbpEvGjvMyfeF xekA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qc1n+BUS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 33si1764625edq.416.2021.01.27.16.03.51; Wed, 27 Jan 2021 16:04:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qc1n+BUS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235351AbhA0Pti (ORCPT + 99 others); Wed, 27 Jan 2021 10:49:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236396AbhA0Prg (ORCPT ); Wed, 27 Jan 2021 10:47:36 -0500 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 114B8C061574; Wed, 27 Jan 2021 07:46:30 -0800 (PST) Received: by mail-ej1-x62f.google.com with SMTP id by1so3342132ejc.0; Wed, 27 Jan 2021 07:46:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:autocrypt:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=R6ZtaEsn6Sf5kkQW+eu8pA6vL+665kl4n5FmAL3X834=; b=qc1n+BUSQE/jRJWgJTsugV3ZKoeDqi6vXjTgRGQTTvxmixuE4nNxGdSng2g/nOwJK6 x6lrwbQEntwyqkYr4GZHkdpguGIXT8gF+b33DgJbHvbgLen+ax4hHCatHjS101kMG7yE b85Eq7FQonWY/DTLYf7mHYpkutnS/1SICpeDddCllvBrrKgYnQjMQXodz2KLTc3MJpfM SOJkb9Xs0GB5TM6Lm23shPDLZIK5A/xMN10E8lkIz4dc1NFTRZqxp3o7DyGm5rDL+GKP phArhTh/55ZzXeeZx9DCo7nRsHJ7xiwPw/q5arDYddVjv2NDQXW0iG1LPJyu+hFiNVwR d/vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=R6ZtaEsn6Sf5kkQW+eu8pA6vL+665kl4n5FmAL3X834=; b=smuY9qgXAciAZq14nfAsWG900Blmv6afAw6Gj802qwRyD5XRzxYeonaTGPVL2/oQBZ //T3BW/QamZA2k2juce7Slt9X+OejNGY9GlYq9phcwbraYiHv65QVXZnIFbpE/Mk52Q6 rfUiswhlEVEG3uK29u2Uf6cEAfA0xduIMzfbqvtrUxfkdKf8Wnk1YUZgTTGGUkhTGlHZ f6SW9AHYtEKQCgVy2gXuh1hSEnVrr45pKlryZYgq/jZCEC+h158GZygJMwZ2nO211Hvt D1JTwRzpVhXTKShfAQsd7TszCrTGkJH6l4twFxVMbBSWs9Vrq0VaFhY+nkTrJRE5hdU2 btdg== X-Gm-Message-State: AOAM532c0xvV+IDQCAtK3+5d9WcSS2MHm+PJi3YIXWWwDiB9DmMvYuLu 4r3n4AOjvoS1xRq/l2YgQrI= X-Received: by 2002:a17:906:90c3:: with SMTP id v3mr7493267ejw.461.1611762388705; Wed, 27 Jan 2021 07:46:28 -0800 (PST) Received: from [192.168.8.160] ([148.252.129.161]) by smtp.gmail.com with ESMTPSA id ke7sm1019020ejc.7.2021.01.27.07.46.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Jan 2021 07:46:28 -0800 (PST) Subject: Re: [RFC PATCH 0/4] Asynchronous passthrough ioctl To: Kanchan Joshi , axboe@kernel.dk, kbusch@kernel.org, hch@lst.de, sagi@grimberg.me Cc: linux-nvme@lists.infradead.org, io-uring@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, javier.gonz@samsung.com, nj.shetty@samsung.com, selvakuma.s1@samsung.com References: <20210127150029.13766-1-joshi.k@samsung.com> From: Pavel Begunkov Autocrypt: addr=asml.silence@gmail.com; prefer-encrypt=mutual; keydata= mQINBFmKBOQBEAC76ZFxLAKpDw0bKQ8CEiYJRGn8MHTUhURL02/7n1t0HkKQx2K1fCXClbps bdwSHrhOWdW61pmfMbDYbTj6ZvGRvhoLWfGkzujB2wjNcbNTXIoOzJEGISHaPf6E2IQx1ik9 6uqVkK1OMb7qRvKH0i7HYP4WJzYbEWVyLiAxUj611mC9tgd73oqZ2pLYzGTqF2j6a/obaqha +hXuWTvpDQXqcOZJXIW43atprH03G1tQs7VwR21Q1eq6Yvy2ESLdc38EqCszBfQRMmKy+cfp W3U9Mb1w0L680pXrONcnlDBCN7/sghGeMHjGKfNANjPc+0hzz3rApPxpoE7HC1uRiwC4et83 CKnncH1l7zgeBT9Oa3qEiBlaa1ZCBqrA4dY+z5fWJYjMpwI1SNp37RtF8fKXbKQg+JuUjAa9 Y6oXeyEvDHMyJYMcinl6xCqCBAXPHnHmawkMMgjr3BBRzODmMr+CPVvnYe7BFYfoajzqzq+h EyXSl3aBf0IDPTqSUrhbmjj5OEOYgRW5p+mdYtY1cX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jYvNpeYD8rDcnNbuZh9kTgBwFN41JHOPv0W2FEEWqe JsCwQdcOQ56rtezdCJUYmRAt3BsfjN3Jn3N6rpodi4Dkdli8HylM5iq4ooeb5VkQ7UZxbCWt UVMKkOCdFhutRmYp0mbv2e87IK4erwNHQRkHUkzbsuym8RVpAZbLzLPIYK/J3RTErL6Z99N2 m3J6pjwSJY/zNwuFPs9zGEnRO4g0BUbwGdbuvDzaq6/3OJLKohr5eLXNU3JkT+3HezydWm3W OPhauth7W0db74Qd49HXK0xe/aPrK+Cp+kU1HRactyNtF8jZQbhMCC8vMGukZtWaAwpjWiiH bA== Message-ID: <489691ce-3b1e-30ce-9f72-d32389e33901@gmail.com> Date: Wed, 27 Jan 2021 15:42:46 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: <20210127150029.13766-1-joshi.k@samsung.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/01/2021 15:00, Kanchan Joshi wrote: > This RFC patchset adds asynchronous ioctl capability for NVMe devices. > Purpose of RFC is to get the feedback and optimize the path. > > At the uppermost io-uring layer, a new opcode IORING_OP_IOCTL_PT is > presented to user-space applications. Like regular-ioctl, it takes > ioctl opcode and an optional argument (ioctl-specific input/output > parameter). Unlike regular-ioctl, it is made to skip the block-layer > and reach directly to the underlying driver (nvme in the case of this > patchset). This path between io-uring and nvme is via a newly > introduced block-device operation "async_ioctl". This operation > expects io-uring to supply a callback function which can be used to > report completion at later stage. > > For a regular ioctl, NVMe driver submits the command to the device and > the submitter (task) is made to wait until completion arrives. For > async-ioctl, completion is decoupled from submission. Submitter goes > back to its business without waiting for nvme-completion. When > nvme-completion arrives, it informs io-uring via the registered > completion-handler. But some ioctls may require updating certain > ioctl-specific fields which can be accessed only in context of the > submitter task. For that reason, NVMe driver uses task-work infra for > that ioctl-specific update. Since task-work is not exported, it cannot > be referenced when nvme is compiled as a module. Therefore, one of the > patch exports task-work API. > > Here goes example of usage (pseudo-code). > Actual nvme-cli source, modified to issue all ioctls via this opcode > is present at- > https://github.com/joshkan/nvme-cli/commit/a008a733f24ab5593e7874cfbc69ee04e88068c5 see https://git.kernel.dk/cgit/linux-block/log/?h=io_uring-fops Looks like good time to bring that branch/discussion back > > With regular ioctl- > int nvme_submit_passthru(int fd, unsigned long ioctl_cmd, > struct nvme_passthru_cmd *cmd) > { > return ioctl(fd, ioctl_cmd, cmd); > } > > With uring passthru ioctl- > int nvme_submit_passthru(int fd, unsigned long ioctl_cmd, > struct nvme_passthru_cmd *cmd) > { > return uring_ioctl(fd, ioctl_cmd, cmd); > } > int uring_ioctl(int fd, unsinged long cmd, u64 arg) > { > sqe = io_uring_get_sqe(ring); > > /* prepare sqe */ > sqe->fd = fd; > sqe->opcode = IORING_OP_IOCTL_PT; > sqe->ioctl_cmd = cmd; > sqe->ioctl_arg = arg; > > /* submit sqe */ > io_uring_submit(ring); > > /* reap completion and obtain result */ > io_uring_wait_cqe(ring, &cqe); > printf("ioctl result =%d\n", cqe->res) > } > > Kanchan Joshi (4): > block: introduce async ioctl operation > kernel: export task_work_add > nvme: add async ioctl support > io_uring: add async passthrough ioctl support > > drivers/nvme/host/core.c | 347 +++++++++++++++++++++++++++------- > fs/io_uring.c | 77 ++++++++ > include/linux/blkdev.h | 12 ++ > include/uapi/linux/io_uring.h | 7 +- > kernel/task_work.c | 2 +- > 5 files changed, 376 insertions(+), 69 deletions(-) > -- Pavel Begunkov