Rust for Linux List
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: FUJITA Tomonori <tomo@aliasing.net>,
	adarshdas950@gmail.com, ojeda@kernel.org, boqun@kernel.org,
	gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org,
	a.hindborg@kernel.org, aliceryhl@google.com, tmgross@umich.edu,
	dakr@kernel.org, rust-for-linux@vger.kernel.org
Subject: Re: [PATCH 4/4] rust: time: add `pr_warn_once!` for clamped delta in `fsleep`
Date: Mon, 6 Apr 2026 13:19:57 +0200	[thread overview]
Message-ID: <2026040601-unmasked-tattling-67a2@gregkh> (raw)
In-Reply-To: <CANiq72=tKVD13GD2Bzmt_LnC4SiOX1nkHQPcz2BS=P=b23e0Yw@mail.gmail.com>

On Mon, Apr 06, 2026 at 12:39:12PM +0200, Miguel Ojeda wrote:
> On Thu, Feb 26, 2026 at 3:36 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > WARN_ONCE() also will panic the machine if panic_on_warn is enabled.  As
> > it is done in a few billion Linux systems right now :(
> >
> > So be very careful about that.
> 
> Coming back to this...
> 
> I think we should settle for cases like this (i.e. "Erroneous
> Behavior") to use `debug_assert!` plus `pr_warn_once!`.
> 
> That way in normal builds, we just print a warning once, no risk of
> `WARN_ONCE()`. And in truly debug builds, we assert.

Who would ever build a "truly debug build"?  That's the overall problem
we have tried to fix up, no user will do a new build for things, so we
have dynamic debugging now.  I think only the mm core still has an
overly-strict debug mode that only the mm developers run, and even then,
there have been arguments it should be removed.

> This should make it easier to add such EB in most cases where needed,
> and if someone really wants `WARN_ONCE()` or similar, then they can do
> it explicitly.

Sure, that's fine, but note that this will crash and should NEVER happen
if it can be user triggered.  And if you are warning, well, why not just
handle the issue, print out a message, and continue on?  Why reboot
anything?

thanks,

greg k-h

  reply	other threads:[~2026-04-06 11:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-26 12:08 [PATCH 0/4] rust: replace WARN_ONCE TODOs with pr_warn_once! Adarsh Das
2026-02-26 12:08 ` [PATCH 1/4] rust: error: use `pr_warn_once!` instead of `pr_warn!` Adarsh Das
2026-02-26 12:08 ` [PATCH 2/4] rust: module_params: " Adarsh Das
2026-02-26 12:08 ` [PATCH 3/4] rust: mm: add `pr_warn_once!` for invalid range in `zap_page_range_single` Adarsh Das
2026-02-26 12:08 ` [PATCH 4/4] rust: time: add `pr_warn_once!` for clamped delta in `fsleep` Adarsh Das
2026-02-26 12:59   ` FUJITA Tomonori
2026-02-26 14:18     ` Gary Guo
2026-02-26 14:36     ` Greg KH
2026-04-06 10:39       ` Miguel Ojeda
2026-04-06 11:19         ` Greg KH [this message]
2026-04-06 12:14           ` Miguel Ojeda
2026-04-06 12:31             ` Miguel Ojeda

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=2026040601-unmasked-tattling-67a2@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=a.hindborg@kernel.org \
    --cc=adarshdas950@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=lossin@kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    --cc=tomo@aliasing.net \
    /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