[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zn2SxvgfbWbmVnYY@boqun-archlinux>
Date: Thu, 27 Jun 2024 09:26:46 -0700
From: Boqun Feng <boqun.feng@...il.com>
To: Alice Ryhl <aliceryhl@...gle.com>
Cc: Steven Rostedt <rostedt@...dmis.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Peter Zijlstra <peterz@...radead.org>,
Josh Poimboeuf <jpoimboe@...nel.org>, Jason Baron <jbaron@...mai.com>,
Ard Biesheuvel <ardb@...nel.org>, Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...sung.com>,
linux-trace-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org,
Arnd Bergmann <arnd@...db.de>, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>,
"Peter Zijlstra (Intel)" <peterz@...radaed.org>,
Sean Christopherson <seanjc@...gle.com>, Uros Bizjak <ubizjak@...il.com>,
Catalin Marinas <catalin.marinas@....com>, Will Deacon <will@...nel.org>,
Marc Zyngier <maz@...nel.org>, Oliver Upton <oliver.upton@...ux.dev>,
Mark Rutland <mark.rutland@....com>, Ryan Roberts <ryan.roberts@....com>,
Fuad Tabba <tabba@...gle.com>, linux-arm-kernel@...ts.infradead.org,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>, Albert Ou <aou@...s.berkeley.edu>,
Anup Patel <apatel@...tanamicro.com>,
Andrew Jones <ajones@...tanamicro.com>,
Alexandre Ghiti <alexghiti@...osinc.com>,
Conor Dooley <conor.dooley@...rochip.com>,
Samuel Holland <samuel.holland@...ive.com>,
linux-riscv@...ts.infradead.org, Huacai Chen <chenhuacai@...nel.org>,
WANG Xuerui <kernel@...0n.name>, Bibo Mao <maobibo@...ngson.cn>,
Tiezhu Yang <yangtiezhu@...ngson.cn>,
Andrew Morton <akpm@...ux-foundation.org>,
Tianrui Zhao <zhaotianrui@...ngson.cn>, loongarch@...ts.linux.dev
Subject: Re: [PATCH v3 1/2] rust: add static_key_false
On Thu, Jun 27, 2024 at 10:34:39AM +0200, Alice Ryhl wrote:
> On Tue, Jun 25, 2024 at 6:18 PM Boqun Feng <boqun.feng@...il.com> wrote:
> >
> > Hi Alice,
> >
> > On Fri, Jun 21, 2024 at 10:35:26AM +0000, Alice Ryhl wrote:
> > > Add just enough support for static key so that we can use it from
> > > tracepoints. Tracepoints rely on `static_key_false` even though it is
> > > deprecated, so we add the same functionality to Rust.
> > >
> > > It is not possible to use the existing C implementation of
> > > arch_static_branch because it passes the argument `key` to inline
> > > assembly as an 'i' parameter, so any attempt to add a C helper for this
> > > function will fail to compile because the value of `key` must be known
> > > at compile-time.
> > >
> > > Signed-off-by: Alice Ryhl <aliceryhl@...gle.com>
> >
> > [Add linux-arch, and related arch maintainers Cced]
> >
> > Since inline asms are touched here, please consider copying linux-arch
> > and arch maintainers next time ;-)
>
> Will do.
>
> > For x86_64 and arm64 bits:
> >
> > Acked-by: Boqun Feng <boqun.feng@...il.com>
> >
> > One thing though, we should split the arch-specific impls into different
> > files, for example: rust/kernel/arch/arm64.rs or rust/arch/arm64.rs.
> > That'll be easier for arch maintainers to watch the Rust changes related
> > to a particular architecture.
>
> Is that how you would prefer to name these files? You don't want
> static_key somewhere in the filename?
>
I could have been more explicit. My preference is (for example ARM64)
* we have a rust/kernel/arch.rs, where we do:
#[cfg(CONFIG_ARM64)]
mod arm64::*;
#[cfg(CONFIG_ARM64)]
pub use arm64::*;
* we have a rust/kernel/arch/arm64.rs:
pub(crate) mod jump_label;
* we have a rust/kernel/arch/arm64/jump_label.rs, where we put
ARM64 arch_static_branch() there. (or static_key.rs and
arch_static_key_false()).
Then linux-arch can watch:
rust/kernel/arch.rs
rust/kernel/arch/
And ARM64 maintainers can watch:
rust/kernel/arch/arm64.rs
rust/kernel/arch/arm64
This is similar to how <asm/*.h> are organized today.
Does this make sense?
Regards,
Boqun
> > Another thought is that, could you implement an arch_static_branch!()
> > (instead of _static_key_false!()) and use it for static_key_false!()
> > similar to what we have in C? The benefit is that at least for myself
> > it'll be easier to compare the implementation between C and Rust.
>
> I can try to include that.
>
> Alice
Powered by blists - more mailing lists