From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCE4EC02194 for ; Tue, 4 Feb 2025 14:50:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2E8C76B0083; Tue, 4 Feb 2025 09:50:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 272946B0088; Tue, 4 Feb 2025 09:50:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0EB7B6B0089; Tue, 4 Feb 2025 09:50:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id E57116B0083 for ; Tue, 4 Feb 2025 09:50:33 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 6BA42160108 for ; Tue, 4 Feb 2025 14:50:33 +0000 (UTC) X-FDA: 83082548346.10.E5657E1 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) by imf22.hostedemail.com (Postfix) with ESMTP id 2D894C000E for ; Tue, 4 Feb 2025 14:50:31 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=gXZM0ayT; spf=pass (imf22.hostedemail.com: domain of boqun.feng@gmail.com designates 209.85.222.175 as permitted sender) smtp.mailfrom=boqun.feng@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1738680631; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=O93zUfmkQJ5yLGKvDRcJEjXroIe8dkmS2F1TSj1aIr0=; b=AxMCD79j3q7s2M/J5ew3oNykf4iOJ0GTWW5DqDrlyIjIU28lDIfnTi81MzPOsaE9OcfZTL uDfk/YEHYaAVUAsKY+Eo0bD4PqRPiR1497lXud831FcY3V5y4Pc3b4LEotZ169GBzJWKg/ j2rnnTNs6n53P8pl24cgb2i2xE03sOY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1738680631; a=rsa-sha256; cv=none; b=IXe9JSnelfuy2Jt61Nql/MwsZO6L+ajTA7tGTYKDVHIxnkhTbSxPhAY5a9Hok4XuzhC6ah PLahpp6Q/6fi8jDtKEz5dX1ppv6b+yIfZk32N9l0khp7i73LXRm4mdKnx2Zum5e1ASNL4F 6V9A0KxoSv26bvANuU1MHruMPjJ0Nfo= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=gXZM0ayT; spf=pass (imf22.hostedemail.com: domain of boqun.feng@gmail.com designates 209.85.222.175 as permitted sender) smtp.mailfrom=boqun.feng@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-7b6f1be1daeso540025485a.0 for ; Tue, 04 Feb 2025 06:50:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738680630; x=1739285430; darn=kvack.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:from:to:cc:subject:date :message-id:reply-to; bh=O93zUfmkQJ5yLGKvDRcJEjXroIe8dkmS2F1TSj1aIr0=; b=gXZM0ayTN8kCKwoetgrR0uBycG3sGJ51Q0TC5E9vnjw6QLMt6euXSypU+GpwVEc+Dh HDNfhqPjiEnWJ3QUTkjHQ7zGhjc1ObzU8mjSrZvrF7x2WCaW6fBRlS0AwpSO6yQhz9ro oM4751GuK5LcD2rDmRfHRZfNKazlVLhZK8lxsn/04Qw8VUGdfHW0sMUq50wJPdnRgq+w P6+ErOM5wve0KKiKti6mcqIA10sjg9/H+18Fv3oYf1R179KULbk7kEhdmN/PeNEZe6gM sQX5/RCGjPuoMhOE2E2GFfHJkO69maItzknqdhmwCR25kVgdb2kN4OvyHRgwaXFDcHnB ILDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738680630; x=1739285430; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=O93zUfmkQJ5yLGKvDRcJEjXroIe8dkmS2F1TSj1aIr0=; b=GGAbR92UQOZWFO8TjkhIMZylUuNyShMpzviK21DswjYZ2RRaE5tA/Fca6tOlIx2HaE tA03i1/HQjXat1bLhjvs2yPb0dMzW4nCf/ZEkg6aymWiegY3SP12hRq+nCfUISxdXHMc wB7Xug+XN0EqT64hmB+TsOzZfxXgwcgEJy+sY7QcyBQgZpzWUeaFu52PzOVfGXt47pxZ czbQfY0Eu2bG4t3HrnHihRAkfkGy9yw5XlDFxTSS+pwAhWSzcg87gurRJPF5M8HSPZ4U RwzhXU086HD90vv/7iies6asOn541W9X/eiwyk9aDX/2jZvP/QcwzN7YDNnkwgRrUqP/ iaBg== X-Forwarded-Encrypted: i=1; AJvYcCX3JlasFdrztVzWCWK5NJMNe84pR0UHnSk+6MnTbap2PUBYPJm+zBpQ/d429bB9ZgzPfMee+rDwzQ==@kvack.org X-Gm-Message-State: AOJu0Yw5DInHXGjHQ4ag8MrewHjWCTt3NX8H1LmcBptW+2wrMEvYW/oB N1CAfDmQ6X+TDrs+8m+rzGiPoT4bbXMG1BWZDe3TWUL6jCUgje75 X-Gm-Gg: ASbGncvy1+7g+lcutv53GVxNYRFhX/4Uz/Oy3dnZHtMn+safjPd1N//NVQxngWPsHVC ZmlNiWGAZF1AJFzMXT2Mh/0uHhnLUzJ+HsJYPXSfM4yUR9fJO+ThBH/lK+WzkLpvphdVYmSoo8B h+zqAj9+Qfa1wpWTWYNlm5gJQM8CNV6YDCdmCIK7vobMz06bSdL1A32X/FBQnclU4OWjyoYJf19 SMI2/pVinaz8HD7NxN9DAao8eeEmIKngBPvzn1RbR2FStyC0rZnWbdyBD6rbkGV31zupI6a2+iw LJtgMmpiveHY1sPV+L3LLrgkU6AFqw30z/lzKyGSdtjr/Ii8Hs+5wXtfrbIfb75DjH8bVxLMObw ysuq+pw== X-Google-Smtp-Source: AGHT+IH0tfWWAkUUISaVsW7R9y0WycKwDyOEfJRx4RoIqxcqcAbwE9Cp+b3y3nIulRFvqaZhMXeL8Q== X-Received: by 2002:a05:6214:2305:b0:6dc:d101:2bb2 with SMTP id 6a1803df08f44-6e243a86cd0mr372471186d6.0.1738680630220; Tue, 04 Feb 2025 06:50:30 -0800 (PST) Received: from fauth-a2-smtp.messagingengine.com (fauth-a2-smtp.messagingengine.com. [103.168.172.201]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6e2548196ffsm62572346d6.44.2025.02.04.06.50.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Feb 2025 06:50:29 -0800 (PST) Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfauth.phl.internal (Postfix) with ESMTP id EA5CF1200068; Tue, 4 Feb 2025 09:50:28 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Tue, 04 Feb 2025 09:50:28 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvtdektdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttddv necuhfhrohhmpeeuohhquhhnucfhvghnghcuoegsohhquhhnrdhfvghnghesghhmrghilh drtghomheqnecuggftrfgrthhtvghrnhephedugfduffffteeutddvheeuveelvdfhleel ieevtdeguefhgeeuveeiudffiedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhhphgvrhhsohhnrghl ihhthidqieelvdeghedtieegqddujeejkeehheehvddqsghoqhhunhdrfhgvnhhgpeepgh hmrghilhdrtghomhesfhhigihmvgdrnhgrmhgvpdhnsggprhgtphhtthhopedvfedpmhho uggvpehsmhhtphhouhhtpdhrtghpthhtoheplhhinhgrsegrshgrhhhilhhinhgrrdhnvg htpdhrtghpthhtohepohhjvggurgeskhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprghl vgigrdhgrgihnhhorhesghhmrghilhdrtghomhdprhgtphhtthhopehgrghrhiesghgrrh ihghhuohdrnhgvthdprhgtphhtthhopegsjhhorhhnfegpghhhsehprhhothhonhhmrghi lhdrtghomhdprhgtphhtthhopegsvghnnhhordhlohhsshhinhesphhrohhtohhnrdhmvg dprhgtphhtthhopegrrdhhihhnuggsohhrgheskhgvrhhnvghlrdhorhhgpdhrtghpthht oheprghlihgtvghrhihhlhesghhoohhglhgvrdgtohhmpdhrtghpthhtohepthhmghhroh hsshesuhhmihgthhdrvgguuh X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 4 Feb 2025 09:50:28 -0500 (EST) Date: Tue, 4 Feb 2025 06:50:27 -0800 From: Boqun Feng To: Asahi Lina Cc: Miguel Ojeda , Alex Gaynor , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Jann Horn , Matthew Wilcox , Paolo Bonzini , Danilo Krummrich , Wedson Almeida Filho , Valentin Obst , Andrew Morton , linux-mm@kvack.org, airlied@redhat.com, Abdiel Janulgue , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, asahi@lists.linux.dev Subject: Re: [PATCH 4/6] rust: addr: Add a module to declare core address types Message-ID: References: <20250202-rust-page-v1-0-e3170d7fe55e@asahilina.net> <20250202-rust-page-v1-4-e3170d7fe55e@asahilina.net> <8f098064-d2d5-4a02-8306-0a3d31557bab@asahilina.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8f098064-d2d5-4a02-8306-0a3d31557bab@asahilina.net> X-Rspamd-Queue-Id: 2D894C000E X-Stat-Signature: s16d1oonjku71yb1es3sw7zm6sckinap X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1738680631-304858 X-HE-Meta: U2FsdGVkX1/wGO6zryHOdh6NZiqHWWh4Ostj+h2+ChrbW3llHwizQIqegAotr+RlyVsJmRysqo100fkPM3HHdgXQJFPq5mcgS6Eb2Y0Xi+bxWDfqZfop5NrYbASu9u19KWJ5SWEaO6ML+UwD4ZYJKObtTZffDRrkzneF0jqaQgglEl0wc3H0i/NuV0YWlsTv7/ti0Ydaldx8BMEt6BTrupkVORlhnWVNxa37SBApDSjdK1atwT+JxGlHgC4kPfkc3wt5aF/EmKmHFmN6U0LB+fnlxC47C+zu4GrkzFgmdyMyLUuw0C0aWhBOiMeddy1Yo0QyC79101ITw6e+x7mvaag9cwevmu8hf33oRv02KzHN/rKasno1FWdvHcg6zfgnbWDk7BVFuYtYNCPueyXvJn4ywB8bxC+qvAYjGP8pkfGyTEzwxud+XLPFzaqBfF68xhcnT8aYq4k0uaE+a6GZB43J/D0LgQmVQD7ash1yVN/eXpYTcwWdosq/cFBFnn81BHSjvyz48agEPXUz1hrxcxAiNSzJ3ZKcZyjj8WcTT1CNcH3bN6via7B1topG5tw8IjH8T7/B84BIKSUk3Lor0gPqNNMj06mtzt0Nm+OesrVOpAntjWbcKQ3Rpfag3vIkK08tgAefXgCQB86kXOfK3smzCRIBVIK+dP8BebnDb5cgWYzsHkAdcOeyBIQUf7yak8i93hS65Bh8YQNCKnxiiz/m6unWRCl5n5jb04j0Il9IC3VwSrr+L2sz1Lq6pgmPHTbeWNi0u/JUOh+sSU7hJmr4aTZ8k61nfi7uO4VjMfpvl6AF5/Azwo7JIANNmy6GZ/a1WlzVV+CL85WCF1PvhLqirVZ7yJBCK0eYN/GkT8oTebRnAbKEq8tZizjxcjMkFmDnEN3e28XMPX/rQMjnZtc/3MaJIeq9pN8geCiXxg2uml4WevS3t61HYtKXaImPOZYWdvhqZhnimPA6RFC lVY2Rn02 qC4KHgzCuPaHsZe2o63W8Z9mX9Keh1PePuGftfo0t8RWtOTQTigR1juTq2hO9+E5zDI71rjja3sQTtItE/8mcyTPahgCwXu5cY4W+Mh//16lAncIcOWBbMM7ZGlKgspEOqGnSymHVJ2ITX4FUBmXIWVWlSytcFgRd4zi6niuROpWUkt4fUXNekBDzyEscnxOIPed/PUoqD0m2NNXqEuiqv10wC9YrFUzrdn1sMPejZORGABfBC9vHjAhgiKNMhb3dLDFu+sGen9emRhLT4kwc3zalq/tErAw1WsYz1l1A2PNj7hPFNjjJYz6ABwm5id1AaQuR40Jq79RgZRL1vsbJlyNtObrc9JYVn76DOp9jMZz1pup6qdh85EmXLplg1a8ww3yU5815/cl9j4oNtyKrzTEYu9VOjN5Nv0asiSFFx8GB1mi4+HkSx71zm8+Rwaryb6ZEvpvWI8rZp3C2iQBAAz+4eYH8ftw9eJ/Mb/0j+P/gsW2aT7Pnrn4LDDASjTm8IGDBysVbNmoCHJnxyi5mZ55dJ4XytwglCtnC X-Bogosity: Unsure, tests=bogofilter, spamicity=0.496607, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Tue, Feb 04, 2025 at 08:50:17PM +0900, Asahi Lina wrote: > > > On 2/4/25 12:04 AM, Boqun Feng wrote: > > On Sun, Feb 02, 2025 at 10:05:46PM +0900, Asahi Lina wrote: > >> Encapsulates the core physical/DMA address types, so they can be used by > >> Rust abstractions. > >> > >> Signed-off-by: Asahi Lina > >> --- > >> rust/kernel/addr.rs | 15 +++++++++++++++ > >> rust/kernel/lib.rs | 1 + > >> 2 files changed, 16 insertions(+) > >> > >> diff --git a/rust/kernel/addr.rs b/rust/kernel/addr.rs > >> new file mode 100644 > >> index 0000000000000000000000000000000000000000..06aff10a0332355597060c5518d7fd6e114cf630 > >> --- /dev/null > >> +++ b/rust/kernel/addr.rs > >> @@ -0,0 +1,15 @@ > >> +// SPDX-License-Identifier: GPL-2.0 > >> + > >> +//! Kernel core address types. > >> + > >> +use bindings; > >> +use core::ffi; > > > > I think we should use crate::ffi here. See: > > > > d072acda4862 "rust: use custom FFI integer types" > > > >> + > >> +/// A physical memory address (which may be wider than the CPU pointer size) > >> +pub type PhysicalAddr = bindings::phys_addr_t; > >> +/// A DMA memory address (which may be narrower than `PhysicalAddr` on some systems) > >> +pub type DmaAddr = bindings::dma_addr_t; > >> +/// A physical resource size, typically the same width as `PhysicalAddr` > >> +pub type ResourceSize = bindings::resource_size_t; > >> +/// A raw page frame number, not to be confused with the C `pfn_t` which also encodes flags. > >> +pub type Pfn = ffi::c_ulong; > >> diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs > >> index e1065a7551a39e68d6379031d80d4be336e652a3..eb1a80ba8ff83ab2d1b3b1d11fed4fb704c7a4f5 100644 > >> --- a/rust/kernel/lib.rs > >> +++ b/rust/kernel/lib.rs > >> @@ -29,6 +29,7 @@ > >> > >> pub use ffi; > >> > >> +pub mod addr; > > > > I want to share my worry on this `pub mod` list in kernel/lib.rs may get > > too long ;-) > > > > I was about to suggest putting `addr` and `page` into `mm` after Alice's > > patchset merged, however, seems that `mm` mod only cover userspace > > memory management (which is not my impression of what "mm" in kernel > > development), thoughts? Alice, do you think we should extend `mm` mod to > > contain all memory management mods? > > I think in kernel-speak "mm" is usually userspace memory management and > kernel page allocation and memory management, but doesn't include device > stuff (I/O ranges, DMA, etc.) or the low-level concepts of memory in an > architecture. The types I declare here are more relevant to device/arch > code, so I don't think they really belong under "mm", it's more general > (mm deals with them and so do other parts of the kernel code). > Make sense. > On the other hand, I think page.rs itself would fit under mm, since it > deals with the kernel mm's idea of pages and their allocation. > Agreed. Probably some follow-up work after Alice's mm work merged. Regards, Boqun > > > > Regards, > > Boqun > > > >> pub mod alloc; > >> #[cfg(CONFIG_BLOCK)] > >> pub mod block; > >> > >> -- > >> 2.47.1 > >> > > > > ~~ Lina >