# Meeting 2025-06-25
<!-- 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 -->
### LTO
Andreas would want to drop his LTO patches and use Gary's series.
Checking blockers on Gary's helper LTO series
Plan:
* Put "experimental" on the kconfig
* Present the plan/status in Kangrejos or LPC, also performance numbers.
*
### Atomic API
(follow-up discussion: https://lore.kernel.org/rust-for-linux/20250621123212.66fb016b.gary@garyguo.net/)
```rust
pub struct Atomic<T: AllowAtomic>(Opaque<T>);
```
or
```rust
pub struct Atomic<T: AllowAtomic>(Opaque<T::Repr>);
```
?
Boqun: `Atomic<T>` should really be just transparent to `T`, hence `Opaque<T>` makes more sense, and we try atomic operations as `asm!()` which loads/stores the value out of Rust abstract machine.
Considering:
```rust=
impl<T: AllowAtomic> Atomic<T> {
pub const fn new(v: T) -> Self;
pub unsafe fn from_ptr(ptr: *mut T) -> &Self;
pub fn get_mut(&mut self) -> &mut T {
let repr: s
}
// and maybe in the future
pub fn from_mut(&mut T) -> &mut Self;
pub fn xchg(&self, new: T) -> T {
let new = T::into_repr(new);
// this can be:
// let ptr = self.0.get();
// if using Opaque<T::Repr>
let ptr = self.0.get().cast::<T::Repr>();
// For example:
//
// pub fn atomic_xchg(ptr: *mut i32, new: i32) -> i32
let old = T::Repr::atomic_xchg(ptr, new);
T::from_repr(old)
}
}
```
```rust=
let mut ptr: *mut Foo = ...;
let new: *mut Foo = ...;
let x: &mut *mut Foo = &mut ptr;
*x = new;
println!("{}", *ptr); // <- correct provenance
let x: *mut *mut Foo = x;
let y: *mut usize = x.cast::<usize>();
// modifying `ptr`
*y = new as usize; // <- this erase provenance on `ptr`.
let z = ptr; // <- z has invalid provenance
asm!("mov [{}], {}", in(reg) x.cast::<usize>(), in(reg) new as usize); // <- this does not erase provenance on `ptr`.
// ^ this is cursed :(
// We can reason as `x.cast::<*const ()>().write(std::ptr::from_exposed_provenance(y))`
// Gary: write_volatile still erases provenance.
```
```rust
pub struct AtomicPtr<T>(Opaque<usize>);
impl<T> AtomicPtr<T> {
pub fn get_mut(&mut self) ->
}
```
`Atomic<(u8, u16)>
```rust!
#[repr(i32)]
pub enum State {
a = 1,
b = 2,
}
```
```rust
let x: Opaque<T> = ...;
let y: &mut T = &mut *x.get();
let z: &mut T = &mut *x.get();
// not allowed
```
## Miscellaneous
<!-- stuff that does not fit into other categories -->