<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-rng/rust/kernel/sync, branch master</title>
<subtitle>Development tree for the kernel CSPRNG</subtitle>
<id>https://git.zx2c4.com/linux-rng/atom/rust/kernel/sync?h=master</id>
<link rel='self' href='https://git.zx2c4.com/linux-rng/atom/rust/kernel/sync?h=master'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-rng/'/>
<updated>2025-12-02T03:50:58Z</updated>
<entry>
<title>Merge tag 'locking-core-2025-12-01' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip</title>
<updated>2025-12-02T03:50:58Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2025-12-02T03:50:58Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-rng/commit/?id=b53440f8e5a1466870d7a1d255e0f9966e0041fb'/>
<id>urn:sha1:b53440f8e5a1466870d7a1d255e0f9966e0041fb</id>
<content type='text'>
Pull locking updates from Ingo Molnar:
 "Mutexes:

   - Redo __mutex_init() to reduce generated code size (Sebastian
     Andrzej Siewior)

  Seqlocks:

   - Introduce scoped_seqlock_read() (Peter Zijlstra)

   - Change thread_group_cputime() to use scoped_seqlock_read() (Oleg
     Nesterov)

   - Change do_task_stat() to use scoped_seqlock_read() (Oleg Nesterov)

   - Change do_io_accounting() to use scoped_seqlock_read() (Oleg
     Nesterov)

   - Fix the incorrect documentation of read_seqbegin_or_lock() /
     need_seqretry() (Oleg Nesterov)

   - Allow KASAN to fail optimizing (Peter Zijlstra)

  Local lock updates:

   - Fix all kernel-doc warnings (Randy Dunlap)

   - Add the &lt;linux/local_lock*.h&gt; headers to MAINTAINERS (Sebastian
     Andrzej Siewior)

   - Reduce the risk of shadowing via s/l/__l/ and s/tl/__tl/ (Vincent
     Mailhol)

  Lock debugging:

   - spinlock/debug: Fix data-race in do_raw_write_lock (Alexander
     Sverdlin)

  Atomic primitives infrastructure:

   - atomic: Skip alignment check for try_cmpxchg() old arg (Arnd
     Bergmann)

  Rust runtime integration:

   - sync: atomic: Enable generated Atomic&lt;T&gt; usage (Boqun Feng)

   - sync: atomic: Implement Debug for Atomic&lt;Debug&gt; (Boqun Feng)

   - debugfs: Remove Rust native atomics and replace them with Linux
     versions (Boqun Feng)

   - debugfs: Implement Reader for Mutex&lt;T&gt; only when T is Unpin (Boqun
     Feng)

   - lock: guard: Add T: Unpin bound to DerefMut (Daniel Almeida)

   - lock: Pin the inner data (Daniel Almeida)

   - lock: Add a Pin&lt;&amp;mut T&gt; accessor (Daniel Almeida)"

* tag 'locking-core-2025-12-01' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  locking/local_lock: Fix all kernel-doc warnings
  locking/local_lock: s/l/__l/ and s/tl/__tl/ to reduce the risk of shadowing
  locking/local_lock: Add the &lt;linux/local_lock*.h&gt; headers to MAINTAINERS
  locking/mutex: Redo __mutex_init() to reduce generated code size
  rust: debugfs: Replace the usage of Rust native atomics
  rust: sync: atomic: Implement Debug for Atomic&lt;Debug&gt;
  rust: sync: atomic: Make Atomic*Ops pub(crate)
  seqlock: Allow KASAN to fail optimizing
  rust: debugfs: Implement Reader for Mutex&lt;T&gt; only when T is Unpin
  seqlock: Change do_io_accounting() to use scoped_seqlock_read()
  seqlock: Change do_task_stat() to use scoped_seqlock_read()
  seqlock: Change thread_group_cputime() to use scoped_seqlock_read()
  seqlock: Introduce scoped_seqlock_read()
  documentation: seqlock: fix the wrong documentation of read_seqbegin_or_lock/need_seqretry
  atomic: Skip alignment check for try_cmpxchg() old arg
  rust: lock: Add a Pin&lt;&amp;mut T&gt; accessor
  rust: lock: Pin the inner data
  rust: lock: guard: Add T: Unpin bound to DerefMut
  locking/spinlock/debug: Fix data-race in do_raw_write_lock
