From patchwork Tue Jul 19 13:52:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankit Kumar X-Patchwork-Id: 12923480 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 ABF87C433EF for ; Wed, 20 Jul 2022 04:09:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232720AbiGTEJz (ORCPT ); Wed, 20 Jul 2022 00:09:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229618AbiGTEJy (ORCPT ); Wed, 20 Jul 2022 00:09:54 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AA2D1ADAF for ; Tue, 19 Jul 2022 21:09:53 -0700 (PDT) Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20220720040948epoutp02abb7a06202b3a58b32479c37a654c571~DbiPabmVI2105121051epoutp026 for ; Wed, 20 Jul 2022 04:09:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20220720040948epoutp02abb7a06202b3a58b32479c37a654c571~DbiPabmVI2105121051epoutp026 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1658290188; bh=GaFMiezcC/Oe0p+cfmaYFu1JQYpckb58+h9LHvgAYKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IGEKRChxZmFLVs8fW9nBuUI9MjtbwK9L7K6aXzz7kyXzX1eSREhQJ5nEoOKHtGVZA YFINcar8nVS4iogaGRE88IXrJ4bdTrHcyl2Ixv7oZUSJQFZVKpRgu77vycSPMT+tSn pWtCcNUGNJotTU4VdGuK5q4lciXWwO8ZBXRiQjlk= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20220720040947epcas5p19da35e78deecf9bd4727b4bcdcc5a4e8~DbiO8MYBW0854608546epcas5p1z; Wed, 20 Jul 2022 04:09:47 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.183]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4Lnhzs6qMWz4x9Pt; Wed, 20 Jul 2022 04:09:45 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id FF.FC.09662.30087D26; Wed, 20 Jul 2022 13:09:39 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20220719135832epcas5p31bb7df7c931aba12454b6f16c966a7c8~DP6-3udOd0625506255epcas5p3E; Tue, 19 Jul 2022 13:58:32 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220719135832epsmtrp1040ab7d6cf8e6c443f5043543b817bcb~DP6-3AFbi1050910509epsmtrp1R; Tue, 19 Jul 2022 13:58:32 +0000 (GMT) X-AuditID: b6c32a49-86fff700000025be-4d-62d78003c8fa Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 4B.7A.08905.888B6D26; Tue, 19 Jul 2022 22:58:32 +0900 (KST) Received: from test-zns.sa.corp.samsungelectronics.net (unknown [107.110.206.5]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220719135831epsmtip1932b3fb621e002749899a96fed1e45fd~DP6_8bRm72318623186epsmtip10; Tue, 19 Jul 2022 13:58:31 +0000 (GMT) From: Ankit Kumar To: axboe@kernel.dk Cc: io-uring@vger.kernel.org, paul@paul-moore.com, casey@schaufler-ca.com, joshi.k@samsung.com, Ankit Kumar Subject: [PATCH liburing 1/5] configure: check for nvme uring command support Date: Tue, 19 Jul 2022 19:22:30 +0530 Message-Id: <20220719135234.14039-2-ankit.kumar@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220719135234.14039-1-ankit.kumar@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFKsWRmVeSWpSXmKPExsWy7bCmhi5zw/Ukg2eLRCzWXPnNbrH6bj+b xb1tv9gs3rWeY7E4+v8tm8XtSdNZHNg8Lp8t9Vi79wWjR9+WVYweR/cvYvP4vEkugDUq2yYj NTEltUghNS85PyUzL91WyTs43jne1MzAUNfQ0sJcSSEvMTfVVsnFJ0DXLTMH6AAlhbLEnFKg UEBicbGSvp1NUX5pSapCRn5xia1SakFKToFJgV5xYm5xaV66Xl5qiZWhgYGRKVBhQnbG/kfz WQtmcVVsWWjRwLifo4uRk0NCwERi1vsmxi5GLg4hgd2MEgtWTWKGcD4xSqz5uIUFpEpI4Buj RNfkcJiO+5duQBXtZZRo2bmVDcJpZZI4d+0sM0gVm4C2xKu3N8BsEQFhif0drSwgRcwC7YwS HxYcYQdJCAv4S1zccIENxGYRUJXoPP6LFcTmFbCRePRvGQvEOnmJ1RsOgA3iFLCV+LD9Jdhq CYF97BJfGr+yQhS5SEzY8pYdwhaWeHV8C5QtJfGyvw3KzpbY9PAnE4RdIHHkRS8zhG0v0Xqq H8jmALpOU2L9Ln2IsKzE1FPrwMqZBfgken8/gWrlldgxD8ZWlfh77zbUndISN99dhbI9JKZ8 n8YCCZUJjBLPV9xmmcAoNwthxQJGxlWMkqkFxbnpqcWmBYZ5qeXwWEvOz93ECE5kWp47GO8+ +KB3iJGJg/EQowQHs5II79PC60lCvCmJlVWpRfnxRaU5qcWHGE2BATiRWUo0OR+YSvNK4g1N LA1MzMzMTCyNzQyV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zPbM9vCpv4YJuY6lUnjl3v+W9Uz9bx6t91YcLfx21TWov6FjfMPXB/nfW5 GDnDgF7Dv5+V7V8/7NlevyP876pJH/4bXz2gz38jSudtivCksN2qMyXDjokHLzS4fGrNCg4f g3f1j26udSqYtyTYKVTcqfOg3SZ+3lUfqtjeK3PNWc2stjdBdoPlyQMv/9yZ8/xckJJjjfCV rw6Z+3eyKbEUZyQaajEXFScCAGljVk+iAgAA X-CMS-MailID: 20220719135832epcas5p31bb7df7c931aba12454b6f16c966a7c8 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220719135832epcas5p31bb7df7c931aba12454b6f16c966a7c8 References: <20220719135234.14039-1-ankit.kumar@samsung.com> Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Modify configure to check availability of nvme_uring_cmd. The follow up patch will have uring passthrough tests. Signed-off-by: Ankit Kumar --- configure | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/configure b/configure index 43071dd..1b0cc50 100755 --- a/configure +++ b/configure @@ -367,6 +367,23 @@ if compile_prog "" "" "has_ucontext"; then fi print_config "has_ucontext" "$has_ucontext" +########################################## +# Check NVME_URING_CMD support +nvme_uring_cmd="no" +cat > $TMPC << EOF +#include +int main(void) +{ + struct nvme_uring_cmd *cmd; + + return sizeof(struct nvme_uring_cmd); +} +EOF +if compile_prog "" "" "nvme uring cmd"; then + nvme_uring_cmd="yes" +fi +print_config "NVMe uring command support" "$nvme_uring_cmd" + ############################################################################# if test "$liburing_nolibc" = "yes"; then output_sym "CONFIG_NOLIBC" @@ -402,6 +419,9 @@ fi if test "$array_bounds" = "yes"; then output_sym "CONFIG_HAVE_ARRAY_BOUNDS" fi +if test "$nvme_uring_cmd" = "yes"; then + output_sym "CONFIG_HAVE_NVME_URING" +fi echo "CC=$cc" >> $config_host_mak print_config "CC" "$cc" From patchwork Tue Jul 19 13:52:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankit Kumar X-Patchwork-Id: 12923481 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 EDDC7C43334 for ; Wed, 20 Jul 2022 04:09:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232971AbiGTEJ7 (ORCPT ); Wed, 20 Jul 2022 00:09:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229618AbiGTEJ6 (ORCPT ); Wed, 20 Jul 2022 00:09:58 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E02AA29C88 for ; Tue, 19 Jul 2022 21:09:56 -0700 (PDT) Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20220720040955epoutp04645e199a30c20001b1ca504b78f725de~DbiWGDOgq0293202932epoutp04- for ; Wed, 20 Jul 2022 04:09:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20220720040955epoutp04645e199a30c20001b1ca504b78f725de~DbiWGDOgq0293202932epoutp04- DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1658290195; bh=kyAA358jqlstBbNyA9+oy76mPJppkBr+mBZEwR/dHO4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l0WJK18K4Zja4EUsJkxf/0Hu/YzVSeTvMty6g/shSe7/EABrOKz04v05+6ritjLog kITayRVVMCXCWpXtaRvdWhAVJC9wQL0w8Gza2HDnjY7SkG51pKdq8wqVsVGmH+1CjD kkQaurm+1BBKRVErMv0YSl2mFYz3kJrMT6OLVvVs= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20220720040954epcas5p10b2db719d41694dc304e17f8101363ba~DbiVua1JI0854608546epcas5p17; Wed, 20 Jul 2022 04:09:54 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.178]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4Lnhzz3jrzz4x9Q6; Wed, 20 Jul 2022 04:09:51 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id 88.8A.09639.B0087D26; Wed, 20 Jul 2022 13:09:47 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20220719135834epcas5p2f63a49277322756394f19e23a1c4e4ce~DP7A-c2570590105901epcas5p2h; Tue, 19 Jul 2022 13:58:34 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220719135833epsmtrp26ddcd3bf3f3f66708a72138039bd9356~DP7A_ms7c1852218522epsmtrp2P; Tue, 19 Jul 2022 13:58:33 +0000 (GMT) X-AuditID: b6c32a4b-e6dff700000025a7-ca-62d7800bc7be Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id CB.7A.08905.988B6D26; Tue, 19 Jul 2022 22:58:33 +0900 (KST) Received: from test-zns.sa.corp.samsungelectronics.net (unknown [107.110.206.5]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220719135832epsmtip11553f3e945d4e088b393e51fd43ec461~DP6--WdCc3033030330epsmtip1q; Tue, 19 Jul 2022 13:58:32 +0000 (GMT) From: Ankit Kumar To: axboe@kernel.dk Cc: io-uring@vger.kernel.org, paul@paul-moore.com, casey@schaufler-ca.com, joshi.k@samsung.com, Ankit Kumar Subject: [PATCH liburing 2/5] io_uring.h: sync sqe entry with 5.20 io_uring Date: Tue, 19 Jul 2022 19:22:31 +0530 Message-Id: <20220719135234.14039-3-ankit.kumar@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220719135234.14039-1-ankit.kumar@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJKsWRmVeSWpSXmKPExsWy7bCmpi53w/Ukg47tKhZrrvxmt1h9t5/N 4t62X2wW71rPsVgc/f+WzeL2pOksDmwel8+Weqzd+4LRo2/LKkaPo/sXsXl83iQXwBqVbZOR mpiSWqSQmpecn5KZl26r5B0c7xxvamZgqGtoaWGupJCXmJtqq+TiE6DrlpkDdICSQlliTilQ KCCxuFhJ386mKL+0JFUhI7+4xFYptSAlp8CkQK84Mbe4NC9dLy+1xMrQwMDIFKgwITvj15LL TAWzOCp+3D7N1sC4lK2LkZNDQsBEov/JB5YuRi4OIYHdjBIdO2axQjifGCUufd/KDuF8Y5Q4 c/McUIYDrGXqAUWI+F5Gif/vZzGBjBISaGWSuLfKGMRmE9CWePX2BjOILSIgLLG/oxVsBbNA O6PEhwVH2EEGCQt4S5z/kgNSwyKgKrHtRBs7iM0rYCMx69YMJojz5CVWbzgANodTwFbiw/aX zCBzJAQOsUssa1jNDlHkIvHp9jFmCFtY4tXxLVBxKYnP7/ZC/ZktsenhT6ihBRJHXvRC1dtL tJ7qZwa5h1lAU2L9Ln2IsKzE1FPrwMqZBfgken8/gWrlldgxD8ZWlfh77zYLhC0tcfPdVSjb Q6LrYQc0SCcwStxpvMc2gVFuFsKKBYyMqxglUwuKc9NTi00LjPNSy+GRlpyfu4kRnMa0vHcw PnrwQe8QIxMH4yFGCQ5mJRHep4XXk4R4UxIrq1KL8uOLSnNSiw8xmgIDcCKzlGhyPjCR5pXE G5pYGpiYmZmZWBqbGSqJ83pd3ZQkJJCeWJKanZpakF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FLC9/94/kbgEzp1+E2a8S79gavP28S/THz/kFzlsVnCvO3hc 7dQjmd19QUt3SnhUZDemppdMvTTDKnSr6+1FEakv7299Hntjx1zlm/cFa11yflWvb6lmulem KV+9Zuf5RGt3XXPe01MEf9++p7crKshc502lualhbp9YZ61FiTvHXhueyanbKicLMX8U26yR dXrpv1kloWkqv5RYijMSDbWYi4oTAe+sU2KhAgAA X-CMS-MailID: 20220719135834epcas5p2f63a49277322756394f19e23a1c4e4ce X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220719135834epcas5p2f63a49277322756394f19e23a1c4e4ce References: <20220719135234.14039-1-ankit.kumar@samsung.com> Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Add a few missing fields which was added for uring command Signed-off-by: Ankit Kumar --- src/include/liburing/io_uring.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/include/liburing/io_uring.h b/src/include/liburing/io_uring.h index 51126c4..581381d 100644 --- a/src/include/liburing/io_uring.h +++ b/src/include/liburing/io_uring.h @@ -26,6 +26,10 @@ struct io_uring_sqe { union { __u64 off; /* offset into file */ __u64 addr2; + struct { + __u32 cmd_op; + __u32 __pad1; + }; }; union { __u64 addr; /* pointer to buffer or iovecs */ @@ -65,8 +69,17 @@ struct io_uring_sqe { __s32 splice_fd_in; __u32 file_index; }; - __u64 addr3; - __u64 __pad2[1]; + union { + struct { + __u64 addr3; + __u64 __pad2[1]; + }; + /* + * If the ring is initialized with IORING_SETUP_SQE128, then + * this field is used for 80 bytes of arbitrary command data + */ + __u8 cmd[0]; + }; }; /* From patchwork Tue Jul 19 13:52:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankit Kumar X-Patchwork-Id: 12923482 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 C2D88C433EF for ; Wed, 20 Jul 2022 04:10:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233851AbiGTEKR (ORCPT ); Wed, 20 Jul 2022 00:10:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233788AbiGTEKQ (ORCPT ); Wed, 20 Jul 2022 00:10:16 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D59E22B2C for ; Tue, 19 Jul 2022 21:10:15 -0700 (PDT) Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20220720041013epoutp021eca17252649498e4b354f4963cb5572~Dbinfzn6h2117321173epoutp02C for ; Wed, 20 Jul 2022 04:10:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20220720041013epoutp021eca17252649498e4b354f4963cb5572~Dbinfzn6h2117321173epoutp02C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1658290213; bh=8ZRJ2yAa5YlNjP+lRsTxBfnnFz5zvSEZd11Xx72zjSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TsLt0QpIga5PJrE+PWHWphV8CiJESw3I9ekgG/FhDWudSE0dcYAtUUymapRbfOH0Q WxqjzeKF704hmCvdYnstTe3ZPZn5pLNj9dDHaYKpjy8GEAL8/qxVfRtBQeQ+CPDJFQ EvRJy8n8WW2yClzu1DFm+/RL6w/W/LBYBzo4/qmg= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20220720041013epcas5p32e1470ce0d9ac763a2a086453bdaff96~DbinQcgnz1311613116epcas5p3e; Wed, 20 Jul 2022 04:10:13 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.180]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4Lnj0M0pkBz4x9QJ; Wed, 20 Jul 2022 04:10:11 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id CF.8A.09639.91087D26; Wed, 20 Jul 2022 13:10:01 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20220719135835epcas5p2284cbb16a28c4290d3a886449bc7a6d8~DP7CStggm0590105901epcas5p2j; Tue, 19 Jul 2022 13:58:35 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220719135835epsmtrp1fdda31de767ec4574d2ebdd5452314fb~DP7CSFjoK1050910509epsmtrp1T; Tue, 19 Jul 2022 13:58:35 +0000 (GMT) X-AuditID: b6c32a4b-e6dff700000025a7-ee-62d78019604c Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 74.3D.08802.B88B6D26; Tue, 19 Jul 2022 22:58:35 +0900 (KST) Received: from test-zns.sa.corp.samsungelectronics.net (unknown [107.110.206.5]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220719135834epsmtip189d509220611ec63c89aeedcf6161063~DP7BFlWKk2149321493epsmtip1c; Tue, 19 Jul 2022 13:58:33 +0000 (GMT) From: Ankit Kumar To: axboe@kernel.dk Cc: io-uring@vger.kernel.org, paul@paul-moore.com, casey@schaufler-ca.com, joshi.k@samsung.com, Ankit Kumar Subject: [PATCH liburing 3/5] nvme: add nvme opcodes, structures and helper functions Date: Tue, 19 Jul 2022 19:22:32 +0530 Message-Id: <20220719135234.14039-4-ankit.kumar@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220719135234.14039-1-ankit.kumar@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFKsWRmVeSWpSXmKPExsWy7bCmhq5kw/Ukg5OT2CzWXPnNbrH6bj+b xb1tv9gs3rWeY7E4+v8tm8XtSdNZHNg8Lp8t9Vi79wWjR9+WVYweR/cvYvP4vEkugDUq2yYj NTEltUghNS85PyUzL91WyTs43jne1MzAUNfQ0sJcSSEvMTfVVsnFJ0DXLTMH6AAlhbLEnFKg UEBicbGSvp1NUX5pSapCRn5xia1SakFKToFJgV5xYm5xaV66Xl5qiZWhgYGRKVBhQnbGmpcv GQs2ylXM2naItYFxlngXIweHhICJRNOy8i5GLg4hgd2MEtPuHmGGcD4xSjy/PIUFwvnMKPGx eQ+QwwnWcXPidKjELkaJ9Uc3sUI4rUwSXd3TmUCq2AS0JV69vcEMYosICEvs72gF62AWaGeU +LDgCDvIcmGBcImzv/JBalgEVCXOrH3JDmLzCthItEw8A7VNXmL1hgNgczgFbCU+bH8Jdp+E wCF2idtLm5ghilwkzq/cAGULS7w6voUdwpaSeNnfBmVnS2x6+JMJwi6QOPKiF6reXqL1VD8z yD3MApoS63fpQ4RlJaaeWgdWzizAJ9H7+wlUK6/EjnkwtqrE33u3oe6Ulrj57iqU7SEx7dR2 aDhOYJR4++gF8wRGuVkIKxYwMq5ilEwtKM5NTy02LTDOSy2Hx1pyfu4mRnAi0/LewfjowQe9 Q4xMHIyHGCU4mJVEeJ8WXk8S4k1JrKxKLcqPLyrNSS0+xGgKDMCJzFKiyfnAVJpXEm9oYmlg YmZmZmJpbGaoJM7rdXVTkpBAemJJanZqakFqEUwfEwenVAPTkf9/25n+mK5aY8h1zqDLSKa7 v8tw4ec/3ic/tqyyeJTdsUW4TlTPpZPXcn6tilPihrvfMp/Yr/3+b7qKx0sZ907DNvGDNbyt H9nPz3W8HaTT0m2nqNzZXGiax6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F8P/U7u3nb4tFF2/L9z4n8SyMy7yQhET+K44Toial8PeIiG7/HABW1xC1+cK Fe8Zjce8ViqxFGckGmoxFxUnAgDUFt59pAIAAA== X-CMS-MailID: 20220719135835epcas5p2284cbb16a28c4290d3a886449bc7a6d8 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220719135835epcas5p2284cbb16a28c4290d3a886449bc7a6d8 References: <20220719135234.14039-1-ankit.kumar@samsung.com> Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Add bare minimum structures and helper functions required for io_uring passthrough commands. This will enable the follow up patch to add tests for nvme-ns generic character device. Signed-off-by: Ankit Kumar --- test/nvme.h | 168 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 test/nvme.h diff --git a/test/nvme.h b/test/nvme.h new file mode 100644 index 0000000..866a7e6 --- /dev/null +++ b/test/nvme.h @@ -0,0 +1,168 @@ +/* SPDX-License-Identifier: MIT */ +/* + * Description: Helpers for NVMe uring passthrough commands + */ +#ifndef LIBURING_NVME_H +#define LIBURING_NVME_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* + * If the uapi headers installed on the system lacks nvme uring command + * support, use the local version to prevent compilation issues. + */ +#ifndef CONFIG_HAVE_NVME_URING +struct nvme_uring_cmd { + __u8 opcode; + __u8 flags; + __u16 rsvd1; + __u32 nsid; + __u32 cdw2; + __u32 cdw3; + __u64 metadata; + __u64 addr; + __u32 metadata_len; + __u32 data_len; + __u32 cdw10; + __u32 cdw11; + __u32 cdw12; + __u32 cdw13; + __u32 cdw14; + __u32 cdw15; + __u32 timeout_ms; + __u32 rsvd2; +}; + +#define NVME_URING_CMD_IO _IOWR('N', 0x80, struct nvme_uring_cmd) +#define NVME_URING_CMD_IO_VEC _IOWR('N', 0x81, struct nvme_uring_cmd) +#endif /* CONFIG_HAVE_NVME_URING */ + +#define NVME_DEFAULT_IOCTL_TIMEOUT 0 +#define NVME_IDENTIFY_DATA_SIZE 4096 +#define NVME_IDENTIFY_CSI_SHIFT 24 +#define NVME_IDENTIFY_CNS_NS 0 +#define NVME_CSI_NVM 0 + +enum nvme_admin_opcode { + nvme_admin_identify = 0x06, +}; + +enum nvme_io_opcode { + nvme_cmd_write = 0x01, + nvme_cmd_read = 0x02, +}; + +int nsid; +__u32 lba_shift; + +struct nvme_lbaf { + __le16 ms; + __u8 ds; + __u8 rp; +}; + +struct nvme_id_ns { + __le64 nsze; + __le64 ncap; + __le64 nuse; + __u8 nsfeat; + __u8 nlbaf; + __u8 flbas; + __u8 mc; + __u8 dpc; + __u8 dps; + __u8 nmic; + __u8 rescap; + __u8 fpi; + __u8 dlfeat; + __le16 nawun; + __le16 nawupf; + __le16 nacwu; + __le16 nabsn; + __le16 nabo; + __le16 nabspf; + __le16 noiob; + __u8 nvmcap[16]; + __le16 npwg; + __le16 npwa; + __le16 npdg; + __le16 npda; + __le16 nows; + __le16 mssrl; + __le32 mcl; + __u8 msrc; + __u8 rsvd81[11]; + __le32 anagrpid; + __u8 rsvd96[3]; + __u8 nsattr; + __le16 nvmsetid; + __le16 endgid; + __u8 nguid[16]; + __u8 eui64[8]; + struct nvme_lbaf lbaf[16]; + __u8 rsvd192[192]; + __u8 vs[3712]; +}; + +static inline int ilog2(uint32_t i) +{ + int log = -1; + + while (i) { + i >>= 1; + log++; + } + return log; +} + +int fio_nvme_get_info(const char *file) +{ + struct nvme_id_ns ns; + int fd, err; + __u32 lba_size; + + fd = open(file, O_RDONLY); + if (fd < 0) + return -errno; + + nsid = ioctl(fd, NVME_IOCTL_ID); + if (nsid < 0) { + fprintf(stderr, "failed to fetch namespace-id\n"); + close(fd); + return -errno; + } + + struct nvme_passthru_cmd cmd = { + .opcode = nvme_admin_identify, + .nsid = nsid, + .addr = (__u64)(uintptr_t)&ns, + .data_len = NVME_IDENTIFY_DATA_SIZE, + .cdw10 = NVME_IDENTIFY_CNS_NS, + .cdw11 = NVME_CSI_NVM << NVME_IDENTIFY_CSI_SHIFT, + .timeout_ms = NVME_DEFAULT_IOCTL_TIMEOUT, + }; + + err = ioctl(fd, NVME_IOCTL_ADMIN_CMD, &cmd); + if (err) { + fprintf(stderr, "failed to fetch identify namespace\n"); + close(fd); + return err; + } + + lba_size = 1 << ns.lbaf[(ns.flbas & 0x0f)].ds; + lba_shift = ilog2(lba_size); + + close(fd); + return 0; +} + +#ifdef __cplusplus +} +#endif + +#endif From patchwork Tue Jul 19 13:52:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankit Kumar X-Patchwork-Id: 12923483 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 E0242C433EF for ; Wed, 20 Jul 2022 04:10:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233788AbiGTEK0 (ORCPT ); Wed, 20 Jul 2022 00:10:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229618AbiGTEKZ (ORCPT ); Wed, 20 Jul 2022 00:10:25 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FE0250721 for ; Tue, 19 Jul 2022 21:10:24 -0700 (PDT) Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20220720041022epoutp04efa9605992cc664d9e4ed4d93c74af63~DbivvCaWB0335303353epoutp045 for ; Wed, 20 Jul 2022 04:10:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20220720041022epoutp04efa9605992cc664d9e4ed4d93c74af63~DbivvCaWB0335303353epoutp045 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1658290222; bh=9bXRCeJaPpH6G1/gAYRWb2N6jVpde/QgWluyBHJHwIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OMo+cMavQ7v78+0pPTra21Qg86p0v84nFiWCeu1byxVPXhrLWPrDfHCjuBXpSVLcX xJmFejMbvvYoHtaMx4tOVLJEsx4Cv4EDFtX5Ehx5w9QEDWY0rc43PdAXK3RyFoGfAr /6e4R8sYhWSDxsHLxjYRtD5kXvzmLlGsO5TnyKEA= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20220720041022epcas5p282c1d02ab035ec90698a6fc141ad1c66~DbiveVQFT1619516195epcas5p2W; Wed, 20 Jul 2022 04:10:22 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.183]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4Lnj0W6LLdz4x9Px; Wed, 20 Jul 2022 04:10:19 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id 70.AA.09639.82087D26; Wed, 20 Jul 2022 13:10:16 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20220719135836epcas5p3f28b20cab964ced538d5a7fdfe367bb4~DP7DgaOdl2074120741epcas5p3K; Tue, 19 Jul 2022 13:58:36 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220719135836epsmtrp21d4ba601f29470ec5f10f380ee620405~DP7DfqY7C1903019030epsmtrp24; Tue, 19 Jul 2022 13:58:36 +0000 (GMT) X-AuditID: b6c32a4b-e83ff700000025a7-2c-62d780282fc2 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 35.3D.08802.C88B6D26; Tue, 19 Jul 2022 22:58:36 +0900 (KST) Received: from test-zns.sa.corp.samsungelectronics.net (unknown [107.110.206.5]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220719135835epsmtip12c66f8e0eff39b8ba893d5d4c607441c~DP7CVr1pk2149321493epsmtip1d; Tue, 19 Jul 2022 13:58:35 +0000 (GMT) From: Ankit Kumar To: axboe@kernel.dk Cc: io-uring@vger.kernel.org, paul@paul-moore.com, casey@schaufler-ca.com, joshi.k@samsung.com, Ankit Kumar Subject: [PATCH liburing 4/5] test: add io_uring passthrough test Date: Tue, 19 Jul 2022 19:22:33 +0530 Message-Id: <20220719135234.14039-5-ankit.kumar@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220719135234.14039-1-ankit.kumar@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrBKsWRmVeSWpSXmKPExsWy7bCmhq5Gw/Ukg+dXBCzWXPnNbrH6bj+b xb1tv9gs3rWeY7E4+v8tm8XtSdNZHNg8Lp8t9Vi79wWjR9+WVYweR/cvYvP4vEkugDUq2yYj NTEltUghNS85PyUzL91WyTs43jne1MzAUNfQ0sJcSSEvMTfVVsnFJ0DXLTMH6AAlhbLEnFKg UEBicbGSvp1NUX5pSapCRn5xia1SakFKToFJgV5xYm5xaV66Xl5qiZWhgYGRKVBhQnbGyzat gt0OFXMWvmdqYHxs0MXIwSEhYCJxandGFyMnh5DAbkaJF8dcuxi5gOxPjBKzl65khXA+M0pM vrONDabh+ARViPguRonjP5vZIJxWJokn134xg4xiE9CWePX2BpgtIiAssb+jlQWkiFmgnVHi w4Ij7CAJYQFHiVmfb7CB2CwCqhIfzn9gAbF5BWwkll45yQhiSwjIS6zecABsEKeArcSH7S+Z QQZJCBxil1g//TgLRJGLROfP/cwQtrDEq+Nb2CFsK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guLc9NxiwwKjvNRyveLE3OLSvHS95PzcTYzgINPS2sG4Z9UHvUOM TByMhxglOJiVRHhFai8nCfGmJFZWpRblxxeV5qQWH2KU5mBREue90HUyXkggPbEkNTs1tSC1 CCbLxMEp1cAkl7fDp+WHpYYc25/dOSKdP5mvhUyQfx6Sqfx9RtrdptZy6eXnNaUllzXNSjd6 ePKU3RG3+2cr3nff7ncvOq9WGv9ZhsvG7sUjE8spz/L8r+w6I+p54+nT/aFS+3dumq1x6Em9 4e9vP7MUpxgzty7s2tKRfCzF6Hdw5+TZ/2v5p8clffwXWFS9oHzlwuOnFnZLrXumsTNpZSHj E9Ofi3ffvuLzvLHPOLtub46G+kKZRSuUJvAf5rR/0vt9/6R/YorKhyInc2eGPL4/Y7PMp8ZX EfeeVOndMX55KCb/UW/TCsVzk+OuTTrycvqFF/NVUnueSE6a3XlMI4vxwfaovdknZfs99v8t M890fv3/49EKeyWW4oxEQy3mouJEAPgILP6hAgAA X-CMS-MailID: 20220719135836epcas5p3f28b20cab964ced538d5a7fdfe367bb4 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220719135836epcas5p3f28b20cab964ced538d5a7fdfe367bb4 References: <20220719135234.14039-1-ankit.kumar@samsung.com> Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Add a way to test uring passthrough commands, which was added with 5.19 kernel. This requires nvme-ns character device (/dev/ngXnY) as filename argument. It runs a combination of read/write tests with sqthread poll, vectored and non-vectored commands, fixed I/O buffers. Signed-off-by: Ankit Kumar --- test/Makefile | 1 + test/io_uring_passthrough.c | 319 ++++++++++++++++++++++++++++++++++++ 2 files changed, 320 insertions(+) create mode 100644 test/io_uring_passthrough.c diff --git a/test/Makefile b/test/Makefile index 45674c3..8cafcfd 100644 --- a/test/Makefile +++ b/test/Makefile @@ -90,6 +90,7 @@ test_srcs := \ io-cancel.c \ iopoll.c \ io_uring_enter.c \ + io_uring_passthrough.c \ io_uring_register.c \ io_uring_setup.c \ lfs-openat.c \ diff --git a/test/io_uring_passthrough.c b/test/io_uring_passthrough.c new file mode 100644 index 0000000..2e2b806 --- /dev/null +++ b/test/io_uring_passthrough.c @@ -0,0 +1,319 @@ +/* SPDX-License-Identifier: MIT */ +/* + * Description: basic read/write tests for io_uring passthrough commands + */ +#include +#include +#include +#include +#include + +#include "helpers.h" +#include "liburing.h" +#include "nvme.h" + +#define FILE_SIZE (256 * 1024) +#define BS 8192 +#define BUFFERS (FILE_SIZE / BS) + +static struct iovec *vecs; + +/* + * Each offset in the file has the ((test_case / 2) * FILE_SIZE) + * + (offset / sizeof(int)) stored for every + * sizeof(int) address. + */ +static int verify_buf(int tc, void *buf, off_t off) +{ + int i, u_in_buf = BS / sizeof(unsigned int); + unsigned int *ptr; + + off /= sizeof(unsigned int); + off += (tc / 2) * FILE_SIZE; + ptr = buf; + for (i = 0; i < u_in_buf; i++) { + if (off != *ptr) { + fprintf(stderr, "Found %u, wanted %lu\n", *ptr, off); + return 1; + } + ptr++; + off++; + } + + return 0; +} + +static int fill_pattern(int tc) +{ + unsigned int val, *ptr; + int i, j; + int u_in_buf = BS / sizeof(val); + + val = (tc / 2) * FILE_SIZE; + for (i = 0; i < BUFFERS; i++) { + ptr = vecs[i].iov_base; + for (j = 0; j < u_in_buf; j++) { + *ptr = val; + val++; + ptr++; + } + } + + return 0; +} + +static int __test_io(const char *file, struct io_uring *ring, int tc, int read, + int sqthread, int fixed, int nonvec) +{ + struct io_uring_sqe *sqe; + struct io_uring_cqe *cqe; + struct nvme_uring_cmd *cmd; + int open_flags; + int do_fixed; + int i, ret, fd = -1; + off_t offset; + __u64 slba; + __u32 nlb; + +#ifdef VERBOSE + fprintf(stdout, "%s: start %d/%d/%d/%d: ", __FUNCTION__, read, + sqthread, fixed, + nonvec); +#endif + if (read) + open_flags = O_RDONLY; + else + open_flags = O_WRONLY; + + if (fixed) { + ret = t_register_buffers(ring, vecs, BUFFERS); + if (ret == T_SETUP_SKIP) + return 0; + if (ret != T_SETUP_OK) { + fprintf(stderr, "buffer reg failed: %d\n", ret); + goto err; + } + } + + fd = open(file, open_flags); + if (fd < 0) { + perror("file open"); + goto err; + } + + if (sqthread) { + ret = io_uring_register_files(ring, &fd, 1); + if (ret) { + fprintf(stderr, "file reg failed: %d\n", ret); + goto err; + } + } + + if (!read) + fill_pattern(tc); + + offset = 0; + for (i = 0; i < BUFFERS; i++) { + sqe = io_uring_get_sqe(ring); + if (!sqe) { + fprintf(stderr, "sqe get failed\n"); + goto err; + } + if (read) { + int use_fd = fd; + + do_fixed = fixed; + + if (sqthread) + use_fd = 0; + if (fixed && (i & 1)) + do_fixed = 0; + if (do_fixed) { + io_uring_prep_read_fixed(sqe, use_fd, vecs[i].iov_base, + vecs[i].iov_len, + offset, i); + sqe->cmd_op = NVME_URING_CMD_IO; + } else if (nonvec) { + io_uring_prep_read(sqe, use_fd, vecs[i].iov_base, + vecs[i].iov_len, offset); + sqe->cmd_op = NVME_URING_CMD_IO; + } else { + io_uring_prep_readv(sqe, use_fd, &vecs[i], 1, + offset); + sqe->cmd_op = NVME_URING_CMD_IO_VEC; + } + } else { + int use_fd = fd; + + do_fixed = fixed; + + if (sqthread) + use_fd = 0; + if (fixed && (i & 1)) + do_fixed = 0; + if (do_fixed) { + io_uring_prep_write_fixed(sqe, use_fd, vecs[i].iov_base, + vecs[i].iov_len, + offset, i); + sqe->cmd_op = NVME_URING_CMD_IO; + } else if (nonvec) { + io_uring_prep_write(sqe, use_fd, vecs[i].iov_base, + vecs[i].iov_len, offset); + sqe->cmd_op = NVME_URING_CMD_IO; + } else { + io_uring_prep_writev(sqe, use_fd, &vecs[i], 1, + offset); + sqe->cmd_op = NVME_URING_CMD_IO_VEC; + } + } + sqe->opcode = IORING_OP_URING_CMD; + sqe->user_data = ((uint64_t)offset << 32) | i; + if (sqthread) + sqe->flags |= IOSQE_FIXED_FILE; + + /* 80 bytes for NVMe uring passthrough command */ + cmd = (struct nvme_uring_cmd *)sqe->cmd; + memset(cmd, 0, sizeof(struct nvme_uring_cmd)); + + cmd->opcode = read ? nvme_cmd_read : nvme_cmd_write; + + slba = offset >> lba_shift; + nlb = (BS >> lba_shift) - 1; + + /* cdw10 and cdw11 represent starting lba */ + cmd->cdw10 = slba & 0xffffffff; + cmd->cdw11 = slba >> 32; + /* cdw12 represent number of lba's for read/write */ + cmd->cdw12 = nlb; + if (do_fixed || nonvec) { + cmd->addr = (__u64)(uintptr_t)vecs[i].iov_base; + cmd->data_len = vecs[i].iov_len; + } else { + cmd->addr = (__u64)(uintptr_t)&vecs[i]; + cmd->data_len = 1; + } + cmd->nsid = nsid; + + offset += BS; + } + + ret = io_uring_submit(ring); + if (ret != BUFFERS) { + fprintf(stderr, "submit got %d, wanted %d\n", ret, BUFFERS); + goto err; + } + + for (i = 0; i < BUFFERS; i++) { + ret = io_uring_wait_cqe(ring, &cqe); + if (ret) { + fprintf(stderr, "wait_cqe=%d\n", ret); + goto err; + } + if (cqe->res != 0) { + fprintf(stderr, "cqe res %d, wanted 0\n", cqe->res); + goto err; + } + io_uring_cqe_seen(ring, cqe); + if (read) { + int index = cqe->user_data & 0xffffffff; + void *buf = vecs[index].iov_base; + off_t voff = cqe->user_data >> 32; + + if (verify_buf(tc, buf, voff)) + goto err; + } + } + + if (fixed) { + ret = io_uring_unregister_buffers(ring); + if (ret) { + fprintf(stderr, "buffer unreg failed: %d\n", ret); + goto err; + } + } + if (sqthread) { + ret = io_uring_unregister_files(ring); + if (ret) { + fprintf(stderr, "file unreg failed: %d\n", ret); + goto err; + } + } + + close(fd); +#ifdef VERBOSE + fprintf(stdout, "PASS\n"); +#endif + return 0; +err: +#ifdef VERBOSE + fprintf(stderr, "FAILED\n"); +#endif + if (fd != -1) + close(fd); + return 1; +} + +static int test_io(const char *file, int tc, int read, int sqthread, + int fixed, int nonvec) +{ + struct io_uring ring; + int ret, ring_flags = 0; + + ring_flags |= IORING_SETUP_SQE128; + ring_flags |= IORING_SETUP_CQE32; + + if (sqthread) + ring_flags |= IORING_SETUP_SQPOLL; + + ret = t_create_ring(64, &ring, ring_flags); + if (ret == T_SETUP_SKIP) + return 0; + if (ret != T_SETUP_OK) { + fprintf(stderr, "ring create failed: %d\n", ret); + return 1; + } + + ret = __test_io(file, &ring, tc, read, sqthread, fixed, nonvec); + io_uring_queue_exit(&ring); + + return ret; +} + +int main(int argc, char *argv[]) +{ + int i, ret; + char *fname; + + if (argc < 2) { + printf("%s: requires NVMe character device\n", argv[0]); + return T_EXIT_SKIP; + } + + fname = argv[1]; + ret = fio_nvme_get_info(fname); + + if (ret) { + fprintf(stderr, "failed to fetch device info: %d\n", ret); + goto err; + } + + vecs = t_create_buffers(BUFFERS, BS); + + for (i = 0; i < 16; i++) { + int read = (i & 1) != 0; + int sqthread = (i & 2) != 0; + int fixed = (i & 4) != 0; + int nonvec = (i & 8) != 0; + + ret = test_io(fname, i, read, sqthread, fixed, nonvec); + if (ret) { + fprintf(stderr, "test_io failed %d/%d/%d/%d\n", + read, sqthread, fixed, nonvec); + goto err; + } + } + + return T_EXIT_PASS; +err: + return T_EXIT_FAIL; +} From patchwork Tue Jul 19 13:52:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankit Kumar X-Patchwork-Id: 12923484 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 96AEBC43334 for ; Wed, 20 Jul 2022 04:10:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234379AbiGTEKl (ORCPT ); Wed, 20 Jul 2022 00:10:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229618AbiGTEKk (ORCPT ); Wed, 20 Jul 2022 00:10:40 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D872D275D1 for ; Tue, 19 Jul 2022 21:10:38 -0700 (PDT) Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20220720041036epoutp014cac7101738b3afea020a31edca0dbba~Dbi8RAW3-1061010610epoutp019 for ; Wed, 20 Jul 2022 04:10:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20220720041036epoutp014cac7101738b3afea020a31edca0dbba~Dbi8RAW3-1061010610epoutp019 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1658290236; bh=V6kCFEnNmUA65C9BXm3wlYHngtC9W67zIvUb4TG3zS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vJzrxzmRGFZeYyl8EmRU3GIdU3NYh+XCiE27YI4zFWDlko2vFvtMCTGKbPVdeCuF8 p43jUaROu5L8reZv9fujnDydpKE7wZ3aVlV3BHXlxvgZ2x3q+QubYp3UkhnEcQpiPl v+ZRGDK0ROeSIA6C8tOEcqbCdw5+UWiaDBSLUFvI= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20220720041035epcas5p31e6b12adf3c406e754d80ae35c99a429~Dbi73xH2_0451004510epcas5p3I; Wed, 20 Jul 2022 04:10:35 +0000 (GMT) Received: from epsmges5p2new.samsung.com (unknown [182.195.38.180]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4Lnj0n4d0Zz4x9Q9; Wed, 20 Jul 2022 04:10:33 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 0A.B6.09566.63087D26; Wed, 20 Jul 2022 13:10:30 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20220719135837epcas5p1eb4beb20bdfbdaaa7409d7b1f6355909~DP7Eh6UvV1434214342epcas5p1D; Tue, 19 Jul 2022 13:58:37 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220719135837epsmtrp2c68857bc577dc90c0e080a5294ae0636~DP7EhLzEY1852218522epsmtrp2R; Tue, 19 Jul 2022 13:58:37 +0000 (GMT) X-AuditID: b6c32a4a-b8dff7000000255e-3c-62d78036d402 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id BC.7A.08905.D88B6D26; Tue, 19 Jul 2022 22:58:37 +0900 (KST) Received: from test-zns.sa.corp.samsungelectronics.net (unknown [107.110.206.5]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220719135836epsmtip13b0b8019b86389594781a469ccb47a51~DP7DleMl00140301403epsmtip1H; Tue, 19 Jul 2022 13:58:36 +0000 (GMT) From: Ankit Kumar To: axboe@kernel.dk Cc: io-uring@vger.kernel.org, paul@paul-moore.com, casey@schaufler-ca.com, joshi.k@samsung.com, Ankit Kumar Subject: [PATCH liburing 5/5] test/io_uring_passthrough: add test case for poll IO Date: Tue, 19 Jul 2022 19:22:34 +0530 Message-Id: <20220719135234.14039-6-ankit.kumar@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220719135234.14039-1-ankit.kumar@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNKsWRmVeSWpSXmKPExsWy7bCmhq5Zw/Ukg62bNS3WXPnNbrH6bj+b xb1tv9gs3rWeY7E4+v8tm8XtSdNZHNg8Lp8t9Vi79wWjR9+WVYweR/cvYvP4vEkugDUq2yYj NTEltUghNS85PyUzL91WyTs43jne1MzAUNfQ0sJcS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gFupnluLIzCtJLcpLzFFi42LZdlhJTrd3x7Ukg0MHdS3WXPnNbrH6bj+b xb1tv9gs3rWeY7E4+v8tm8XtSdNZHNg8Lp8t9Vi79wWjR9+WVYweR/cvYvP4vEkugDWKyyYl NSezLLVI3y6BK+P54d3MBd9FKp6dWMDewLhPoIuRk0NCwETi6+eTbF2MXBxCArsZJZ41NDJ1 MXIAJaQlFq5PhKgRllj57zk7RE0zk8TESXuYQBJsAtoSr97eYAaxRYCK9ne0soAUMQv0Mkqs /H8EbJCwQJBEV5MJSA2LgKpE971ZzCBhXgEbiY1LiiHmy0us3nAAbAyngK3Eh+0vwWwhoJJv d2ayT2DkW8DIsIpRMrWgODc9t9iwwDAvtVyvODG3uDQvXS85P3cTIzjMtDR3MG5f9UHvECMT B+MhRgkOZiURXpHay0lCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeS90nYwXEkhPLEnNTk0tSC2C yTJxcEo1MM3+rJiwzmtzx7InChduC6bbLHVUWGKSzK24KKkg/UCiqdee9cJGMz9Ncdyuy1j0 rvrX4zi1eZbPQ4vtngZ3LTylvVm0d9/q4+eSuOrOmVgfXZAulqGuFXb5Q8CGS+d89Xc6b1vN P2WT6YxvOzNiFIuWcmU+Sb5jYO8zeXJwQnp/h7GtZ2L9t8rPF9Iq1s3Uk3G93b1eMSFvuj9v euwvKzHxT1M36uj03r10ZVUDT/+C16ZmKdb7DVZEfTdYcrzUiVGL941MlNaxrR8y2tZ5fkpP 279+Qlj5o+t76sQt9YqfivlLhmvwaOgUL/tcpS0X+fCTuNrFW56JFcHqrT6PV+zsfyO6Rrxg 8VN+wWfdSizFGYmGWsxFxYkAZ7qSrKICAAA= X-CMS-MailID: 20220719135837epcas5p1eb4beb20bdfbdaaa7409d7b1f6355909 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220719135837epcas5p1eb4beb20bdfbdaaa7409d7b1f6355909 References: <20220719135234.14039-1-ankit.kumar@samsung.com> Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org For uring passthrough add test case for poll IO completion. If poll IO is not supported return success. Signed-off-by: Ankit Kumar --- test/io_uring_passthrough.c | 76 +++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/test/io_uring_passthrough.c b/test/io_uring_passthrough.c index 2e2b806..acb57f8 100644 --- a/test/io_uring_passthrough.c +++ b/test/io_uring_passthrough.c @@ -10,6 +10,7 @@ #include "helpers.h" #include "liburing.h" +#include "../src/syscall.h" #include "nvme.h" #define FILE_SIZE (256 * 1024) @@ -279,6 +280,75 @@ static int test_io(const char *file, int tc, int read, int sqthread, return ret; } +extern int __io_uring_flush_sq(struct io_uring *ring); + +/* + * if we are polling io_uring_submit needs to always enter the + * kernel to fetch events + */ +static int test_io_uring_submit_enters(const char *file) +{ + struct io_uring ring; + int fd, i, ret, ring_flags, open_flags; + unsigned head; + struct io_uring_cqe *cqe; + + ring_flags = IORING_SETUP_IOPOLL; + ring_flags |= IORING_SETUP_SQE128; + ring_flags |= IORING_SETUP_CQE32; + + ret = io_uring_queue_init(64, &ring, ring_flags); + if (ret) { + fprintf(stderr, "ring create failed: %d\n", ret); + return 1; + } + + open_flags = O_WRONLY; + fd = open(file, open_flags); + if (fd < 0) { + perror("file open"); + goto err; + } + + for (i = 0; i < BUFFERS; i++) { + struct io_uring_sqe *sqe; + off_t offset = BS * (rand() % BUFFERS); + + sqe = io_uring_get_sqe(&ring); + io_uring_prep_writev(sqe, fd, &vecs[i], 1, offset); + sqe->user_data = 1; + } + + /* submit manually to avoid adding IORING_ENTER_GETEVENTS */ + ret = __sys_io_uring_enter(ring.ring_fd, __io_uring_flush_sq(&ring), 0, + 0, NULL); + if (ret < 0) + goto err; + + for (i = 0; i < 500; i++) { + ret = io_uring_submit(&ring); + if (ret != 0) { + fprintf(stderr, "still had %d sqes to submit, this is unexpected", ret); + goto err; + } + + io_uring_for_each_cqe(&ring, head, cqe) { + if (cqe->res == -EOPNOTSUPP) + fprintf(stdout, "doesn't support polled IO\n"); + goto ok; + } + usleep(10000); + } +err: + ret = 1; + if (fd != -1) + close(fd); + +ok: + io_uring_queue_exit(&ring); + return ret; +} + int main(int argc, char *argv[]) { int i, ret; @@ -313,6 +383,12 @@ int main(int argc, char *argv[]) } } + ret = test_io_uring_submit_enters(fname); + if (ret) { + fprintf(stderr, "test_io_uring_submit_enters failed\n"); + goto err; + } + return T_EXIT_PASS; err: return T_EXIT_FAIL;