# Meeting 2024-02-28 <!-- 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 --> Atomic API [wip](https://github.com/fbq/linux/commits/dev/rust/atomic/), things need to do: * A Rust-for-Linux issue to track our memory model policy * A in-kernel doc stating memory model policy * Atomics API patchset, currently I plan to only support `Arc` case as a starter. ```clike= if (READ_ONCE(flag)) { WRITE_ONCE(m, 1); } ``` ### Arbitrary self types Gary: Report after attending the design meeting. Some movements, it seems raw pointer, `NonNull` and `Weak` will be not considered for the initial version of the RFC. No movement on dynamic dispatch, but got Niko's echo on expanding the scope of dynamic dispatch to not limit on self types. ## Discussion Questions <!-- Anything that requires lengthy discussion/more general questions also fit here --> ### Pinning of the `data` field of `Lock` * [Zulip thread](https://rust-for-linux.zulipchat.com/#narrow/stream/291565-Help/topic/New.20lock.20from.20initializer) * [Patch suggestion](https://github.com/metaspace/linux/commit/0557fa0acad0d43badbca7083c59c7fbb6bc3e30) Gary: initial version of my pin-init prototype have data field pinned: https://github.com/nbdd0121/pin-init/blob/702701e19224dace9796366badba8bf3abf954d4/examples/pthread_mutex.rs#L86 :) Andreas: need to use `Spinlock<XArray>` because `XArray`'s internal spinlock is located in the same cache line with the root pointer. Benno: `Pin<Guard>` Andreas: `DerefMut where T: Unpin` Gary: Maybe fix C side? Andreas: C side is still using radix tree instead of XArray. A patch exists for C code to switch to XArray, but it'll have the same performance issue. ### Alice will rant about printk ```rust #[inline(never)] fn print(s: &str) { pr_warn!("{} on {}\n", s, unsafe { kernel::bindings::smp_processor_id() }); } // size is an usize // bunch of prints before this print("ENOSPC"); pr_warn!("ENOSPC from range_alloc.reserve_new - size: {}\n", size); print("before drop alloc 1/4"); print("before drop alloc 2/4"); print("before drop alloc 3/4"); print("before drop alloc 4/4"); drop(alloc); print("after drop alloc"); ``` Output: ```text [ 46.024445][ T5209] rust_binder: about to find_best_match on 4 [ 46.024449][ T5209] rust_binder: find_best_match on 4 [ 46.024452][ T5209] rust_kernel: cursor_lower_bound iteration 0 on 4 [ 46.024456][ T5209] rust_kernel: cursor_lower_bound key > this_key on 4 [ 46.024461][ T5209] rust_kernel: cursor_lower_bound after loop on 4 [ 46.024465][ T5209] rust_binder: after find_best_match on 4 [ 46.024471][ T5209] rust_binder: ENOSPC on 4 [ 48.883926][ T867] s3c2410-wdt 10070000.watchdog_cl1: Watchdog cluster 1 keepalive!, old_wtcnt = 7750, wtcnt = cc8c [ 51.993262][ C0] exynos_ehld_do_policy: cpu4 is hardlockup warning [ 51.993275][ C0] EHLD trace requires SJTAG authentication [ 52.876624][ T307] exynos-pcie-rc 11920000.pcie: AFC cal mode set to restart [ 52.886566][ T307] exynos-pcie-rc 11920000.pcie: exynos_pcie_rc_establish_link: Set PERST to logical 0, gpio(86) val=(0) [ 52.905620][ T307] logbuffer_pcie0: [ 106] D state: 0, LTSSM: 0 [ 52.905770][ T307] logbuffer_pcie0: [ 107] L0(0x11) [ 53.039649][ T307] exynos-pcie-rc 11920000.pcie: AFC cal mode set to restart [ 53.049568][ T307] exynos-pcie-rc 11920000.pcie: exynos_pcie_rc_establish_link: Set PERST to logical 0, gpio(86) val=(0) [ 53.069682][ T307] logbuffer_pcie0: [ 108] D state: 0, LTSSM: 0 [ 53.069871][ T307] logbuffer_pcie0: [ 109] L0(0x11) [ 55.993264][ C0] exynos_ehld_do_policy: cpu4 is hardlockup by software [ 55.993275][ C0] EHLD trace requires SJTAG authentication [ 56.682985][ T10] exynos-pcie-rc 11920000.pcie: AFC cal mode set to restart [ 56.693100][ T10] exynos-pcie-rc 11920000.pcie: exynos_pcie_rc_establish_link: Set PERST to logical 0, gpio(86) val=(0) [ 56.713323][ T10] logbuffer_pcie0: [ 110] D state: 0, LTSSM: 0 [ 56.713504][ T10] logbuffer_pcie0: [ 111] L0(0x11) [ 58.884722][ T867] s3c2410-wdt 10070000.watchdog_cl1: Watchdog cluster 1 keepalive!, old_wtcnt = 7750, wtcnt = cc8c [ 59.263964][ T307] exynos-pcie-rc 11920000.pcie: AFC cal mode set to restart [ 59.273944][ T307] exynos-pcie-rc 11920000.pcie: exynos_pcie_rc_establish_link: Set PERST to logical 0, gpio(86) val=(0) [ 59.293613][ T307] logbuffer_pcie0: [ 112] D state: 0, LTSSM: 0 [ 59.293760][ T307] logbuffer_pcie0: [ 113] L0(0x11) [ 60.943526][ C3] hardlockup-watchdog: cpu4: hrint:11 thresh:12, now:56, touch_ts:41 [ 60.943551][ C3] EHLD trace requires SJTAG authentication [ 60.943561][ C3] exynos_ehld_hardlockup_handler: cpu0: pmu_val:0xc2, ehld_stat:0x0 [ 60.943573][ C3] exynos_ehld_hardlockup_handler: cpu1: pmu_val:0xc2, ehld_stat:0x0 [ 60.943583][ C3] exynos_ehld_hardlockup_handler: cpu2: pmu_val:0xc2, ehld_stat:0x0 [ 60.943593][ C3] exynos_ehld_hardlockup_handler: cpu3: pmu_val:0xc2, ehld_stat:0x0 [ 60.943603][ C3] exynos_ehld_hardlockup_handler: cpu4: pmu_val:0xc2, ehld_stat:0x82 [ 60.943612][ C3] exynos_ehld_hardlockup_handler: cpu5: pmu_val:0xc2, ehld_stat:0x0 [ 60.943622][ C3] exynos_ehld_hardlockup_handler: cpu6: pmu_val:0xc2, ehld_stat:0x0 [ 60.943631][ C3] exynos_ehld_hardlockup_handler: cpu7: pmu_val:0xc2, ehld_stat:0x0 [ 60.943640][ C3] Kernel panic - not syncing: Watchdog detected hard LOCKUP on cpu 4 ``` - Too much stack used? - Delete just the `usize` / try `usize` formatting elsewhere. - `CONFIG_DEBUG_ATOMIC_SLEEP=y`. - Hex formatting. - Split formatting into its own. - Printing outside the spinlock. ## Miscellaneous <!-- stuff that does not fit into other categories -->