</content>
</entry>
<entry>
<title>rust: sync: atomic: Implement Debug for Atomic&lt;Debug&gt;</title>
<updated>2025-11-12T16:56:41Z</updated>
<author>
<name>Boqun Feng</name>
<email>boqun.feng@gmail.com</email>
</author>
<published>2025-10-22T03:53:23Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-rng/commit/?id=013f912eb5fa7c06b3648ca630acfc4ff26456fa'/>
<id>urn:sha1:013f912eb5fa7c06b3648ca630acfc4ff26456fa</id>
<content type='text'>
If `Atomic&lt;T&gt;` is `Debug` then it's a `debugfs::Writer`, therefore make
it so since 1) debugfs needs to support `Atomic&lt;T&gt;` and 2) it's rather
trivial to implement `Debug` for `Atomic&lt;Debug&gt;`.

Tested-by: David Gow &lt;davidgow@google.com&gt;
Acked-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Link: https://patch.msgid.link/20251022035324.70785-3-boqun.feng@gmail.com
</content>
</entry>
<entry>
<title>rust: sync: atomic: Make Atomic*Ops pub(crate)</title>
<updated>2025-11-12T16:56:38Z</updated>
<author>
<name>Boqun Feng</name>
<email>boqun.feng@gmail.com</email>
</author>
<published>2025-10-22T03:53:22Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-rng/commit/?id=14e9a18b07ec463a85094cc8942788336164319f'/>
<id>urn:sha1:14e9a18b07ec463a85094cc8942788336164319f</id>
<content type='text'>
In order to write code over a generate Atomic&lt;T&gt; we need to make
Atomic*Ops public so that functions like `.load()` and `.store()` are
available. Make these pub(crate) at the beginning so the usage in kernel
crate is supported.

Tested-by: David Gow &lt;davidgow@google.com&gt;
Acked-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Link: https://patch.msgid.link/20251022035324.70785-2-boqun.feng@gmail.com
</content>
</entry>
<entry>
<title>rust: condvar: fix broken intra-doc link</title>
<updated>2025-11-02T22:18:42Z</updated>
<author>
<name>Miguel Ojeda</name>
<email>ojeda@kernel.org</email>
</author>
<published>2025-10-29T07:33:44Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-rng/commit/?id=09b1704f5b02c18dd02b21343530463fcfc92c54'/>
<id>urn:sha1:09b1704f5b02c18dd02b21343530463fcfc92c54</id>
<content type='text'>
The future move of pin-init to `syn` uncovers the following broken
intra-doc link:

    error: unresolved link to `crate::pin_init`
      --&gt; rust/kernel/sync/condvar.rs:39:40
       |
    39 | /// instances is with the [`pin_init`](crate::pin_init!) and [`new_condvar`] macros.
       |                                        ^^^^^^^^^^^^^^^^ no item named `pin_init` in module `kernel`
       |
       = note: `-D rustdoc::broken-intra-doc-links` implied by `-D warnings`
       = help: to override `-D warnings` add `#[allow(rustdoc::broken_intra_doc_links)]`

Currently, when rendered, the link points to a literal `crate::pin_init!`
URL.

Thus fix it.

Cc: stable@vger.kernel.org
Fixes: 129e97be8e28 ("rust: pin-init: fix documentation links")
Reviewed-by: Alice Ryhl &lt;aliceryhl@google.com&gt;
Link: https://patch.msgid.link/20251029073344.349341-1-ojeda@kernel.org
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
</entry>
<entry>
<title>rust: lock: Add a Pin&lt;&amp;mut T&gt; accessor</title>
<updated>2025-10-21T10:31:56Z</updated>
<author>
<name>Daniel Almeida</name>
<email>daniel.almeida@collabora.com</email>
</author>
<published>2025-09-19T09:12:41Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-rng/commit/?id=66f1ea83d9f8346324fc50779944297d778cac95'/>
<id>urn:sha1:66f1ea83d9f8346324fc50779944297d778cac95</id>
<content type='text'>
In order for callers to be able to access the inner T safely if T:
!Unpin, there needs to be a way to get a Pin&lt;&amp;mut T&gt;. Add this accessor
and a corresponding example to tell users how it works.

This requires the pin projection functionality [1] for better ergonomic.

[boqun: Apply Daniel's fix to the code example, add the reference to pin
projection patch and remove out-of-date part in the commit log]

Suggested-by: Benno Lossin &lt;lossin@kernel.org&gt;
Suggested-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Signed-off-by: Daniel Almeida &lt;daniel.almeida@collabora.com&gt;
Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Alice Ryhl &lt;aliceryhl@google.com&gt;
Reviewed-by: Benno Lossin &lt;lossin@kernel.org&gt;
Link: https://github.com/Rust-for-Linux/linux/issues/1181
Link: https://lore.kernel.org/rust-for-linux/20250912174148.373530-1-lossin@kernel.org/ [1]
</content>
</entry>
<entry>
<title>rust: lock: Pin the inner data</title>
<updated>2025-10-21T10:31:55Z</updated>
<author>
<name>Daniel Almeida</name>
<email>daniel.almeida@collabora.com</email>
</author>
<published>2025-09-19T09:12:40Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-rng/commit/?id=2497a7116ff9a051d0e78885a27a52213bc2841d'/>
<id>urn:sha1:2497a7116ff9a051d0e78885a27a52213bc2841d</id>
<content type='text'>
In preparation to support Lock&lt;T&gt; where T is pinned, the first thing
that needs to be done is to structurally pin the 'data' member. This
switches the 't' parameter in Lock&lt;T&gt;::new() to take in an impl
PinInit&lt;T&gt; instead of a plain T. This in turn uses the blanket
implementation "impl PinInit&lt;T&gt; for T".

