From patchwork Sun Sep 1 13:36:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13786440 Received: from outbound-ip191a.ess.barracuda.com (outbound-ip191a.ess.barracuda.com [209.222.82.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4474A14F9F1; Sun, 1 Sep 2024 13:37:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725197839; cv=fail; b=GpoCAKabNk2ht85hgt9jGk60WLQs4DJzuMxE67NcLWpOzGhqYBtLTTKbbnhZDgn5AksHqvHJDj7ckrDYfFu7cfYiaR3uoiioursOSzfJU/2VV8HGdv1R5lFUDy3hrsmsf/7FNOV+rOBiWWYfe4l64HDiIPSWqlUUz2THSCwNTew= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725197839; c=relaxed/simple; bh=uLVuRbDRdNskIgEn+OHh8ksb7ZOBJ99vCuhAK7xxins=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=s7x0X6d4xqUdcbU82qayxJlnobCD0cZ2gsNK1XcLtz0wQhzuL6jWZUCZF66tDbMo8qaZ1UQY5J5uVePsJ/diOyzvFUPTdBJZcSrZvXEEKnITYvRN3Ah4PaIQHeN4Aq3GdUjyHuFbAvOfJFcSGNj/XzBhRVvPVfx7w9krtETb9EM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=gKqcM3Cr; arc=fail smtp.client-ip=209.222.82.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="gKqcM3Cr" Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2171.outbound.protection.outlook.com [104.47.57.171]) by mx-outbound46-102.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 01 Sep 2024 13:37:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BQiy/MiO2xn+kHLULsbE3OIq9Rp5V8PFusgpxZ9QUlMEhEMqxScgutPsShz4D9BXejdLNYyc6uqMv835qd5EksFnOFdIfEEP3fpphHzPv58gK2orw0vQh3gow4V1HGyo7oxBcPAGgiJsu3/u1xzub+7HnFeYNcY9haVuOYHcXv8rO6o5K9HPUHvBn9BuevzFHF/KLb4g3SVWSdbq9Km78WdCBf6qJI/Z7kxm8l2+FyP/nlzloxeQh8/YqjB64aqKQboETbi1xxzq35HZ4UvmBnuh5FFtF2PwSKcO9FMY9jgcttXtfRJN02EodXlU0LivF5AkJiaYMvSHsOiaGgECDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WkCkFVmj73WwUKv/B6JEhehEIp/wAG43uxDCFspdcvE=; b=UFMRAoa6Djh8eey2Lj00Vo9CZ1qY40iD8wZWJuWmEKPoZW5X2gKx88OYk549tz1jVPHPL3SizxszQgjbSUWsXyEmgiEZpUUAklITCv3x/x0dP2vFE1wrLtY/GCiWhVtYDRl6cUOFOIUTF5SDkQNnAN2yKdL7qEunB5bE0A/5PVGmlgD6rdzB0aj3oVzdQ5Cyif+OwCo6dFBhLD17vR/gsJ0XoMyxtMZIy1abrJ/V/Syl4LSczmdasMvPRMe9q07jpwWGCSoBfrz4BBwS5YF5nTbT3t1Ql2R3OzL9Aas9JxUTi/BWwyEiDsxtZk9fJ3U0xRMTAz/J+a4XT9+Ukbbw3g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WkCkFVmj73WwUKv/B6JEhehEIp/wAG43uxDCFspdcvE=; b=gKqcM3CrkYXkYZKj48EInK7nbKyaLvIW81+nnuxUbHTc+v2m1BKAU9jU1/RXuqFSQVgLw6RLgZA8ilddYmB4e8tAOdSDg34CEHBX1lKqOSA2+x4+tS0KzeyytrCzlUc6bc+O/hWntKsW2S1VxjqDK63FH+fqWzYcFEe8hCL6zpo= Received: from SA9PR13CA0012.namprd13.prod.outlook.com (2603:10b6:806:21::17) by PH0PR19MB7426.namprd19.prod.outlook.com (2603:10b6:510:28a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.23; Sun, 1 Sep 2024 13:37:02 +0000 Received: from SN1PEPF0002636A.namprd02.prod.outlook.com (2603:10b6:806:21:cafe::51) by SA9PR13CA0012.outlook.office365.com (2603:10b6:806:21::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.23 via Frontend Transport; Sun, 1 Sep 2024 13:37:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by SN1PEPF0002636A.mail.protection.outlook.com (10.167.241.135) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.7918.13 via Frontend Transport; Sun, 1 Sep 2024 13:37:02 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 8E43C72; Sun, 1 Sep 2024 13:37:01 +0000 (UTC) From: Bernd Schubert Date: Sun, 01 Sep 2024 15:36:58 +0200 Subject: [PATCH RFC v3 04/17] fuse: Add fuse-io-uring design documentation Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240901-b4-fuse-uring-rfcv3-without-mmap-v3-4-9207f7391444@ddn.com> References: <20240901-b4-fuse-uring-rfcv3-without-mmap-v3-0-9207f7391444@ddn.com> In-Reply-To: <20240901-b4-fuse-uring-rfcv3-without-mmap-v3-0-9207f7391444@ddn.com> To: Miklos Szeredi , Jens Axboe , Pavel Begunkov , bernd@fastmail.fm Cc: linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Bernd Schubert X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1725197817; l=5011; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=uLVuRbDRdNskIgEn+OHh8ksb7ZOBJ99vCuhAK7xxins=; b=MHP0dubGPSk/WDuH10OFmqwWHyPFvR7vxYkfnOzhHjQy38Xe7ivqY+5ysYgyg7HytV3xdFVJG P6r8A/fG7HbDNKYUR0IUyD3pUMMqJPOGj37c9oBxOURIfIDFnQ7HzIY X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002636A:EE_|PH0PR19MB7426:EE_ X-MS-Office365-Filtering-Correlation-Id: 456ce1a7-a28a-4e86-b56b-08dcca8b2950 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?xKJNvKsh7UebjqHtLFM0n4lEbVxXkeH?= =?utf-8?q?o5mmC3czGdEtN9UPj7zcF9Xyhs5gxHFE/9d3xfj+3nf1iKzmD8E07mm7iCifV8izf?= =?utf-8?q?V922gfRourlCLnKN9fr4f9vEsQIg/MxuDr+TtdIOJNDoOzqJ0f0R0vESOzog3Ptgb?= =?utf-8?q?CTCXwtKj7OBfJT19XkSmlngvJGanWHKtg81GrZa743FPdAmt0/1ITzXXIBt0bOrOv?= =?utf-8?q?9181EqXDxrFLcdSYydDtxXyq+X2NvM6tdoB6E6eAARZXEFnvcZSI/K7C7TdfLZP8+?= =?utf-8?q?947DYVtXSpQUGtKc/0WvLagfeoKMR5BVVGmZp7oNg86PVtxJtsOES0xd7CvTAPh6E?= =?utf-8?q?x2JyzyHqkNhfQkdv3adVmv8y0okmPYG1mBzkENR4i/tvcoqufHSWJFasZNOQKf40/?= =?utf-8?q?uvwc9PbqqoH4hYJFnAXf6Og+u5K8UVZsAZOlhlpMFZm5cpJHp+i76c6nyinzrCiSz?= =?utf-8?q?TJd4Xk9FXuQj8ZwA2Z6f7bFlFrIAgAJGCvOESupVTiIswHaEkVNiRlMbGHUhYb8iU?= =?utf-8?q?kwKJDAAWe3j5TopfBuasx+UKKGpyDrmAbFen3Ujcbb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Y:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 69oQE6ibkMf4ZE/B/maCfgRnmZtCTTvdlvIHr+LFiobNhSVPuBE2ofk1CTsL71gnGllG2ppl0oPWEApn+ntm68USYHb4atE9JpMLvBq/LL5CuCG0inaxRrPkZl4IiRsM7g4DFQAwtI3pFxdqftV6HonMLwUSDkAo/45RobH2ldVNBP20IYhjcnwFezv+cgXff1YjFUjIyLqBo4aLQ7TMltk69jeiJ4ZXglWjN/nl4HIqoQ4N9B/xz5vg+dC1h0GYmh1DG5PkdiWS0BfRNH1r0YBIJxf1ZDusIeW/9JrO4ZZBaYCsO3RlpaHETS948jMX1UDFTq1NVCd5Z04ZCnH/Z3iTbnST3lMqHh3XmopdC+V8dw6OXcLO38W2ULbUtWJcoczEhl4ZYHPrSkYGKIdK36i1EWbBVcUYf3pXx7IZIxCfnV8Wjo+2Vv+p09DneDIWhULu2LnuwtfQDvhBfzjHZGR7zuymeZb1UNpTjeskRZcMoRTKzPtISRFIUDEtgGk9+LBsbeIjvYcqNn1amoWhryWmN4Mk7kT5tXGzlwWGBRe7B097EbE4/GecO5qbjsAWbesXkWta3dNr0s9qnLz/dXDxNVzPVtWxTDmsZrOfR1/HsJnawwGQ1nJip9XtcFFNvR55VwrwlgOlGBb6Q5ibPw== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2024 13:37:02.1250 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 456ce1a7-a28a-4e86-b56b-08dcca8b2950 X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF0002636A.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR19MB7426 X-BESS-ID: 1725197825-111878-25435-67287-1 X-BESS-VER: 2019.1_20240829.0001 X-BESS-Apparent-Source-IP: 104.47.57.171 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKViYWlgZAVgZQMNHEwNIyMdXIzN g8xdQ00SLFODnJ0ijJ3CItOTHFIslAqTYWAEqm3Q9BAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.258743 [from cloudscan11-219.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Signed-off-by: Bernd Schubert --- Documentation/filesystems/fuse-io-uring.rst | 108 ++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/Documentation/filesystems/fuse-io-uring.rst b/Documentation/filesystems/fuse-io-uring.rst new file mode 100644 index 000000000000..0f1e8bb7eca6 --- /dev/null +++ b/Documentation/filesystems/fuse-io-uring.rst @@ -0,0 +1,108 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=============================== +FUSE Uring design documentation +============================== + +This documentation covers basic details how the fuse +kernel/userspace communication through uring is configured +and works. For generic details about FUSE see fuse.rst. + +This document also covers the current interface, which is +still in development and might change. + +Limitations +=========== +As of now not all requests types are supported through uring, userspace +is required to also handle requests through /dev/fuse after +uring setup is complete. Specifically notifications (initiated from +the daemon side) and interrupts. + +Fuse uring configuration +======================== + +Fuse kernel requests are queued through the classical /dev/fuse +read/write interface - until uring setup is complete. + +In order to set up fuse-over-io-uring userspace has to send a ring initiation +and configuration ioctl(FUSE_DEV_IOC_URING_CFG) and then per queue +the FUSE_DEV_IOC_URING_QUEUE_CFG. The latter will is mostly indentical +with FUSE_DEV_IOC_CLONE, but also contains the qid. + +Kernel - userspace interface using uring +======================================== + +After queue ioctl setup userspace submits +SQEs (opcode = IORING_OP_URING_CMD) in order to fetch +fuse requests. Initial submit is with the sub command +FUSE_URING_REQ_FETCH, which will just register entries +to be available in the kernel. + +Once all entries for all queues are submitted, kernel starts +to enqueue to ring queues. +Userspace handles the CQE/fuse-request and submits the result as +subcommand FUSE_URING_REQ_COMMIT_AND_FETCH - kernel completes +the requests and also marks the entry available again. If there are +pending requests waiting the request will be immediately submitted +to the daemon again. + +Initial SQE +----------- + + | | FUSE filesystem daemon + | | + | | >io_uring_submit() + | | IORING_OP_URING_CMD / + | | FUSE_URING_REQ_FETCH + | | [wait cqe] + | | >io_uring_wait_cqe() or + | | >io_uring_submit_and_wait() + | | + | >fuse_uring_cmd() | + | >fuse_uring_fetch() | + | >fuse_uring_ent_release() | + + +Sending requests with CQEs +-------------------------- + + | | FUSE filesystem daemon + | | [waiting for CQEs] + | "rm /mnt/fuse/file" | + | | + | >sys_unlink() | + | >fuse_unlink() | + | [allocate request] | + | >__fuse_request_send() | + | ... | + | >fuse_uring_queue_fuse_req | + | [queue request on fg or | + | bg queue] | + | >fuse_uring_assign_ring_entry() | + | >fuse_uring_send_to_ring() | + | >fuse_uring_copy_to_ring() | + | >io_uring_cmd_done() | + | >request_wait_answer() | + | [sleep on req->waitq] | + | | [receives and handles CQE] + | | [submit result and fetch next] + | | >io_uring_submit() + | | IORING_OP_URING_CMD/ + | | FUSE_URING_REQ_COMMIT_AND_FETCH + | >fuse_uring_cmd() | + | >fuse_uring_commit_and_release() | + | >fuse_uring_copy_from_ring() | + | [ copy the result to the fuse req] | + | >fuse_uring_req_end_and_get_next() | + | >fuse_request_end() | + | [wake up req->waitq] | + | >fuse_uring_ent_release_and_fetch()| + | [wait or handle next req] | + | | + | | + | [req->waitq woken up] | + |