rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gary Guo <gary@garyguo.net>
To: FUJITA Tomonori <fujita.tomonori@gmail.com>
Cc: 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,
	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, peterz@infradead.org,
	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, me@kloenk.dev
Subject: Re: [PATCH v10 7/8] rust: Add read_poll_timeout functions
Date: Fri, 14 Feb 2025 11:37:40 +0000	[thread overview]
Message-ID: <20250214113740.156faaf4@eugeo> (raw)
In-Reply-To: <20250214.130530.335441284525755047.fujita.tomonori@gmail.com>

On Fri, 14 Feb 2025 13:05:30 +0900 (JST)
FUJITA Tomonori <fujita.tomonori@gmail.com> wrote:

> On Sun, 9 Feb 2025 16:20:48 +0000
> Gary Guo <gary@garyguo.net> wrote:
> 
> >> +fn might_sleep(loc: &Location<'_>) {
> >> +    // SAFETY: FFI call.
> >> +    unsafe {
> >> +        crate::bindings::__might_sleep_precision(
> >> +            loc.file().as_ptr().cast(),
> >> +            loc.file().len() as i32,
> >> +            loc.line() as i32,
> >> +        )
> >> +    }
> >> +}  
> > 
> > One last Q: why isn't `might_sleep` marked as `track_caller` and then
> > have `Location::caller` be called internally?
> >
> > It would make the API same as the C macro.  
> 
> Equivalent to the C side __might_sleep(), not might_sleep(). To avoid
> confusion, it might be better to change the name of this function.
> 
> The reason why __might_sleep() is used instead of might_sleep() is
> might_sleep() can't always be called. It was discussed in v2:
> 
> https://lore.kernel.org/all/ZwPT7HZvG1aYONkQ@boqun-archlinux/

I don't follow. `__might_sleep` or `might_sleep` wouldn't make a
difference here, given that this function may actually sleep.

- Gary

> 
> > Also -- perhaps this function can be public (though I guess you'd need
> > to put it in a new module).  

> 
> Wouldn't it be better to keep it private until actual users appear?


  reply	other threads:[~2025-02-14 11:37 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-07 13:26 [PATCH v10 0/8] rust: Add IO polling FUJITA Tomonori
2025-02-07 13:26 ` [PATCH v10 1/8] sched/core: Add __might_sleep_precision() FUJITA Tomonori
2025-02-07 18:12   ` David Laight
2025-02-08  3:01     ` FUJITA Tomonori
2025-02-10  9:41       ` Alice Ryhl
2025-02-17  1:51         ` Boqun Feng
2025-02-17  6:44           ` FUJITA Tomonori
2025-02-07 13:26 ` [PATCH v10 2/8] rust: time: Add PartialEq/Eq/PartialOrd/Ord trait to Ktime FUJITA Tomonori
2025-02-07 13:26 ` [PATCH v10 3/8] rust: time: Introduce Delta type FUJITA Tomonori
2025-02-07 13:26 ` [PATCH v10 4/8] rust: time: Introduce Instant type FUJITA Tomonori
2025-02-07 13:26 ` [PATCH v10 5/8] rust: time: Add wrapper for fsleep() function FUJITA Tomonori
2025-02-07 13:26 ` [PATCH v10 6/8] MAINTAINERS: rust: Add TIMEKEEPING and TIMER abstractions FUJITA Tomonori
2025-02-17  0:10   ` FUJITA Tomonori
2025-02-17 13:39     ` Frederic Weisbecker
2025-02-19  6:26       ` FUJITA Tomonori
2025-02-07 13:26 ` [PATCH v10 7/8] rust: Add read_poll_timeout functions FUJITA Tomonori
2025-02-08  1:50   ` Daniel Almeida
2025-02-14  4:13     ` FUJITA Tomonori
2025-02-16 12:19       ` Daniel Almeida
2025-02-16 22:50         ` FUJITA Tomonori
2025-02-09 16:20   ` Gary Guo
2025-02-14  4:05     ` FUJITA Tomonori
2025-02-14 11:37       ` Gary Guo [this message]
2025-02-15  9:48         ` FUJITA Tomonori
2025-02-07 13:26 ` [PATCH v10 8/8] net: phy: qt2025: Wait until PHY becomes ready FUJITA Tomonori
2025-02-15 21:28 ` [PATCH v10 0/8] rust: Add IO polling Daniel Almeida
2025-02-16  6:35   ` 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=20250214113740.156faaf4@eugeo \
    --to=gary@garyguo.net \
    --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=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=frederic@kernel.org \
    --cc=fujita.tomonori@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=jstultz@google.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=me@kloenk.dev \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=peterz@infradead.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 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).