Subsequent patches will touch on Guard&lt;T&gt;.

Suggested-by: Benno Lossin &lt;lossin@kernel.org&gt;
Suggested-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Signed-off-by: Daniel Almeida &lt;daniel.almeida@collabora.com&gt;
Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Benno Lossin &lt;lossin@kernel.org&gt;
Reviewed-by: Alice Ryhl &lt;aliceryhl@google.com&gt;
Link: https://github.com/Rust-for-Linux/linux/issues/1181
</content>
</entry>
<entry>
<title>rust: lock: guard: Add T: Unpin bound to DerefMut</title>
<updated>2025-10-21T10:31:55Z</updated>
<author>
<name>Daniel Almeida</name>
<email>daniel.almeida@collabora.com</email>
</author>
<published>2025-09-19T09:12:39Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-rng/commit/?id=da123f0ee40f0e5a3791bbaf58a1db1744c59f72'/>
<id>urn:sha1:da123f0ee40f0e5a3791bbaf58a1db1744c59f72</id>
<content type='text'>
A core property of pinned types is not handing a mutable reference to
the inner data in safe code, as this trivially allows that data to be
moved.

Enforce this condition by adding a bound on lock::Guard's DerefMut
implementation, so that it's only implemented for pinning-agnostic
types.

Suggested-by: Benno Lossin &lt;lossin@kernel.org&gt;
Suggested-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Signed-off-by: Daniel Almeida &lt;daniel.almeida@collabora.com&gt;
Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Benno Lossin &lt;lossin@kernel.org&gt;
Reviewed-by: Alice Ryhl &lt;aliceryhl@google.com&gt;
Link: https://github.com/Rust-for-Linux/linux/issues/1181
</content>
</entry>
<entry>
<title>Merge tag 'rust-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux</title>
<updated>2025-10-01T02:12:49Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2025-10-01T02:12:49Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-rng/commit/?id=f4e0ff7e45c30f4665cfbbe2f0538e9c5789bebc'/>
<id>urn:sha1:f4e0ff7e45c30f4665cfbbe2f0538e9c5789bebc</id>
<content type='text'>
Pull rust updates from Miguel Ojeda:
 "Toolchain and infrastructure:

   - Derive 'Zeroable' for all structs and unions generated by 'bindgen'
     where possible and corresponding cleanups. To do so, add the
     'pin-init' crate as a dependency to 'bindings' and 'uapi'.

     It also includes its first use in the 'cpufreq' module, with more
     to come in the next cycle.

   - Add warning to the 'rustdoc' target to detect broken 'srctree/'
     links and fix existing cases.

   - Remove support for unused (since v6.16) host '#[test]'s,
     simplifying the 'rusttest' target. Tests should generally run
     within KUnit.

  'kernel' crate:

   - Add 'ptr' module with a new 'Alignment' type, which is always a
     power of two and is used to validate that a given value is a valid
     alignment and to perform masking and alignment operations:

         // Checked at build time.
         assert_eq!(Alignment::new::&lt;16&gt;().as_usize(), 16);

         // Checked at runtime.
         assert_eq!(Alignment::new_checked(15), None);

         assert_eq!(Alignment::of::&lt;u8&gt;().log2(), 0);

         assert_eq!(0x25u8.align_down(Alignment::new::&lt;0x10&gt;()), 0x20);
         assert_eq!(0x5u8.align_up(Alignment::new::&lt;0x10&gt;()), Some(0x10));
         assert_eq!(u8::MAX.align_up(Alignment::new::&lt;0x10&gt;()), None);

     It also includes its first use in Nova.

   - Add 'core::mem::{align,size}_of{,_val}' to the prelude, matching
     Rust 1.80.0.

   - Keep going with the steps on our migration to the standard library
     'core::ffi::CStr' type (use 'kernel::{fmt, prelude::fmt!}' and use
     upstream method names).

   - 'error' module: improve 'Error::from_errno' and 'to_result'
     documentation, including examples/tests.

   - 'sync' module: extend 'aref' submodule documentation now that it
     exists, and more updates to complete the ongoing move of 'ARef' and
     'AlwaysRefCounted' to 'sync::aref'.

   - 'list' module: add an example/test for 'ListLinksSelfPtr' usage.

   - 'alloc' module:

      - Implement 'Box::pin_slice()', which constructs a pinned slice of
        elements.

      - Provide information about the minimum alignment guarantees of
        'Kmalloc', 'Vmalloc' and 'KVmalloc'.

      - Take minimum alignment guarantees of allocators for
        'ForeignOwnable' into account.

      - Remove the 'allocator_test' (including 'Cmalloc').

      - Add doctest for 'Vec::as_slice()'.

      - Constify various methods.

   - 'time' module:

      - Add methods on 'HrTimer' that can only be called with exclusive
        access to an unarmed timer, or from timer callback context.

      - Add arithmetic operations to 'Instant' and 'Delta'.

      - Add a few convenience and access methods to 'HrTimer' and
        'Instant'.

  'macros' crate:

   - Reduce collections in 'quote!' macro.

  And a few other cleanups and improvements"

