Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7274605rwb; Wed, 23 Nov 2022 04:40:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf6u0cGe4cQWLkYYCsApgUiT66zlPq+oquxQ9iuphrgon4VOypUagK3GVe9bIeuqeqYptm7e X-Received: by 2002:a63:185a:0:b0:476:e84c:ab63 with SMTP id 26-20020a63185a000000b00476e84cab63mr11974128pgy.496.1669207201082; Wed, 23 Nov 2022 04:40:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669207201; cv=none; d=google.com; s=arc-20160816; b=i0pY/HIkRNYEPtx46lOo9R6t7nhNCX4FsZITgeB6eBBSlAop1mkAdghZsvt+POunz1 yqmONgQOdOwxt2MxiXeKdnEj8mF5sPUexIxeP0QRbsAlkFJqSr5Br9qczaSmRj2qluDt h29VkHBY6DAwmzyCC+b09+QLiMhH+zgv26NLwdYo8laQ1j9LtmMKJUDCKC3hEPntWY54 WQKYoXtbAg8UeQYrBD8Ha+RL4vUDJKUBo04TIxCdclyj8p+hcTzzL1XA/hZi+eAeXR+f CdfmHisW3fKxlYkImA1Y5E/U7qSGxdEIqKhukt2cBBd9SNBOsqgd3fHBbXXqEtzZEbm2 mFbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type:user-agent :in-reply-to:mime-version:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=J8tJEajcNf43feZbPcC3jSH5tMqTd3EkJBwiSz4CDnw=; b=sPX9tG3hKobu08bNdKFThC7oZiXsEAee4k0FcxdpWLOKwxppx/+QdLBXipFvXZ0heU BiYXx9qCpWAfLawMNVhMbB2DsxQUkvy6riiN7vaQGdXy5LdzpdOBCTRvdBdSa6f8y95X HLD/yEW+K5Yc0lm1d+7vgMYmR3Y3W4J2m7oQEHddDVAXr0x9SWeLkxuEJlUR7kF4ImG3 aDgMHpfmbxj9c0sVH370w3fclR1WlGyJ9l5D8imrSCBu2ffjLnDAEVCxcq2f0PMXcjR2 9CopIHsozbv8Dj7iqKpCX8svXp8QbasDw7XsxHYCUW6tbSRMmgUVYON9sr2/9jrLo1gd I4pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=LiaE24cv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ng6-20020a17090b1a8600b00202c7f4631esi2081768pjb.19.2022.11.23.04.39.48; Wed, 23 Nov 2022 04:40:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=LiaE24cv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236336AbiKWMN6 (ORCPT + 90 others); Wed, 23 Nov 2022 07:13:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235939AbiKWMNy (ORCPT ); Wed, 23 Nov 2022 07:13:54 -0500 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CA15E98 for ; Wed, 23 Nov 2022 04:13:53 -0800 (PST) Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20221123121351epoutp02e3961aa2b73d37793d84149fcd0354e8~qNa2tApV31301913019epoutp02u for ; Wed, 23 Nov 2022 12:13:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20221123121351epoutp02e3961aa2b73d37793d84149fcd0354e8~qNa2tApV31301913019epoutp02u DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1669205631; bh=J8tJEajcNf43feZbPcC3jSH5tMqTd3EkJBwiSz4CDnw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=LiaE24cvhu6uEr0MGdbJkpfOGT/HN6/NU/vvftuXXV32C7gcOThk8EKw+WkzPhx6z a9Fb9csPSp23UUV1ejHfqaB8uPjtbEzdz7AtvqEnVekyZjzIU7Sc/LdOu9jS0uXUvu Z4pZqAcy8TSEJgrjbH1GGFMoR4yqUwGpGRwpNzbc= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20221123121351epcas5p2b1c4ec4c767ca49c4e4c22515d4b6365~qNa19qxrx0517605176epcas5p2E; Wed, 23 Nov 2022 12:13:51 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.175]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4NHKmF2gWwz4x9Py; Wed, 23 Nov 2022 12:13:49 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id F3.06.01710.D7E0E736; Wed, 23 Nov 2022 21:13:49 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20221123101836epcas5p4667a420daae5e33c26477d62249e75ce~qL2OFxVYW2457124571epcas5p4F; Wed, 23 Nov 2022 10:18:36 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20221123101836epsmtrp241b68ada4fc9176c1bb90e275bba4cf5~qL2OEsCR32111421114epsmtrp2B; Wed, 23 Nov 2022 10:18:36 +0000 (GMT) X-AuditID: b6c32a49-c9ffa700000006ae-6d-637e0e7dfd17 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 49.2F.18644.C73FD736; Wed, 23 Nov 2022 19:18:36 +0900 (KST) Received: from test-zns (unknown [107.110.206.5]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20221123101832epsmtip1f15b1bdd3ebf147c9a3fe238fea17ca1~qL2Kkjd961036210362epsmtip1D; Wed, 23 Nov 2022 10:18:32 +0000 (GMT) Date: Wed, 23 Nov 2022 15:37:12 +0530 From: Nitesh Shetty To: Ming Lei Cc: axboe@kernel.dk, agk@redhat.com, snitzer@kernel.org, dm-devel@redhat.com, kbusch@kernel.org, hch@lst.de, sagi@grimberg.me, james.smart@broadcom.com, kch@nvidia.com, damien.lemoal@opensource.wdc.com, naohiro.aota@wdc.com, jth@kernel.org, viro@zeniv.linux.org.uk, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, anuj20.g@samsung.com, joshi.k@samsung.com, p.raghav@samsung.com, nitheshshetty@gmail.com, gost.dev@samsung.com Subject: Re: [PATCH v5 02/10] block: Add copy offload support infrastructure Message-ID: <20221123100712.GA26377@test-zns> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Brightmail-Tracker: H4sIAAAAAAAAA02Te0xbVRzHc+4tt4UIu+O1A3OIZWYCUqgWPDw1uGwXhYRsmjl0YV17eYTS Nm3ZYHM8BmUIYbznqIOxwEAeAQTGgA7DMLOAIipQBOkeCpgNB4PqkDDAwi1m/33O9/f95ffK 4eC2ZWxnTrxURSukQgmXsGJ1fut+wOu8TarIR/3jLtQy9B2OLhSu46jRU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CQMbOSWpre9XpHTUBQpfCqqyjuor/bv1k/u MB3f1r7YYpSErTU2CR0OzcLyGIOsYH1M+NmhrSJOlNC/7nPzt+3WS7UrH3HZ+JMD7M5NP0fm 1p55KonxEhdeE8V/025Qvwj8rpF+zalKYyrC9Ao0K6I642Jzs3bwFBzOz85QDCnOh0fX1eeN y5a3zS6yCgNnYJFVEgGuFD+xF6VLCbVCLgvGVWr5L4XDK6BqAwAA X-CMS-MailID: 20221123101836epcas5p4667a420daae5e33c26477d62249e75ce X-Msg-Generator: CA Content-Type: multipart/mixed; boundary="----G62UEJgdyo2JOumF_Do4Y7B7G39M5PuLVzFwfXKQiOy3iUJg=_667d6_" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20221123061017epcas5p246a589e20eac655ac340cfda6028ff35 References: <20221123055827.26996-1-nj.shetty@samsung.com> <20221123055827.26996-3-nj.shetty@samsung.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ------G62UEJgdyo2JOumF_Do4Y7B7G39M5PuLVzFwfXKQiOy3iUJg=_667d6_ Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline On Wed, Nov 23, 2022 at 04:04:18PM +0800, Ming Lei wrote: > On Wed, Nov 23, 2022 at 11:28:19AM +0530, Nitesh Shetty wrote: > > Introduce blkdev_issue_copy which supports source and destination bdevs, > > and an array of (source, destination and copy length) tuples. > > Introduce REQ_COPY copy offload operation flag. Create a read-write > > bio pair with a token as payload and submitted to the device in order. > > Read request populates token with source specific information which > > is then passed with write request. > > This design is courtesy Mikulas Patocka's token based copy > > I thought this patchset is just for enabling copy command which is > supported by hardware. But turns out it isn't, because blk_copy_offload() > still submits read/write bios for doing the copy. > > I am just wondering why not let copy_file_range() cover this kind of copy, > and the framework has been there. > Main goal was to enable copy command, but community suggested to add copy emulation as well. blk_copy_offload - actually issues copy command in driver layer. The way read/write BIOs are percieved is different for copy offload. In copy offload we check REQ_COPY flag in NVMe driver layer to issue copy command. But we did missed it to add in other driver's, where they might be treated as normal READ/WRITE. blk_copy_emulate - is used if we fail or if device doesn't support native copy offload command. Here we do READ/WRITE. Using copy_file_range for emulation might be possible, but we see 2 issues here. 1. We explored possibility of pulling dm-kcopyd to block layer so that we can readily use it. But we found it had many dependecies from dm-layer. So later dropped that idea. 2. copy_file_range, for block device atleast we saw few check's which fail it for raw block device. At this point I dont know much about the history of why such check is present. > When I was researching pipe/splice code for supporting ublk zero copy[1], I > have got idea for async copy_file_range(), such as: io uring based > direct splice, user backed intermediate buffer, still zero copy, if these > ideas are finally implemented, we could get super-fast generic offload copy, > and bdev copy is really covered too. > > [1] https://lore.kernel.org/linux-block/20221103085004.1029763-1-ming.lei@redhat.com/ > Seems interesting, We will take a look into this. > > Thanks, Nitesh ------G62UEJgdyo2JOumF_Do4Y7B7G39M5PuLVzFwfXKQiOy3iUJg=_667d6_ Content-Type: text/plain; charset="utf-8" ------G62UEJgdyo2JOumF_Do4Y7B7G39M5PuLVzFwfXKQiOy3iUJg=_667d6_--