From: ChaosEsque Team <chaosesqueteam@gmail.com>
To: FUJITA Tomonori <fujita.tomonori@gmail.com>
Cc: a.hindborg@kernel.org, alex.gaynor@gmail.com, ojeda@kernel.org,
aliceryhl@google.com, anna-maria@linutronix.de,
bjorn3_gh@protonmail.com, boqun.feng@gmail.com, dakr@kernel.org,
frederic@kernel.org, gary@garyguo.net, jstultz@google.com,
linux-kernel@vger.kernel.org, lossin@kernel.org,
lyude@redhat.com, rust-for-linux@vger.kernel.org,
sboyd@kernel.org, tglx@linutronix.de, tmgross@umich.edu,
acourbot@nvidia.com, daniel.almeida@collabora.com
Subject: Re: [PATCH v2 1/2] rust: Add cpu_relax() helper
Date: Thu, 2 Oct 2025 12:36:21 -0400 [thread overview]
Message-ID: <CALC8CXdU4PkSK3yy_tGi-ygRhFQG9UT2jLTmbv6q-RtESUPVjg@mail.gmail.com> (raw)
In-Reply-To: <20250817044724.3528968-2-fujita.tomonori@gmail.com>
PaX/Grsecurity did everything you are attempting to do, 20 years ago,
and applied to all running programs on the system, and the kernel.
Ofcourse it went proprietary and you cowards didn't even sue.
(And yes you could have, and could still do it)
Pieces of fucking shit.
On Sun, Aug 17, 2025 at 12:49 AM FUJITA Tomonori
<fujita.tomonori@gmail.com> wrote:
>
> Add cpu_relax() helper in preparation for supporting
> read_poll_timeout().
>
> Reviewed-by: Alice Ryhl <aliceryhl@google.com>
> Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org>
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
> ---
> rust/helpers/helpers.c | 1 +
> rust/helpers/processor.c | 8 ++++++++
> rust/kernel/lib.rs | 1 +
> rust/kernel/processor.rs | 14 ++++++++++++++
> 4 files changed, 24 insertions(+)
> create mode 100644 rust/helpers/processor.c
> create mode 100644 rust/kernel/processor.rs
>
> diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
> index 7cf7fe95e41d..04598665e7c8 100644
> --- a/rust/helpers/helpers.c
> +++ b/rust/helpers/helpers.c
> @@ -34,6 +34,7 @@
> #include "pid_namespace.c"
> #include "platform.c"
> #include "poll.c"
> +#include "processor.c"
> #include "property.c"
> #include "rbtree.c"
> #include "rcu.c"
> diff --git a/rust/helpers/processor.c b/rust/helpers/processor.c
> new file mode 100644
> index 000000000000..d41355e14d6e
> --- /dev/null
> +++ b/rust/helpers/processor.c
> @@ -0,0 +1,8 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#include <linux/processor.h>
> +
> +void rust_helper_cpu_relax(void)
> +{
> + cpu_relax();
> +}
> diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
> index ed53169e795c..c098c47c1817 100644
> --- a/rust/kernel/lib.rs
> +++ b/rust/kernel/lib.rs
> @@ -110,6 +110,7 @@
> pub mod platform;
> pub mod prelude;
> pub mod print;
> +pub mod processor;
> pub mod rbtree;
> pub mod regulator;
> pub mod revocable;
> diff --git a/rust/kernel/processor.rs b/rust/kernel/processor.rs
> new file mode 100644
> index 000000000000..85b49b3614dd
> --- /dev/null
> +++ b/rust/kernel/processor.rs
> @@ -0,0 +1,14 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +//! Processor related primitives.
> +//!
> +//! C header: [`include/linux/processor.h`](srctree/include/linux/processor.h)
> +
> +/// Lower CPU power consumption or yield to a hyperthreaded twin processor.
> +///
> +/// It also happens to serve as a compiler barrier.
> +#[inline]
> +pub fn cpu_relax() {
> + // SAFETY: Always safe to call.
> + unsafe { bindings::cpu_relax() }
> +}
> --
> 2.43.0
>
>
next prev parent reply other threads:[~2025-10-02 16:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-17 4:47 [PATCH v2 0/2] rust: Add read_poll_timeout FUJITA Tomonori
2025-08-17 4:47 ` [PATCH v2 1/2] rust: Add cpu_relax() helper FUJITA Tomonori
2025-08-19 18:32 ` Daniel Almeida
2025-10-02 16:32 ` ChaosEsque Team
2025-10-02 16:33 ` ChaosEsque Team
2025-10-02 16:34 ` ChaosEsque Team
2025-10-02 16:36 ` ChaosEsque Team [this message]
2025-08-17 4:47 ` [PATCH v2 2/2] rust: Add read_poll_timeout functions FUJITA Tomonori
2025-08-19 0:49 ` Alexandre Courbot
2025-08-20 11:11 ` FUJITA Tomonori
2025-08-19 18:30 ` Daniel Almeida
2025-08-20 6:45 ` FUJITA Tomonori
2025-08-20 10:02 ` Alice Ryhl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CALC8CXdU4PkSK3yy_tGi-ygRhFQG9UT2jLTmbv6q-RtESUPVjg@mail.gmail.com \
--to=chaosesqueteam@gmail.com \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=anna-maria@linutronix.de \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=frederic@kernel.org \
--cc=fujita.tomonori@gmail.com \
--cc=gary@garyguo.net \
--cc=jstultz@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=lyude@redhat.com \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=sboyd@kernel.org \
--cc=tglx@linutronix.de \
--cc=tmgross@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®