Message ID | 20230112115908.23662-1-nj.shetty@samsung.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3883939wrt; Thu, 12 Jan 2023 05:38:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXveuhWpUSCvDLK8SwiW8+3Sq1VypIhyyFVm5FXJqWwA3pVkdKuZLlmkM+Hzg+IQZLUtPk6g X-Received: by 2002:a17:906:838b:b0:851:97ca:7fc9 with SMTP id p11-20020a170906838b00b0085197ca7fc9mr11032144ejx.40.1673530720265; Thu, 12 Jan 2023 05:38:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673530720; cv=none; d=google.com; s=arc-20160816; b=HQy1qatumxyYrIrIFFtuv+w8VNXkD7KQVurSJ/Lrmo5mM43xBN6zg+xr8Nf0Y1O5VQ C1S/Csx6DXreJ5sb/BkLMozUYs7ZRyPT9msT4q3RYiU0zuDPFGFxiossd6JtKCxmrfcr eLEZV1g+dvj59JARwnuOetyjCv9FZeVdMwAAi+32yJ2x1qkoS6PJEdW2N/fIVk4n7Xsl dW3lBhR7v4oHLozeuMFBEQ+iYT14JNn8B0wjhzVhaK5Y7zLnwj6Yk0VS3BpeQUyenc9z qyQ8SJCfZZ4i9wI21Uv6wjN9VjPfrQwAl7qPGqSxEsOJGRY2HEYSlkYrkTuBdp3eoH8w Jacw== 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 :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature:dkim-filter; bh=UnJEdGtMkmielzUj97uMvqqEmcraHfTEsa9rYb4MiL4=; b=Sevvatfls0DUFLBy2LsXFTxPZ9sy4CHgaBJiuxaJ+iqHtuVXopST9EBuN5rxQPfCg5 I8UgSkTBpxcn6KxN9zb+V3itGOWTQhCPeTf1wKAsWnm4SVhnJ3A5q9cwjQcJurIIpvIf WhDA8DPQ68xrQerrdopK1l1wDBr8pJUPVvCWbYdfbz9ktMu3/SXo2J1ivTtfrNfamDKG P5zSYhxAX6vA8flNZcmtmxYMfImXST0ICz7lZo/ZxNd1QYh48WA2c1qHEhy9yXWzfjmz dLR96eLPSBYP+dTnN6Vkg/u0TWdb5iIb60GTZa/Z/ZSKCzj5tk18HUZZJ/JNgTRuLM5i XkgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=jPsdy0FL; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a17090658c600b007abafd4d7d0si20590842ejs.702.2023.01.12.05.38.16; Thu, 12 Jan 2023 05:38:40 -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=jPsdy0FL; 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 S232841AbjALNhR (ORCPT <rfc822;zhuangel570@gmail.com> + 99 others); Thu, 12 Jan 2023 08:37:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232384AbjALNhJ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 12 Jan 2023 08:37:09 -0500 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C85F248CE6 for <linux-kernel@vger.kernel.org>; Thu, 12 Jan 2023 05:37:06 -0800 (PST) Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20230112133703epoutp0439c804b2f502c536bb615f3925dda2c2~5kzxA48lJ3145031450epoutp04- for <linux-kernel@vger.kernel.org>; Thu, 12 Jan 2023 13:37:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20230112133703epoutp0439c804b2f502c536bb615f3925dda2c2~5kzxA48lJ3145031450epoutp04- DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1673530623; bh=UnJEdGtMkmielzUj97uMvqqEmcraHfTEsa9rYb4MiL4=; h=From:To:Cc:Subject:Date:References:From; b=jPsdy0FLJVmoHPlf7esT8RLkvODdsPw1FWF+J2dZpGJwGdJjh2qy6UtgRqEVahPwP H+SaHi/AtUicq+UFrUcuORTeMTRmI1cYmPE1Fi/UdFLkn0iIYHbutHNTsHm5Bl2PmE ffOOER8Tv+i16Jf4O8TfOgHRi1a7v8BiLQOTPBXw= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20230112133702epcas5p477b3e6fb8d168ff430c4caef47563981~5kzwJKFZW1179511795epcas5p41; Thu, 12 Jan 2023 13:37:02 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.179]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4Nt5F86Y3Gz4x9Pt; Thu, 12 Jan 2023 13:37:00 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 80.D4.02301.CFC00C36; Thu, 12 Jan 2023 22:37:00 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20230112115954epcas5p4a959bef952926b8976719f1179bb4436~5je8PVHxa1997319973epcas5p4J; Thu, 12 Jan 2023 11:59:54 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230112115954epsmtrp152f30b7df859064e2bec0ca3a6c8a57e~5je8OV1ZL2220922209epsmtrp1w; Thu, 12 Jan 2023 11:59:54 +0000 (GMT) X-AuditID: b6c32a49-473fd700000108fd-07-63c00cfc1b69 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 2D.13.10542.A36FFB36; Thu, 12 Jan 2023 20:59:54 +0900 (KST) Received: from green5.sa.corp.samsungelectronics.net (unknown [107.110.206.5]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230112115951epsmtip238e47c6957ed82e8528fd357d0332494~5je5ksTYN0887908879epsmtip2C; Thu, 12 Jan 2023 11:59:51 +0000 (GMT) From: Nitesh Shetty <nj.shetty@samsung.com> To: Jens Axboe <axboe@kernel.dk>, Alasdair Kergon <agk@redhat.com>, Mike Snitzer <snitzer@kernel.org>, dm-devel@redhat.com, Keith Busch <kbusch@kernel.org>, Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>, James Smart <james.smart@broadcom.com>, Chaitanya Kulkarni <kch@nvidia.com>, Alexander Viro <viro@zeniv.linux.org.uk> Cc: anuj20.g@samsung.com, joshi.k@samsung.com, p.raghav@samsung.com, nitheshshetty@gmail.com, gost.dev@samsung.com, Nitesh Shetty <nj.shetty@samsung.com>, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v6 0/9] Implement copy offload support Date: Thu, 12 Jan 2023 17:28:54 +0530 Message-Id: <20230112115908.23662-1-nj.shetty@samsung.com> X-Mailer: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0aIHE+w5xM5+clweUIsx+uAG0WIlzm+UraGi2gpe5qL4bh4Tv63xSj75QrMqTvp+Bcm dzxwW4ulrJ85MNX0NHrl+XtVXH90bWVCXxhrd+cbV9pS7dOmlQW9DP5h6NK3n4quNN7PTYd+ ewfqGhMXG6fmAvKW5E/oh/UjJV690VHBJrBmxcTY4Hzy47zUtp4Qf4V1tW9I+Lqtk++kq5Or DAF72Ws6z6IjmPJVznhSZJFA6pSVLr6U4ZlksHYepl+YPNjXQaIKHdgum8n+9ulTqN/uoAwP 89eSC5ZFA28tK/dT2UeleFvQjVrxUu3BwMRN4KdlWnZF9/6Ot/OH3q1kqLopm/e0eryPMaWe 6SPxtQWxO6u6ditahj6j+3lervnSPcJDk2YrH9ZZLSb4SHajBJfz7C82n+OzNQMAAA== X-CMS-MailID: 20230112115954epcas5p4a959bef952926b8976719f1179bb4436 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230112115954epcas5p4a959bef952926b8976719f1179bb4436 References: <CGME20230112115954epcas5p4a959bef952926b8976719f1179bb4436@epcas5p4.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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754824148414607852?= X-GMAIL-MSGID: =?utf-8?q?1754824148414607852?= |
Series |
Implement copy offload support
|
|
Message
Nitesh Shetty
Jan. 12, 2023, 11:58 a.m. UTC
The patch series covers the points discussed in November 2021 virtual call [LSF/MM/BFP TOPIC] Storage: Copy Offload [0]. We have covered the initial agreed requirements in this patchset and further additional features suggested by community. Patchset borrows Mikulas's token based approach for 2 bdev implementation. This is on top of our previous patchset v5[1]. Overall series supports: ======================== 1. Driver - NVMe Copy command (single NS, TP 4065), including support in nvme-target (for block and file backend). 2. Block layer - Block-generic copy (REQ_COPY flag), with interface accommodating two block-devs, and multi-source/destination interface - Emulation, when offload is natively absent - dm-linear support (for cases not requiring split) 3. User-interface - new ioctl 4. In-kernel user - dm-kcopyd Testing ======= Copy offload can be tested on: a. QEMU: NVME simple copy (TP 4065). By setting nvme-ns parameters mssrl,mcl, msrc. For more info [2]. b. Fabrics loopback. c. blktests[3] (tests block/032,033, nvme/046,047,048,049) Emuation can be tested on any device. Sample application to use IOCTL is present in patch desciption. fio[4]. Performance =========== With the async design of copy-emulation/offload using fio[4], we were able to see the following improvements as compared to userspace read and write on a NVMeOF TCP setup: Setup1: Network Speed: 1000Mb/s Host PC: Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz Target PC: AMD Ryzen 9 5900X 12-Core Processor block size 8k, range 1: 635% improvement in IO BW (107 MiB/s to 787 MiB/s). Network utilisation drops from 97% to 14%. block-size 2M, range 16: 2555% improvement in IO BW (100 MiB/s to 2655 MiB/s). Network utilisation drops from 89% to 0.62%. Setup2: Network Speed: 100Gb/s Server: Intel(R) Xeon(R) Gold 6240 CPU @ 2.60GHz, 72 cores (host and target have the same configuration) block-size 8k, range 1: 6.5% improvement in IO BW (791 MiB/s to 843 MiB/s). Network utilisation drops from 6.75% to 0.14%. block-size 2M, range 16: 15% improvement in IO BW (1027 MiB/s to 1183 MiB/s). Network utilisation drops from 8.42% to ~0%. block-size 8k, 8 ranges: 18% drop in IO BW (from 798 MiB/s to 647 MiB/s) Network utilisation drops from 6.66% to 0.13%. At present we see drop in performance for bs 8k,16k and higher ranges (8, 16), so something more to check there. Overall, in these tests, kernel copy emulation performs better than userspace read+write. Blktests[3] ====================== tests/block/032,033: Runs copy offload and emulation on block device. tests/nvme/046,047,048,049 Create a loop backed fabrics device and run copy offload and emulation. Future Work =========== - nullblk: copy-offload emulation. - generic copy file range (CFR): We explored the possibility of using block device def_blk_ops, but we saw a major disadvantage for in-kernel users. fd is not available for in-kernel user [5]. - loopback device copy offload support - upstream fio to use copy offload These are to be taken up after we reach consensus on the plumbing of current elements that are part of this series. Additional links: ================= [0] https://lore.kernel.org/linux-nvme/CA+1E3rJ7BZ7LjQXXTdX+-0Edz=zT14mmPGMiVCzUgB33C60tbQ@mail.gmail.com/ [1] https://lore.kernel.org/lkml/20221130041450.GA17533@test-zns/T/ [2] https://qemu-project.gitlab.io/qemu/system/devices/nvme.html#simple-copy [3] https://github.com/nitesh-shetty/blktests/tree/feat/copy_offload/v6 [4] https://github.com/vincentkfu/fio/tree/copyoffload [5] https://lore.kernel.org/lkml/20221130041450.GA17533@test-zns/T/#m0e2754202fc2223e937c8e7ba3cf7336a93f97a3 Changes since v5: ================= - Addition of blktests (Chaitanya Kulkarni) - Minor fix for fabrics file backed path - Remove buggy zonefs copy file range implementation. Changes since v4: ================= - make the offload and emulation design asynchronous (Hannes Reinecke) - fabrics loopback support - sysfs naming improvements (Damien Le Moal) - use kfree() instead of kvfree() in cio_await_completion (Damien Le Moal) - use ranges instead of rlist to represent range_entry (Damien Le Moal) - change argument ordering in blk_copy_offload suggested (Damien Le Moal) - removed multiple copy limit and merged into only one limit (Damien Le Moal) - wrap overly long lines (Damien Le Moal) - other naming improvements and cleanups (Damien Le Moal) - correctly format the code example in description (Damien Le Moal) - mark blk_copy_offload as static (kernel test robot) Changes since v3: ================= - added copy_file_range support for zonefs - added documentation about new sysfs entries - incorporated review comments on v3 - minor fixes Changes since v2: ================= - fixed possible race condition reported by Damien Le Moal - new sysfs controls as suggested by Damien Le Moal - fixed possible memory leak reported by Dan Carpenter, lkp - minor fixes Nitesh Shetty (9): block: Introduce queue limits for copy-offload support block: Add copy offload support infrastructure block: add emulation for copy block: Introduce a new ioctl for copy nvme: add copy offload support nvmet: add copy command support for bdev and file ns dm: Add support for copy offload. dm: Enable copy offload for dm-linear target dm kcopyd: use copy offload support Documentation/ABI/stable/sysfs-block | 36 ++ block/blk-lib.c | 597 +++++++++++++++++++++++++++ block/blk-map.c | 4 +- block/blk-settings.c | 24 ++ block/blk-sysfs.c | 64 +++ block/blk.h | 2 + block/ioctl.c | 36 ++ drivers/md/dm-kcopyd.c | 56 ++- drivers/md/dm-linear.c | 1 + drivers/md/dm-table.c | 42 ++ drivers/md/dm.c | 7 + drivers/nvme/host/constants.c | 1 + drivers/nvme/host/core.c | 106 ++++- drivers/nvme/host/fc.c | 5 + drivers/nvme/host/nvme.h | 7 + drivers/nvme/host/pci.c | 27 +- drivers/nvme/host/rdma.c | 7 + drivers/nvme/host/tcp.c | 16 + drivers/nvme/host/trace.c | 19 + drivers/nvme/target/admin-cmd.c | 9 +- drivers/nvme/target/io-cmd-bdev.c | 79 ++++ drivers/nvme/target/io-cmd-file.c | 52 +++ drivers/nvme/target/loop.c | 6 + drivers/nvme/target/nvmet.h | 2 + include/linux/blk_types.h | 44 ++ include/linux/blkdev.h | 18 + include/linux/device-mapper.h | 5 + include/linux/nvme.h | 43 +- include/uapi/linux/fs.h | 27 ++ 29 files changed, 1324 insertions(+), 18 deletions(-) base-commit: 469a89fd3bb73bb2eea628da2b3e0f695f80b7ce