Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp161276lqb; Thu, 14 Mar 2024 08:02:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXw+kEMX/s8CBPlfYTR1enokaKExSyjPjxmuHBPrMLnfZUSWZYIFSiDXrnh5puG1+l18vrKimLCyGADHVe6n4jB3/ZkEfi/CJYogavAOQ== X-Google-Smtp-Source: AGHT+IET4lRqIjw5uPcO6jwyFZZIooRGL1iFhHJfT2bFLr1E84qyt/CfdWRHP77p1QRCu6TyRYH7 X-Received: by 2002:a05:6a20:8190:b0:1a1:56aa:1c62 with SMTP id q16-20020a056a20819000b001a156aa1c62mr1877334pzb.49.1710428574512; Thu, 14 Mar 2024 08:02:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710428574; cv=pass; d=google.com; s=arc-20160816; b=TwSVN/dNidwg9TVTDg01NkY3hCs3Z6o2dkNNL01MgVfTEGGZAZyssKv6jqr6gzsCjK VFrbD5uSnyAFR5VUF6jdqqahiQ6p8NUJ3z99ln76alALBB+7Rz5kGwS491b8ZJgfC+tr LBD6i5hybbdKBdp91DPvLninwq7xCL4M22yZ/Qis9qtcTTWpbfQ81ZqGLAeukK9yDAiR zX6w9ghdwtZa+e5EYJeaV5RQeHJhM6CtTDWS8dWiVzrI4L4FJa3+opM4u+XwzXZZ6zCv fp2utvdCGuHQknsakBBKbs55RxaiktLga9VTvEfRLvpTf+5S6gVmi9jeysiEy4r8THC4 2hEQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:user-agent:references:in-reply-to:subject:cc:to :from:dkim-signature; bh=JfJRdvNmTUKtc18a61BTNZaQgzgnNE8vdtGOTX+Hn14=; fh=JU6CR8imLyRQvF7BTBHPuG3LXnIEY/bGphb0YkIrCn0=; b=rxd2GOJg/g3PNhJCuKCvDjWz09zzF9Dz1I16bhtOuXSIvWhVQPDy0wIBH6CSAyD3FW 3W2VRcEPb0R/NopJW0AWrrmJa8VKY2c395y4Io4ZHCQgiUupsBAMLWr9aDNCulMedwJf yQnBNXn1hfPv5PdBS7FixtLqeoTGFkcsGn8hDniEYG2JUPdGmXEyTvMugT/nqmquphr8 bJpdvbMRHQujISnonTz76mPZVhOOpGZ9PBDWZ2n1oYpVZZk1lMsIVYaWl0RYf7Yel2By GflHNcTiSaXYbWd3BoNjhv47hlNMLw4Kmil55QLzvfQBXtvg6xyUl/w7X/uoJ9B/Srd0 OPkg==; 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=wxNpqt70; arc=pass (i=1 dkim=pass dkdomain=metaspace-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-103015-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103015-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u7-20020a634707000000b005d8505c96e1si704988pga.423.2024.03.14.08.02.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 08:02:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103015-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@metaspace-dk.20230601.gappssmtp.com header.s=20230601 header.b=wxNpqt70; arc=pass (i=1 dkim=pass dkdomain=metaspace-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-103015-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103015-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C253A284D85 for ; Thu, 14 Mar 2024 08:58:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E62796BFAC; Thu, 14 Mar 2024 08:58:35 +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="wxNpqt70" Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (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 6AEF86BB45 for ; Thu, 14 Mar 2024 08:58:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710406714; cv=none; b=lpe7TW/y2wH3S8c39yTT2D8C1qsKUhECcKXJLhgb3mXKQmQv34coNDvbpRCCy6ho0tsqmEVI3gW4J2bc+dCY3JEV1SX+exy7OZ0XmFkjDFK8xVieJO6LVP3/IZzAFlp+P/QVmhYz7Is3TJj9e1PykEjPz3WjP3TO1cZdSczATtM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710406714; c=relaxed/simple; bh=jkjR2w3eWbGlskRSUh2BEg4E8O6gDXTWPhByDoL1bi0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=Bp/wlsmpARBlWKf/gUQmEM1EzINQJEPjdOuI2W9sPlv4uEvFJHHDha1CUp1YsG+NzintA52t6TH4jitH74VRwnM8XiUNZcfj8cMDtCCA+WNuRcpNfqGxVHvkSa9jZaIHw9iPL6uLtEiGo1KVcVQn6qSPeCCo4nDxlgyDKWAqjVE= 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=wxNpqt70; arc=none smtp.client-ip=209.85.218.46 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-ej1-f46.google.com with SMTP id a640c23a62f3a-a4675aaa2e8so25959066b.0 for ; Thu, 14 Mar 2024 01:58:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=metaspace-dk.20230601.gappssmtp.com; s=20230601; t=1710406709; x=1711011509; darn=vger.kernel.org; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=JfJRdvNmTUKtc18a61BTNZaQgzgnNE8vdtGOTX+Hn14=; b=wxNpqt70cIc14ItKxiTJTKI355oQBzEXo0VvZZIyYPKth8rkRCIzw0pGAJt17ph+Ku 39ic6+0jg4YfdVPzSRQAq0zF+rlo9Jk8RsT0a++ZUCmDDCAPM030Ei4i16DhurXDk7SD 6G9pHY7Gjcejnsi3prPlH69vMrWaiiFdv24qcSKpcuJMjGq3EqMr4XmIbT5jMO1uidZd gyHb10GLTNHIe0WQN76n7C3XjZPVaYjcQXoyl1Ml6qJV4CCtHgshrh++j+L5shDgZuFp 2WfKOgRihHrDyxPeVnISocJIVXd/31aG3PNq6iYt4Ju+x2zTi5Co1cj0pQDv0WpVggxi PNUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710406709; x=1711011509; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=JfJRdvNmTUKtc18a61BTNZaQgzgnNE8vdtGOTX+Hn14=; b=YrkyXw5JWOXyaxyCDdJ+G3qNCTfKu6Bg+0MbL7cqPUypVvRrm0r1HNobDMl1420mti 6y1FtK0IUtj85hFg1OjjM+OljCUz1n5JyFJkLb2aZ6t+O552upU2BXUt1CzA1hQUwg2F x8vtJULvo9UWMno2s6MZwfuR7Dt92wfJ9pP37/wZ9g2wn1JnbwY1JMYOZm4ee4OSRiU7 TPJDdDeYcXvLGvGdyKx9oeOk+d3gb55fCMo59KtlQT/Bi6Tr5UrnguPfgU0Qko8YPXO1 0doVvhO6FF4XQcPN/HRFJ+zeX6xG2578LnWw7nASQD+qA2I4WWa+mavtuaue1SVGYBTW zRVg== X-Forwarded-Encrypted: i=1; AJvYcCXoGmyv8e3JGV/cBpjHucDHw8YCGFg4x5W/4+obZXiphKIBj8uENkGYIrQIXj1aCfEviPdidcu9/ykl8Xexf9LEaKbjaPfqaAth0sNJ X-Gm-Message-State: AOJu0YxDO8D6F196F6HKdQbHJtq7g9i6vFdejP0oOP09CaAGR1GHrxnV o5YWJw2899yXN8RTpFjXjbN82r3iXDAPcDsw8z5IjFPOBwvAMfZVtTZrLB7mcvE= X-Received: by 2002:a17:906:7ccf:b0:a46:2649:16f9 with SMTP id h15-20020a1709067ccf00b00a46264916f9mr28844ejp.2.1710406709328; Thu, 14 Mar 2024 01:58:29 -0700 (PDT) Received: from localhost ([79.142.230.34]) by smtp.gmail.com with ESMTPSA id dn21-20020a17090794d500b00a465ee3d2cesm484705ejc.218.2024.03.14.01.58.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 01:58:28 -0700 (PDT) From: Andreas Hindborg To: Boqun Feng Cc: Jens Axboe , Christoph Hellwig , Keith Busch , Damien Le Moal , Bart Van Assche , Hannes Reinecke , "linux-block@vger.kernel.org" , Andreas Hindborg , Wedson Almeida Filho , Niklas Cassel , Greg KH , Matthew Wilcox , Miguel Ojeda , Alex Gaynor , Gary Guo , =?utf-8?Q?Bj=C3=B6rn?= Roy Baron , Benno Lossin , Alice Ryhl , Chaitanya Kulkarni , Luis Chamberlain , Yexuan Yang <1182282462@bupt.edu.cn>, Sergio =?utf-8?Q?Gonz=C3=A1lez?= Collado , Joel Granados , "Pankaj Raghav (Samsung)" , Daniel Gomez , open list , "rust-for-linux@vger.kernel.org" , "lsf-pc@lists.linux-foundation.org" , "gost.dev@samsung.com" Subject: Re: [RFC PATCH 1/5] rust: block: introduce `kernel::block::mq` module In-Reply-To: (Boqun Feng's message of "Wed, 13 Mar 2024 16:55:39 -0700") References: <20240313110515.70088-1-nmi@metaspace.dk> <20240313110515.70088-2-nmi@metaspace.dk> User-Agent: mu4e 1.12.0; emacs 29.2 Date: Thu, 14 Mar 2024 09:58:23 +0100 Message-ID: <87il1ptck0.fsf@metaspace.dk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Boqun Feng writes: > On Wed, Mar 13, 2024 at 12:05:08PM +0100, Andreas Hindborg wrote: >> From: Andreas Hindborg >> >> Add initial abstractions for working with blk-mq. >> >> This patch is a maintained, refactored subset of code originally published by >> Wedson Almeida Filho [1]. >> >> [1] https://github.com/wedsonaf/linux/tree/f2cfd2fe0e2ca4e90994f96afe268bbd4382a891/rust/kernel/blk/mq.rs >> >> Cc: Wedson Almeida Filho >> Signed-off-by: Andreas Hindborg >> --- >> block/blk-mq.c | 3 +- >> include/linux/blk-mq.h | 1 + >> rust/bindings/bindings_helper.h | 2 + >> rust/helpers.c | 45 ++++ >> rust/kernel/block.rs | 5 + >> rust/kernel/block/mq.rs | 131 +++++++++++ >> rust/kernel/block/mq/gen_disk.rs | 174 +++++++++++++++ >> rust/kernel/block/mq/operations.rs | 346 +++++++++++++++++++++++++++++ >> rust/kernel/block/mq/raw_writer.rs | 60 +++++ >> rust/kernel/block/mq/request.rs | 182 +++++++++++++++ >> rust/kernel/block/mq/tag_set.rs | 117 ++++++++++ >> rust/kernel/error.rs | 5 + >> rust/kernel/lib.rs | 1 + >> 13 files changed, 1071 insertions(+), 1 deletion(-) >> 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 >> >> diff --git a/block/blk-mq.c b/block/blk-mq.c >> index 2dc01551e27c..a531f664bee7 100644 >> --- a/block/blk-mq.c >> +++ b/block/blk-mq.c >> @@ -702,7 +702,7 @@ static void blk_mq_finish_request(struct request *rq) >> } >> } >> >> -static void __blk_mq_free_request(struct request *rq) >> +void __blk_mq_free_request(struct request *rq) >> { >> struct request_queue *q = rq->q; >> struct blk_mq_ctx *ctx = rq->mq_ctx; >> @@ -722,6 +722,7 @@ static void __blk_mq_free_request(struct request *rq) >> blk_mq_sched_restart(hctx); >> blk_queue_exit(q); >> } >> +EXPORT_SYMBOL_GPL(__blk_mq_free_request); >> > > Note that for an EXPORT_SYMBOL_GPL() symbol, you can just add the > corresponding header file in rust/bindings/bindings_helper.h: > > +#include > > and you will be able to call it from Rust via: > > bindings::__blk_mq_free_request() > > in other words, rust_helper_blk_mq_free_request_internal() is probably > not necessary. Yes, good point. Another option suggested by Miguel is that `__blk_mq_free_request` need not be exported at all. We can make it non-static and then call it from `rust_helper_blk_mq_free_request_internal()`. Then only the latter will be in the kernel image symbol table, which might be better in terms of not exposing `__blk_mq_free_request()` directly. BR Andreas