From: Eder Zulian <ezulian@redhat.com>
To: linux-kernel@vger.kernel.org, linux-next@vger.kernel.org,
rust-for-linux@vger.kernel.org
Cc: miguel.ojeda.sandonis@gmail.com, tglx@linutronix.de,
williams@redhat.com, ojeda@kernel.org, alex.gaynor@gmail.com,
gary@garyguo.net, bjorn3_gh@protonmail.com,
benno.lossin@proton.me, a.hindborg@kernel.org,
aliceryhl@google.com, tmgross@umich.edu, jlelli@redhat.com,
peterz@infradead.org, mingo@redhat.com, will@kernel.org,
longman@redhat.com, boqun.feng@gmail.com, bigeasy@linutronix.de,
sfr@canb.auug.org.au, hpa@zytor.com
Subject: [PATCH v3 0/1] rust: helpers: Avoid raw_spin_lock initialization for PREEMPT_RT
Date: Thu, 7 Nov 2024 17:32:22 +0100 [thread overview]
Message-ID: <20241107163223.2092690-1-ezulian@redhat.com> (raw)
Hello!
When PREEMPT_RT=y, spin locks are mapped to rt_mutex types, so using
spinlock_check() + __raw_spin_lock_init() to initialize spin locks is
incorrect, and would cause build errors.
This v3 patch introduces __spin_lock_init() to initialize a spin lock with
lockdep rquired information for PREEMPT_RT builds, and use it in the Rust
helper.
This patch was developed on top of linux-next/master.
As a note, at the time of writing, RUST support for x86_64 depends on
!(MITIGATION_RETHUNK && KASAN) || RUSTC_VERSION >= 108300. Miguel Ojeda
pointed out that this can be avoided with Rust 1.83, to be released in 3
weeks (2024-11-28).
In order to reproduce the problem rust must be available on the system.
$ make LLVM=1 rustavailable
With CONFIG_PREEMPT_RT=y, CONFIG_RUST=y, and CONFIG_DEBUG_SPINLOCK=y a
x86_64 kernel can be built with
$ make LLVM=1 -j$(nproc) bzImage
The problem was reported at least in:
https://lore.kernel.org/oe-kbuild-all/202409251238.vetlgXE9-lkp@intel.com/
https://lore.kernel.org/all/20241107182411.57e2b418@canb.auug.org.au/
Links to v1 and v2 where improvement suggestions were made:
https://lore.kernel.org/all/20241014195253.1704625-1-ezulian@redhat.com/
https://lore.kernel.org/all/20241106211215.2005909-1-ezulian@redhat.com/
Version 2 changes:
- Cleaned up style and incorporated feedback from reviewers Boqun Feng and
Miguel Ojeda.
Version 3 changes:
- Addressed review comments from Boqun Feng. Improved commit title and
description and used a proper 'Fixed:' tag.
Thanks,
Eder Zulian (1):
rust: helpers: Avoid raw_spin_lock initialization for PREEMPT_RT
include/linux/spinlock_rt.h | 15 +++++++--------
rust/helpers/spinlock.c | 8 ++++++--
2 files changed, 13 insertions(+), 10 deletions(-)
--
2.47.0
next reply other threads:[~2024-11-07 16:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-07 16:32 Eder Zulian [this message]
2024-11-07 16:32 ` [PATCH v3 1/1] rust: helpers: Avoid raw_spin_lock initialization for PREEMPT_RT Eder Zulian
2024-11-07 20:19 ` Boqun Feng
2024-11-07 16:50 ` [PATCH v3 0/1] " Miguel Ojeda
2024-11-07 17:09 ` Eder Zulian
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=20241107163223.2092690-1-ezulian@redhat.com \
--to=ezulian@redhat.com \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bigeasy@linutronix.de \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=gary@garyguo.net \
--cc=hpa@zytor.com \
--cc=jlelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=longman@redhat.com \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=mingo@redhat.com \
--cc=ojeda@kernel.org \
--cc=peterz@infradead.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=sfr@canb.auug.org.au \
--cc=tglx@linutronix.de \
--cc=tmgross@umich.edu \
--cc=will@kernel.org \
--cc=williams@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).