Rust-for-Linux-tech
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Help
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# Meeting 2025-07-09 <!-- Leave your topic starting with ### in the relevant sections below --> ## Critical <!-- bugs, soundness issues, urgent patches/reviews etc. --> ## Status Reports <!-- You want to report on something you are working on/request reviews. Or you want to know the status of something someone else is doing --> ## Discussion Questions <!-- Anything that requires lengthy discussion/more general questions also fit here --> ### DMA mask accessors Link: https://lore.kernel.org/lkml/DB6YTN5P23X3.2S0NH4YECP1CP@kernel.org/ rust/kernel/dma.rs ```rust /// Trait to be implemented by bus specific devices. /// /// The [`dma::Device`](Device) trait should be implemented by bus specific device representations, /// where the underlying bus is DMA capable, such as [`pci::Device`](::kernel::pci::Device) or /// [`platform::Device`](::kernel::platform::Device). pub trait Device: AsRef<device::Device<Bound>> { /// Inform the kernel about the device's DMA addressing capabilities. /// /// Set both the DMA mask and the coherent DMA mask to the same value. /// /// Note that we don't check the return value from the C `dma_set_coherent_mask` as the DMA API /// guarantees that the coherent DMA mask can be set to the same or smaller than the streaming /// DMA mask. fn dma_set_mask_and_coherent(&self, mask: u64) -> Result { // SAFETY: By the type invariant of `device::Device`, `self.as_ref().as_raw()` is valid. to_result(unsafe { bindings::dma_set_mask_and_coherent(self.as_ref().as_raw(), mask) }) } /// Same as [`Self::dma_set_mask_and_coherent`], but set the mask only for streaming mappings. fn dma_set_mask(&self, mask: u64) -> Result { // SAFETY: By the type invariant of `device::Device`, `self.as_ref().as_raw()` is valid. to_result(unsafe { bindings::dma_set_mask(self.as_ref().as_raw(), mask) }) } } ``` ```rust /// Performs the same functionality as [`CoherentAllocation::alloc_attrs`], except the /// `dma_attrs` is 0 by default. pub fn alloc_coherent<D: Device>( dev: &D, count: usize, gfp_flags: kernel::alloc::Flags, ) -> Result<CoherentAllocation<T>> { CoherentAllocation::alloc_attrs(dev, count, gfp_flags, Attrs(0)) } ``` samples/rust/rust_dma.rs ```rust fn probe(pdev: Probing<&pci::Device<Core>>, _info: &Self::IdInfo) -> Result<Pin<KBox<Self>>> { dev_info!(pdev.as_ref(), "Probe DMA test driver.\n"); pdev.set_dma_mask(...); let pdev = pdev.into(); let ca: CoherentAllocation<MyStruct> = CoherentAllocation::alloc_coherent(pdev, TEST_VALUES.len(), GFP_KERNEL)?; [...] } ``` ### API Naming guidelines for conversion functions Need input for method naming: https://lore.kernel.org/all/87h5zstoaq.fsf@kernel.org This signature results in suboptimal code generation when `as_nanos` is not inlined: ```rust pub trait HrTimerExpires { fn as_nanos(&self) -> i64; } ``` Clippy complains if the `HrTimerExpires` is not `Copy` with the following signature: ```rust pub trait HrTimerExpires { fn as_nanos(self) -> i64; } ``` From the [upstream Rust API naming guidelines](https://rust-lang.github.io/api-guidelines/naming.html#ad-hoc-conversions-follow-as_-to_-into_-conventions-c-conv): Conversions should be provided as methods, with names prefixed as follows: | Prefix | Cost | Ownership | | ------ | ---- | --------- | | `as_` | Free | borrowed -\> borrowed | | `to_` | Expensive | borrowed -\> borrowed<br>borrowed -\> owned (non-Copy types)<br>owned -\> owned (Copy types) | | `into_` | Variable | owned -\> owned (non-Copy types) | No guide line fits, what should be RfL recommendation for this situation? Discussion dead end [here](https://lore.kernel.org/lkml/20250625.013914.1516176234783852509.fujita.tomonori@gmail.com/) and [here](https://lore.kernel.org/lkml/CANiq72nd6m3eOxF+6kscXuVu7uLim4KgpONupgTsMcAF9TNhYQ@mail.gmail.com/). Alice: ```rs pub trait HrTimerExpires: Copy { fn as_nanos(self) -> i64; } ``` ^ Benno & Gary like this solution Andreas will add this resolution to reviewers guidelines. ### Guidelines for (racy) reads outside Rust AM (moved to next meeting) Reading data such that the reads may be racy comes up again and again. * Reading data from user space * Reading from DMA buffers * Reading hardware registers Issue discussed here: * [iov_iter](https://lore.kernel.org/all/87ecuplgqy.fsf@kernel.org) * [dma](https://lore.kernel.org/all/25e7e425-ae72-4370-ae95-958882a07df9@ralfj.de) * [block io](https://lore.kernel.org/all/ab8fd525-9a63-46e2-a443-b9d94eed6004@ralfj.de) Besides the reads being racy, how do we inform the rust AM that it should consider data form these reads as initialized? ## Miscellaneous <!-- stuff that does not fit into other categories --> #### Xiang reports ##### `(p)init` We have - [ ] [#143553](https://github.com/rust-lang/rust/pull/143553) in early preview - [x] HIR type-checking and type inference is working on the `init # [0]` smoke test - [x] `init <literal>` - [ ] It just ICEs because THIR is unimplemented, sorry - [ ] Next PR - [ ] :construction: THIR lowering (4x) - [ ] :construction: MIR lowering and drop elaboration (5x), and pray that borrowck just works - [ ] :construction: MIR instance paperwork (1x) - [ ] Next PR - [ ] :construction: `(val, val, ..)` parser support and HIR typeck (should be fast, 2x) - [ ] :construction: the parser support for `struct` syntax - [ ] :warning: polish it for nightly testing ##### `arbitrary_self_type` We have - [#143527](https://github.com/rust-lang/rust/pull/143527) also in early preview - [x] Name resolution for identifiers - Just enough for `Deref`/`Receiver` migration - [x] Reserve a trait item attribute so that we mark traits eligible for supertrait item processing - [ ] :construction: teach HIR trait coherence checks to correctly correct supertrait items - [ ] :construction: RFC to receive official tracking issue nr. - [ ] :warning: polish up for merge - === RfL scope ends here === - [ ] :traffic_light: Next PR - [ ] Migrate `Deref::Target` and apply the forementioned trait attribute - [ ] Migrate all uses `deref_target` language item to `receiver_target` - [ ] Crater run

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully