Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1693241lqo; Sun, 12 May 2024 14:07:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVRUdhsMoKaHOSVChaj34PA8Okn1jYtBCBX3r1WI9lJdWlIKqp5QITGy6q1SGihSW0CWGTjVeCZtje55rwA7f47dlVoHY97mgaccqgxEA== X-Google-Smtp-Source: AGHT+IFkiYNW+FyuU6x1oEvnzIPuS1qEIRf2+psoOu8pZsc3Ux7ocpWNTpHfH5sHj6sCN5UiT1nj X-Received: by 2002:a50:8d50:0:b0:572:6ae4:a9ac with SMTP id 4fb4d7f45d1cf-5734d5e35d6mr6093059a12.21.1715548027511; Sun, 12 May 2024 14:07:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715548027; cv=pass; d=google.com; s=arc-20160816; b=gNMWzq7Ddis/djgKliZA1oPwaNF1Q06o3W+Cu2o5OwGnbjXI92HEFw4mYxIHO/7o8p 0+x6y1N4UviuJVtTiR3ddkx3cIc5kyjQe/Lh5Im0cmjWN07D0c5AYvTAysXaAZgkZ0aC A7Nw54OVHxTHgwuW72BM3zn3tWe9DNSxliQ3aV6XxC2iltKQpRhtXwL6gCt++B9ggKaw 2aXRw1y5b8LKRFEZ0hFGBkff/l+Qt7tPBVRrVpaetNYfM4QO49mJjIDmE9WJtpXYd/oj 3RD9NoAz/Q/CxZSHScBAehji0/2N8XW0FyQDDmdwNWT2N9UCRHOz53Q/kOF7r213omSH R9Wg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=pTw6lc2ugV+pxnsE+unm7DWQd2E2uzUOLG4JPutFiY0=; fh=co1IUzI+vY7NH71s7PXtnhSLlhoVeaytDx2/+E8XKDA=; b=XmrIZZtzXq02XDt50r5ISi7SIwshh/jPH2lj3y2tkZPPzH7nGIRYiWmCeQ0Qe2x98w 4xWfRaoawRzSC3dWx2pO+Y91eEstq21GEi7T2403KfIa8EaQShVLHeTBAKleRRnD9iZD fNsUn+VCpvAoMQOm7zgqyAsSaFVm9om+TgVYav/FzHRUiG3ATnAaSW6UoMIvLegNqPH9 cy0ndU1aErjnuGjzGu/tMdH3kPI6FJYVPGC2+xOWmMCe7chqB4c9fSJTVqIaFB028ace q4oAdnRjFkrEJ/t/maxVKP8Y7kGWi1Zcm52kuCbZmgj3dTRJPM+bCs3V96V8IZNzdSN5 ByCg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@metaspace-dk.20230601.gappssmtp.com header.s=20230601 header.b=v8y8XfxG; arc=pass (i=1 dkim=pass dkdomain=metaspace-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-176975-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176975-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5733c37810csi4538040a12.644.2024.05.12.14.07.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 14:07:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-176975-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@metaspace-dk.20230601.gappssmtp.com header.s=20230601 header.b=v8y8XfxG; arc=pass (i=1 dkim=pass dkdomain=metaspace-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-176975-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176975-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9EBA11F21796 for ; Sun, 12 May 2024 18:39:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8728055C3A; Sun, 12 May 2024 18:38:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=metaspace-dk.20230601.gappssmtp.com header.i=@metaspace-dk.20230601.gappssmtp.com header.b="v8y8XfxG" Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 72CCD4EB31 for ; Sun, 12 May 2024 18:38:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715539130; cv=none; b=MDDm75D1ddh51otHs68ZU50imyPVrcmyoK+tCo6jS6RFq/z6oSwctfXsA2zYC+DeHQnrncBlB8zxjoC1t4JMGOssHlYtMRcYYrmOjYNKn83zMAykVBuXbjsXNfnSQiLlQI9SHE6UitjkZJobAKLqbELgwTFGdZOn0gaKLyg888A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715539130; c=relaxed/simple; bh=b5i2hqWqMMetERk5hQhn2SOVCTZcCAIel03ZVQRAcqQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=TXagneRr7pIJ/hgn/Emy137nVUiArWffYCvzAP3GGx46HruRM49IKIgXIJahiI8BVTxyns4/oEI5qmtg6TJ0FPX6feiwadppk5OEL5cBsLGltqVZ9o0h/iIz7lpNlHYHvQ2IDy4soGWi3swPouvUI5jTDSsii+FujIxoLPAttNk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=metaspace.dk; spf=none smtp.mailfrom=metaspace.dk; dkim=pass (2048-bit key) header.d=metaspace-dk.20230601.gappssmtp.com header.i=@metaspace-dk.20230601.gappssmtp.com header.b=v8y8XfxG; arc=none smtp.client-ip=209.85.215.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=metaspace.dk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=metaspace.dk Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-61c4ebd0c99so2337264a12.0 for ; Sun, 12 May 2024 11:38:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=metaspace-dk.20230601.gappssmtp.com; s=20230601; t=1715539127; x=1716143927; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=pTw6lc2ugV+pxnsE+unm7DWQd2E2uzUOLG4JPutFiY0=; b=v8y8XfxGLZaE5npvLV5v5ScOqpkgu75hrLvfQODJLe+3KWZA0AKPgpgS7K8IFM8JmE +EIIh5RV5MBcDn5mxp/fnr/urEH305BPzzHacSJqJWOimC85Zdve560jsf9BRnLDL71B EPB13ulheCJKXeDv2PQ7Sn5y7K7SeqyjZwhCfGj8dyDIF88QDje2fxTr0LTPAub7+dXJ A1R7HSxV27fZCsQSq80penRTwF4NamM6bzH26qSAZs/rUA1LsONvMybQ+jMomZwGc5Il 5HyPqaOAUSWFCGU/gJTlhONzUUQQZR4RDboxbdSPk1LU9woAs1MzWD6/KETXXBYF3NTs oQOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715539127; x=1716143927; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=pTw6lc2ugV+pxnsE+unm7DWQd2E2uzUOLG4JPutFiY0=; b=Gi3qrLMKHAM3MJ3k6Bhl6UrcYsLvvJuo2IZ3CroIa01qXd6A9WPYx+ksiwvYxOBMts MI+4nlIbD2O57SoWwetq9GD08QA1f7G6yRkLR2jQjkOnJlfJm0qYmxEgwFYwK/hEuOVE iMozNjZ648hlOPVPV98XPYh0XLFYnqtsl5dJhBubtDHJJJx7/TApkmYTonWpail3q7J1 obvuE0dpbNcLtFP/2mb23/+w4YVoSjBaYynwCJTlmhgpCaV3kek8Yul95o5gwjPBOULe 7jx4/KUOVtdBAxxnoQJRj/blxg+hOzpKaQuA9V9T+KalqW9Y8ztyX14HF9KCR0ukn3jX b/bQ== X-Forwarded-Encrypted: i=1; AJvYcCVPc9iOZAhk6xdzgI4UvpR7H5m5MK5wUPm2MRZIddqwaj74o4wNQEt4dtv+CQMj9MwkiUncRe8aqp4gXwmP5eTRjeo0B9B3pzZX3A0A X-Gm-Message-State: AOJu0Yzz2fN/Fz4TesY92Blv92MgJk0S3yC18LKGoLKU1pJTkGnKrEhe VGKfIeBjkn5b3jHVycF4aui4Q+5jCfPmHOgkfN33RVVOdR9QYK1ymkN/zZglPCY= X-Received: by 2002:a17:902:f647:b0:1eb:3df4:e63b with SMTP id d9443c01a7336-1ef43c0958dmr137532155ad.7.1715539127718; Sun, 12 May 2024 11:38:47 -0700 (PDT) Received: from localhost ([50.204.89.33]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0b9d4733sm65063365ad.54.2024.05.12.11.38.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 11:38:47 -0700 (PDT) From: Andreas Hindborg To: Jens Axboe , Christoph Hellwig , Keith Busch , Damien Le Moal , Bart Van Assche , Hannes Reinecke , Ming Lei , "linux-block@vger.kernel.org" Cc: Andreas Hindborg , Greg KH , Matthew Wilcox , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Alice Ryhl , Chaitanya Kulkarni , Luis Chamberlain , Yexuan Yang <1182282462@bupt.edu.cn>, =?UTF-8?q?Sergio=20Gonz=C3=A1lez=20Collado?= , Joel Granados , "Pankaj Raghav (Samsung)" , Daniel Gomez , Niklas Cassel , Philipp Stanner , Conor Dooley , Johannes Thumshirn , =?UTF-8?q?Matias=20Bj=C3=B8rling?= , open list , "rust-for-linux@vger.kernel.org" , "lsf-pc@lists.linux-foundation.org" , "gost.dev@samsung.com" Subject: [PATCH 0/3] Rust block device driver API and null block driver Date: Sun, 12 May 2024 12:39:45 -0600 Message-ID: <20240512183950.1982353-1-nmi@metaspace.dk> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Andreas Hindborg Hi All! I am happy to finally send the first _non_ RFC patches for the Rust block device API. This series provides an initial Rust block layer device driver API, and a very minimal null block driver to exercise the API. The driver has only one mode of operation and cannot be configured. These patches are an updated and trimmed down version of the v2 RFC [1]. One of the requests for the v2 RFC was to split the abstractions into smaller pieces that are easier to review. This is the first part of the split patches. A notable change in this patch set is that they no longer use the `ref` field of the C `struct request` to manage lifetime of the request structure. The removed features will be sent later, as their dependencies land upstream. As mentioned before, I will gladly maintain this code if required. Canges from RFC v2: - Change request state tracking method - Use a slice rather than a raw pointer for `RawWriter` - Use typestate patttern for `GenDisk` to prevent mutation of non synchronized fields - Remove per gendisk private data support - Remove per tag_set private data support - Remove per hwctx private data support - Remove per request private data support - Remove use of `ARef::into_raw` - Remove use of `Opaque::try_ffi_init` - Remove map_queues support - Remove bio iteration support - Remove methods to fail requests - Remove request introspection methods - Remove module configuration via module parameters - Remove timer completion support for Rust null block driver - Remove memory backing support for Rust null block driver - Remove soft-irq completion support for Rust null block driver Thanks for all the feedback and comments on the earlier versions! Best regards, Andreas Hindborg Link: https://lore.kernel.org/all/20240313110515.70088-1-nmi@metaspace.dk/ [1] Andreas Hindborg (3): rust: block: introduce `kernel::block::mq` module rust: block: add rnull, Rust null_blk implementation MAINTAINERS: add entry for Rust block device driver API MAINTAINERS | 14 ++ drivers/block/Kconfig | 9 ++ drivers/block/Makefile | 3 + drivers/block/rnull.rs | 82 ++++++++++ rust/bindings/bindings_helper.h | 2 + rust/helpers.c | 16 ++ rust/kernel/block.rs | 5 + rust/kernel/block/mq.rs | 109 +++++++++++++ rust/kernel/block/mq/gen_disk.rs | 205 ++++++++++++++++++++++++ rust/kernel/block/mq/operations.rs | 245 +++++++++++++++++++++++++++++ rust/kernel/block/mq/raw_writer.rs | 55 +++++++ rust/kernel/block/mq/request.rs | 227 ++++++++++++++++++++++++++ rust/kernel/block/mq/tag_set.rs | 93 +++++++++++ rust/kernel/error.rs | 5 + rust/kernel/lib.rs | 2 + scripts/Makefile.build | 2 +- 16 files changed, 1073 insertions(+), 1 deletion(-) create mode 100644 drivers/block/rnull.rs create mode 100644 rust/kernel/block.rs create mode 100644 rust/kernel/block/mq.rs create mode 100644 rust/kernel/block/mq/gen_disk.rs create mode 100644 rust/kernel/block/mq/operations.rs create mode 100644 rust/kernel/block/mq/raw_writer.rs create mode 100644 rust/kernel/block/mq/request.rs create mode 100644 rust/kernel/block/mq/tag_set.rs base-commit: fec50db7033ea478773b159e0e2efb135270e3b7 -- 2.44.0