From: Peter Zijlstra <peterz@infradead.org>
To: Boqun Feng <boqun.feng@gmail.com>
Cc: FUJITA Tomonori <fujita.tomonori@gmail.com>,
linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
netdev@vger.kernel.org, andrew@lunn.ch, hkallweit1@gmail.com,
tmgross@umich.edu, ojeda@kernel.org, alex.gaynor@gmail.com,
gary@garyguo.net, bjorn3_gh@protonmail.com,
benno.lossin@proton.me, a.hindborg@samsung.com,
aliceryhl@google.com, anna-maria@linutronix.de,
frederic@kernel.org, tglx@linutronix.de, arnd@arndb.de,
jstultz@google.com, sboyd@kernel.org, mingo@redhat.com,
juri.lelli@redhat.com, vincent.guittot@linaro.org,
dietmar.eggemann@arm.com, rostedt@goodmis.org,
bsegall@google.com, mgorman@suse.de, vschneid@redhat.com,
tgunders@redhat.com
Subject: Re: [PATCH v9 1/8] sched/core: Add __might_sleep_precision()
Date: Sat, 1 Feb 2025 13:16:13 +0100 [thread overview]
Message-ID: <20250201121613.GC8256@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <Z5rSjsdwG2aonZrB@boqun-archlinux>
On Wed, Jan 29, 2025 at 05:14:54PM -0800, Boqun Feng wrote:
> On Thu, Jan 30, 2025 at 08:56:44AM +0900, FUJITA Tomonori wrote:
> > On Tue, 28 Jan 2025 12:37:38 +0100
> > Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > > On Sat, Jan 25, 2025 at 07:18:46PM +0900, FUJITA Tomonori wrote:
> > >> Add __might_sleep_precision(), Rust friendly version of
> > >> __might_sleep(), which takes a pointer to a string with the length
> > >> instead of a null-terminated string.
> > >>
> > >> Rust's core::panic::Location::file(), which gives the file name of a
> > >> caller, doesn't provide a null-terminated
> > >> string. __might_sleep_precision() uses a precision specifier in the
> > >> printk format, which specifies the length of a string; a string
> > >> doesn't need to be a null-terminated.
> > >>
> > >> Modify __might_sleep() to call __might_sleep_precision() but the
> > >> impact should be negligible. strlen() isn't called in a normal case;
> > >> it's called only when printing the error (sleeping function called
> > >> from invalid context).
> > >>
> > >> Note that Location::file() providing a null-terminated string for
> > >> better C interoperability is under discussion [1].
> > >
> > > Urgh :/
> >
> > Yeah... so not acceptable?
Just frustrated we 'need' more ugly to deal with Rust being stupid.
> I would like to see some concrete and technical reasons for why it's not
> acceptable ;-) I'm not sure whether Peter was against this patch or just
> not happy about Location::file() providing a null-terminated string is a
> WIP.
The latter.
I just hate on Rust for being designed by a bunch of C haters, not
wanting to acknowledge the whole frigging world runs on C and they
*have* to deal with interoperability.
That got us a whole pile of ugly including this.
next prev parent reply other threads:[~2025-02-01 12:16 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-25 10:18 [PATCH v9 0/8] rust: Add IO polling FUJITA Tomonori
2025-01-25 10:18 ` [PATCH v9 1/8] sched/core: Add __might_sleep_precision() FUJITA Tomonori
2025-01-27 9:41 ` Alice Ryhl
2025-01-28 11:37 ` Peter Zijlstra
2025-01-29 23:56 ` FUJITA Tomonori
2025-01-30 1:14 ` Boqun Feng
2025-02-01 12:16 ` Peter Zijlstra [this message]
2025-01-25 10:18 ` [PATCH v9 2/8] rust: time: Add PartialEq/Eq/PartialOrd/Ord trait to Ktime FUJITA Tomonori
2025-01-28 10:18 ` Fiona Behrens
2025-01-25 10:18 ` [PATCH v9 3/8] rust: time: Introduce Delta type FUJITA Tomonori
2025-01-27 3:24 ` Gary Guo
2025-01-28 10:25 ` Fiona Behrens
2025-01-25 10:18 ` [PATCH v9 4/8] rust: time: Introduce Instant type FUJITA Tomonori
2025-01-27 3:30 ` Gary Guo
2025-01-28 10:30 ` Fiona Behrens
2025-01-25 10:18 ` [PATCH v9 5/8] rust: time: Add wrapper for fsleep() function FUJITA Tomonori
2025-01-27 3:41 ` Gary Guo
2025-01-27 8:55 ` Alice Ryhl
2025-01-28 10:37 ` Fiona Behrens
2025-01-29 5:04 ` FUJITA Tomonori
2025-01-25 10:18 ` [PATCH v9 6/8] MAINTAINERS: rust: Add TIMEKEEPING and TIMER abstractions FUJITA Tomonori
2025-01-25 10:18 ` [PATCH v9 7/8] rust: Add read_poll_timeout functions FUJITA Tomonori
2025-01-27 3:46 ` Gary Guo
2025-01-27 6:31 ` FUJITA Tomonori
2025-01-28 0:49 ` Gary Guo
2025-01-28 6:29 ` FUJITA Tomonori
2025-01-28 10:49 ` Fiona Behrens
2025-01-29 4:53 ` FUJITA Tomonori
2025-01-29 6:31 ` FUJITA Tomonori
2025-01-28 10:52 ` Fiona Behrens
2025-01-29 4:40 ` FUJITA Tomonori
2025-01-25 10:18 ` [PATCH v9 8/8] net: phy: qt2025: Wait until PHY becomes ready FUJITA Tomonori
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=20250201121613.GC8256@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=a.hindborg@samsung.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=andrew@lunn.ch \
--cc=anna-maria@linutronix.de \
--cc=arnd@arndb.de \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=frederic@kernel.org \
--cc=fujita.tomonori@gmail.com \
--cc=gary@garyguo.net \
--cc=hkallweit1@gmail.com \
--cc=jstultz@google.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=rostedt@goodmis.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=sboyd@kernel.org \
--cc=tglx@linutronix.de \
--cc=tgunders@redhat.com \
--cc=tmgross@umich.edu \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.