* tag 'rust-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux: (58 commits)
  gpu: nova-core: use Alignment for alignment-related operations
  rust: add `Alignment` type
  rust: macros: reduce collections in `quote!` macro
  rust: acpi: use `core::ffi::CStr` method names
  rust: of: use `core::ffi::CStr` method names
  rust: net: use `core::ffi::CStr` method names
  rust: miscdevice: use `core::ffi::CStr` method names
  rust: kunit: use `core::ffi::CStr` method names
  rust: firmware: use `core::ffi::CStr` method names
  rust: drm: use `core::ffi::CStr` method names
  rust: cpufreq: use `core::ffi::CStr` method names
  rust: configfs: use `core::ffi::CStr` method names
  rust: auxiliary: use `core::ffi::CStr` method names
  drm/panic: use `core::ffi::CStr` method names
  rust: device: use `kernel::{fmt,prelude::fmt!}`
  rust: sync: use `kernel::{fmt,prelude::fmt!}`
  rust: seq_file: use `kernel::{fmt,prelude::fmt!}`
  rust: kunit: use `kernel::{fmt,prelude::fmt!}`
  rust: file: use `kernel::{fmt,prelude::fmt!}`
  rust: device: use `kernel::{fmt,prelude::fmt!}`
  ...
</content>
</entry>
<entry>
<title>rust: sync: use `kernel::{fmt,prelude::fmt!}`</title>
<updated>2025-09-16T07:26:59Z</updated>
<author>
<name>Tamir Duberstein</name>
<email>tamird@gmail.com</email>
</author>
<published>2025-08-13T15:39:53Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-rng/commit/?id=0fe1ca3c8bc5e0b278d4793247eb787131e84112'/>
<id>urn:sha1:0fe1ca3c8bc5e0b278d4793247eb787131e84112</id>
<content type='text'>
Reduce coupling to implementation details of the formatting machinery by
avoiding direct use for `core`'s formatting traits and macros.

Acked-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Reviewed-by: Alice Ryhl &lt;aliceryhl@google.com&gt;
Reviewed-by: Benno Lossin &lt;lossin@kernel.org&gt;
Signed-off-by: Tamir Duberstein &lt;tamird@gmail.com&gt;
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
</entry>
<entry>
<title>rust: block: convert `block::mq` to use `Refcount`</title>
<updated>2025-09-15T07:38:36Z</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2025-09-05T04:41:40Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-rng/commit/?id=a307bf1db5448eccd72a1d7857f7661c6330d5ad'/>
<id>urn:sha1:a307bf1db5448eccd72a1d7857f7661c6330d5ad</id>
<content type='text'>
Currently there's a custom reference counting in `block::mq`, which uses
`AtomicU64` Rust atomics, and this type doesn't exist on some 32-bit
architectures. We cannot just change it to use 32-bit atomics, because
doing so will make it vulnerable to refcount overflow. So switch it to
use the kernel refcount `kernel::sync::Refcount` instead.

There is an operation needed by `block::mq`, atomically decreasing
refcount from 2 to 0, which is not available through refcount.h, so
I exposed `Refcount::as_atomic` which allows accessing the refcount
directly.

[boqun: Adopt the LKMM atomic API]
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Benno Lossin &lt;lossin@kernel.org&gt;
Reviewed-by: Elle Rhumsaa &lt;elle@weathered-steel.dev&gt;
Acked-by: Andreas Hindborg &lt;a.hindborg@kernel.org&gt;
Tested-by: David Gow &lt;davidgow@google.com&gt;
Link: https://lore.kernel.org/r/20250723233312.3304339-5-gary@kernel.org
</content>
</entry>
</feed>
