[PATCH v6 0/4] rust: Add bug/warn abstractions

FUJITA Tomonori fujita.tomonori at gmail.com
Tue Jul 22 23:20:42 PDT 2025


On Wed, 23 Jul 2025 02:48:20 +0200
Miguel Ojeda <miguel.ojeda.sandonis at gmail.com> wrote:

>> This patchset adds warn_on macro with the bug/warn abstraction that
>> utilizes the kernel's BUG/WARN feature via assembly.
> 
> Ok, let's move forward with this.
> 
> I took a look at the first three patches and compared the expanded
> output for the existing macros, to make sure we (hopefully) don't
> break anything else.

Thanks a lot!

> It seems OK, I only noticed a removed newline. Was that intentional?

The patch for arm64? I tried to minimize changes to the original code
so not intentional.

> There was also a bad parameter name, but that was not hurting anything
> since it was unused.
> 
> (For the x86 one could be closer removing a couple spaces, but it
> should not matter and other x86 files format it that way, so I didn't
> change it. I also noticed unexpected spaces used for aligning the
> macro, but it turned out it was in the original already, so I left it
> also unchanged.)

Yeah, I followed the original code style.

> Then I found a few more bits on the last patch.
> 
> Tomo, could you please double-check you are OK with all the changes,
> and please run the tests you did back then on `rust-next` again for
> all arches, given it has been a while since you posted it (plus I did
> a few changes on top, after all)? I would appreciate it, thanks in
> advance!

I've just tested rust-next. Looks like all arches (x86, riscv, and
arm64) works as expected.

> To be clear, I didn't re-check every single thing/combination, but
> hopefully what I caught helps. Since there are no users anyway (of the
> last patch) right now, it should be fairly safe.
> 
> Applied to `rust-next` -- thanks everyone!
> 
>     [ Fixed typo in macro parameter name. - Miguel ]
> 
>     [ Remove ending newline in `ARCH_WARN_ASM` content to be closer to the
>       original. - Miguel ]
> 
>     [ Avoid evaluating the condition twice (a good idea in general,
>       but it also matches the C side). Simplify with `as_char_ptr()`
>       to avoid a cast. Cast to `ffi` integer types for
>       `warn_slowpath_fmt`. Avoid cast for `null()`. - Miguel ]
> 

All the changes look good.

Thanks!



More information about the linux-arm-kernel mailing list