Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp858118pxu; Thu, 3 Dec 2020 14:37:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJwmcFMs6gTjLyMeoxSECQgth8RyOP1yFa5usz6Gun16dW7+wpMBZMIoyEQmaium88fOLaM6 X-Received: by 2002:a50:9d4f:: with SMTP id j15mr4969299edk.69.1607035077479; Thu, 03 Dec 2020 14:37:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607035077; cv=none; d=google.com; s=arc-20160816; b=J67ygNrxIcBDy+WuTrmJjvBssAFIrkHcholYgB6UszZfFgRdQQ8ZjRxGZerwUnAq5c ub3Ra3BkQycktF34wiQIZWm36Zk3YiQ7YDWPq+EyGjty3lYIPxdAIpcqssh9vD5BFp4M J6mqwCAwGEUKpPWJDtzwMUG+3OfnOgdsMG22LUvmb9SH7TdPjEM/ODLRTXSuGdA9YLVk +jCSbeIo96zHQlsJ6prVIDnW5DBwSh/73PvJQ60hnltQJhQqI4quf2ya4iCqVyvAO8Vp RnwmZiACV6vx38/9LKw3vx4g/IMyD3+1pbVme0MsxLjsWgcLGzuYblwRF2PzPQcKa91n DqJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:cc:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject :dkim-signature; bh=isS72LcXXBRrXr0Ako/fe2G087FHJYFoOicsYh1AWO8=; b=knqSw9S2LPszsihzG/AeL1MwuBUfJXn9WAyBh4BwiEkuJLsKibVHsJCSbCarLCgklO tTYdY9fsfIZDxSvzK68u9z5AAE1GRMGw98y8PeRMSJW0mlWt8b8rs8CbFIdeXPUW4pCc gAuULOM3Fwby436KT9eVs6Yy2c47yN0mWwtb39FLJW5Gu1dAoWCXt5ksFNOVJyLNVwKx 6OBM7pAimhaDHtY9VnbbfvCssZInGf/DWJhOL8HJB1XPz5IwybbFabvqMietYOYkKb8T Tau3c3g1cZC/mbj6FMCT6kGKm+nRrJT6fKwRY2BfieefExQQ8MSjMzuBj7kshh2CpS5h PbEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=n9Tgm2Hi; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qk27si217862ejb.615.2020.12.03.14.37.31; Thu, 03 Dec 2020 14:37:57 -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=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=n9Tgm2Hi; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731814AbgLCWdt (ORCPT + 99 others); Thu, 3 Dec 2020 17:33:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728636AbgLCWds (ORCPT ); Thu, 3 Dec 2020 17:33:48 -0500 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B507C08E860 for ; Thu, 3 Dec 2020 14:32:27 -0800 (PST) Received: by mail-pf1-x442.google.com with SMTP id o9so2287564pfd.10 for ; Thu, 03 Dec 2020 14:32:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20150623.gappssmtp.com; s=20150623; h=subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding:cc:from:to; bh=isS72LcXXBRrXr0Ako/fe2G087FHJYFoOicsYh1AWO8=; b=n9Tgm2HiezYP/Ask48/IujNV3+jpE7cAZxD1tbqft+4LOAW8/m/e4j9wHEoLavTI4Z hSLUicihywE1d/WNoTSMTG5cPEt6IL70OKZXoNWZKKsNB8F8OkFKzDHZqm+f/sOZNYPz 8j5e+HCi8SdKdA7Xu2RuFpwxLd62E/liW6ieEEDoJO1kbRJ7HadhezHYjY2iSllw8wbQ tUkB72H2Css+K9VJVsCYkwSfkLuH324cFrRzdu9C/twxVdfY+7sTOiEDRSZLMsa0UJkB wjzzKRldHy8lIsto9UZtLgh7GCR7mYt6IsYqp6pH8Tj46iWzOI8zERroIO9s4oMqIBLi zN1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:cc:from:to; bh=isS72LcXXBRrXr0Ako/fe2G087FHJYFoOicsYh1AWO8=; b=Vj+OPclFpGD513tG9rdCswjeqHKvtREAS5P8rk+D9vCQh82uva6gTrPg/DUqDdPYNB XWrN5gi/TZsOAMb5M9ethzBNf7nSDAmoDQyToEHvTNpoHHzmHlkui0FJhiQF8ASXhNvi 0M3PyaVdpXm0naVyX8JSuJXM9sIUJVSdqOh/KSgQCu6pSoqHIcuIJC0rEqzoKvMf2+RU 2XrN1A2AwIjqOmoZbKZM2clBHpuzMQGGO94a86BnSYpuJS5+JLG2L05Pcs+mUT08aPl8 iETbO+V8Yaa+sZQl0RH6t6iKZ/NHQjhcHyO2I61SpJ1he4JsljPJvGp6u+usH0A2C0Dp aNOQ== X-Gm-Message-State: AOAM5303nxqVaXIMveMoNz370/T/W03DwHF3DApLdW8SH97hlhHmmm7z tHYCKSqouUVclN8gk7SUZLwvsg== X-Received: by 2002:a65:679a:: with SMTP id e26mr4855403pgr.394.1607034746754; Thu, 03 Dec 2020 14:32:26 -0800 (PST) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id gp14sm333425pjb.6.2020.12.03.14.32.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 14:32:26 -0800 (PST) Subject: [PATCH v1 1/5] Documentation: Describe dm-user Date: Thu, 3 Dec 2020 13:58:55 -0800 Message-Id: <20201203215859.2719888-2-palmer@dabbelt.com> X-Mailer: git-send-email 2.29.2.454.gaff20da3a2-goog In-Reply-To: <20201203215859.2719888-1-palmer@dabbelt.com> References: <20201203215859.2719888-1-palmer@dabbelt.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: corbet@lwn.net, song@kernel.org, Palmer Dabbelt , shuah@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, linux-kselftest@vger.kernel.org, kernel-team@android.com From: Palmer Dabbelt To: dm-devel@redhat.com, agk@redhat.com, snitzer@redhat.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Palmer Dabbelt I started by patterning this after the Fuse documentation, which is located at Documentation/fs/fuse.rst. There's not a whole lot of that left, though. Signed-off-by: Palmer Dabbelt --- This is a work in progress, but nothing in there should be incorrect. --- Documentation/block/dm-user.rst | 99 +++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 Documentation/block/dm-user.rst diff --git a/Documentation/block/dm-user.rst b/Documentation/block/dm-user.rst new file mode 100644 index 000000000000..5eb3120f3fd5 --- /dev/null +++ b/Documentation/block/dm-user.rst @@ -0,0 +1,99 @@ +.. SPDX-License-Identifier: GPL-2.0 + +======= +dm-user +======= + +What is dm-user? +================ + +dm-user is a device mapper target that allows block accesses to be satisfied by +an otherwise unprivileged daemon running in userspace. Conceptually it is +FUSE, but for block devices as opposed to file systems. + +Creating a dm-user Target +========================= + +dm-user is implemented as a Device Mapper target, which allows for various +device management tasks. In general dm-user targets function in the same +fashion as other device-mapper targets, with the exception that dm-user targets +handle requests via a userspace daemon as opposed to one of various in-kernel +mechanisms. As such there is little difference between creating a dm-user +target and any other device mapper target: the standard device mapper control +device and ioctl() calls are used to create a table with at least one target of +the "user" type. Like all other targets this table entry needs a start/size +pair. The additional required argument is the name of the control device that +will be associated with this target. Specifically: + +```` +user +```` + +As a concrete example, the following `dmsetup` invocation will create a new +device mapper block device available at `/dev/mapper/blk`, consisting entirely +of a single target which can be controlled via a stream of messages passed over +`/dev/dm-user/ctl`. + +```` +dmsetup create blk <sys_read() +| | >dev_read() +| | [sleep on c->wq] +| | +| >sys_read() | +| [... block and DM layer ... ] | +| >user_map() | +| [enqueue message] | +| [wake up c->wq] | +| sys_write() +| | >dev_write() +| | [copy message from user] +| | [complete BIO] +| [woken up on BIO completion] |