* [PATCH 0/4] rust: replace WARN_ONCE TODOs with pr_warn_once!
@ 2026-02-26 12:08 Adarsh Das
2026-02-26 12:08 ` [PATCH 1/4] rust: error: use `pr_warn_once!` instead of `pr_warn!` Adarsh Das
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Adarsh Das @ 2026-02-26 12:08 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
rust-for-linux, Adarsh Das
Replace pr_warn and TODO comments for pr_warn_once with the macro call.
Adarsh Das (4):
rust: error: use `pr_warn_once!` instead of `pr_warn!`
rust: module_params: use `pr_warn_once!` instead of `pr_warn!`
rust: mm: add `pr_warn_once!` for invalid range in
`zap_page_range_single`
rust: time: add `pr_warn_once!` for clamped delta in `fsleep`
rust/kernel/error.rs | 3 +--
rust/kernel/mm/virt.rs | 2 +-
rust/kernel/module_param.rs | 3 +--
rust/kernel/time/delay.rs | 2 +-
4 files changed, 4 insertions(+), 6 deletions(-)
--
2.53.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/4] rust: error: use `pr_warn_once!` instead of `pr_warn!`
2026-02-26 12:08 [PATCH 0/4] rust: replace WARN_ONCE TODOs with pr_warn_once! Adarsh Das
@ 2026-02-26 12:08 ` Adarsh Das
2026-02-26 12:08 ` [PATCH 2/4] rust: module_params: " Adarsh Das
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Adarsh Das @ 2026-02-26 12:08 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
rust-for-linux, Adarsh Das
Replace the temporary `pr_warn!` call with `pr_warn_once!` and remove the TODO comment.
Signed-off-by: Adarsh Das <adarshdas950@gmail.com>
---
rust/kernel/error.rs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/rust/kernel/error.rs b/rust/kernel/error.rs
index 258b12afdcba..562e6daa9151 100644
--- a/rust/kernel/error.rs
+++ b/rust/kernel/error.rs
@@ -124,8 +124,7 @@ pub fn from_errno(errno: crate::ffi::c_int) -> Error {
if let Some(error) = Self::try_from_errno(errno) {
error
} else {
- // TODO: Make it a `WARN_ONCE` once available.
- crate::pr_warn!(
+ crate::pr_warn_once!(
"attempted to create `Error` with out of range `errno`: {}\n",
errno
);
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/4] rust: module_params: use `pr_warn_once!` instead of `pr_warn!`
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 ` 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
3 siblings, 0 replies; 8+ messages in thread
From: Adarsh Das @ 2026-02-26 12:08 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
rust-for-linux, Adarsh Das
Replace the temporary `pr_warn!` call with `pr_warn_once!` and remove
the TODO comment.
Signed-off-by: Adarsh Das <adarshdas950@gmail.com>
---
rust/kernel/module_param.rs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/rust/kernel/module_param.rs b/rust/kernel/module_param.rs
index 6a8a7a875643..dd6d663a0a3c 100644
--- a/rust/kernel/module_param.rs
+++ b/rust/kernel/module_param.rs
@@ -62,8 +62,7 @@ pub trait ModuleParam: Sized + Copy {
// NOTE: If we start supporting arguments without values, val _is_ allowed
// to be null here.
if val.is_null() {
- // TODO: Use pr_warn_once available.
- crate::pr_warn!("Null pointer passed to `module_param::set_param`");
+ crate::pr_warn_once!("Null pointer passed to `module_param::set_param`");
return EINVAL.to_errno();
}
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/4] rust: mm: add `pr_warn_once!` for invalid range in `zap_page_range_single`
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 ` Adarsh Das
2026-02-26 12:08 ` [PATCH 4/4] rust: time: add `pr_warn_once!` for clamped delta in `fsleep` Adarsh Das
3 siblings, 0 replies; 8+ messages in thread
From: Adarsh Das @ 2026-02-26 12:08 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
rust-for-linux, Adarsh Das
Add a warning for the invalid range case and remove the TODO comment.
Signed-off-by: Adarsh Das <adarshdas950@gmail.com>
---
rust/kernel/mm/virt.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rust/kernel/mm/virt.rs b/rust/kernel/mm/virt.rs
index da21d65ccd20..f608262a4ff8 100644
--- a/rust/kernel/mm/virt.rs
+++ b/rust/kernel/mm/virt.rs
@@ -116,7 +116,7 @@ pub fn end(&self) -> usize {
pub fn zap_page_range_single(&self, address: usize, size: usize) {
let (end, did_overflow) = address.overflowing_add(size);
if did_overflow || address < self.start() || self.end() < end {
- // TODO: call WARN_ONCE once Rust version of it is added
+ crate::pr_warn_once!("VMA contains invalid range\n");
return;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/4] rust: time: add `pr_warn_once!` for clamped delta in `fsleep`
2026-02-26 12:08 [PATCH 0/4] rust: replace WARN_ONCE TODOs with pr_warn_once! Adarsh Das
` (2 preceding siblings ...)
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 ` Adarsh Das
2026-02-26 12:59 ` FUJITA Tomonori
3 siblings, 1 reply; 8+ messages in thread
From: Adarsh Das @ 2026-02-26 12:08 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
rust-for-linux, Adarsh Das
Add a warning when the delta is clamped to the maximum value and remove the TODO comment.
Signed-off-by: Adarsh Das <adarshdas950@gmail.com>
---
rust/kernel/time/delay.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rust/kernel/time/delay.rs b/rust/kernel/time/delay.rs
index b5b1b42797a0..0965fcb6eb80 100644
--- a/rust/kernel/time/delay.rs
+++ b/rust/kernel/time/delay.rs
@@ -35,7 +35,7 @@ pub fn fsleep(delta: Delta) {
let delta = if (Delta::ZERO..=MAX_DELTA).contains(&delta) {
delta
} else {
- // TODO: Add WARN_ONCE() when it's supported.
+ crate::pr_warn_once!("delta out of range, clamping to maximum\n");
MAX_DELTA
};
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 4/4] rust: time: add `pr_warn_once!` for clamped delta in `fsleep`
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
0 siblings, 2 replies; 8+ messages in thread
From: FUJITA Tomonori @ 2026-02-26 12:59 UTC (permalink / raw)
To: adarshdas950
Cc: ojeda, boqun, gary, bjorn3_gh, lossin, a.hindborg, aliceryhl,
tmgross, dakr, rust-for-linux
On Thu, 26 Feb 2026 17:38:48 +0530
Adarsh Das <adarshdas950@gmail.com> wrote:
> Add a warning when the delta is clamped to the maximum value and remove the TODO comment.
>
> Signed-off-by: Adarsh Das <adarshdas950@gmail.com>
> ---
> rust/kernel/time/delay.rs | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/rust/kernel/time/delay.rs b/rust/kernel/time/delay.rs
> index b5b1b42797a0..0965fcb6eb80 100644
> --- a/rust/kernel/time/delay.rs
> +++ b/rust/kernel/time/delay.rs
> @@ -35,7 +35,7 @@ pub fn fsleep(delta: Delta) {
> let delta = if (Delta::ZERO..=MAX_DELTA).contains(&delta) {
> delta
> } else {
> - // TODO: Add WARN_ONCE() when it's supported.
> + crate::pr_warn_once!("delta out of range, clamping to maximum\n");
> MAX_DELTA
> };
pr_warn_once() and WARN_ONCE() are different; WARN_ONCE() also dumps a
stack trace, which is more appropriate here, I think.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 4/4] rust: time: add `pr_warn_once!` for clamped delta in `fsleep`
2026-02-26 12:59 ` FUJITA Tomonori
@ 2026-02-26 14:18 ` Gary Guo
2026-02-26 14:36 ` Greg KH
1 sibling, 0 replies; 8+ messages in thread
From: Gary Guo @ 2026-02-26 14:18 UTC (permalink / raw)
To: FUJITA Tomonori, adarshdas950
Cc: ojeda, boqun, gary, bjorn3_gh, lossin, a.hindborg, aliceryhl,
tmgross, dakr, rust-for-linux
On Thu Feb 26, 2026 at 12:59 PM GMT, FUJITA Tomonori wrote:
> On Thu, 26 Feb 2026 17:38:48 +0530
> Adarsh Das <adarshdas950@gmail.com> wrote:
>
>> Add a warning when the delta is clamped to the maximum value and remove the TODO comment.
>>
>> Signed-off-by: Adarsh Das <adarshdas950@gmail.com>
>> ---
>> rust/kernel/time/delay.rs | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/rust/kernel/time/delay.rs b/rust/kernel/time/delay.rs
>> index b5b1b42797a0..0965fcb6eb80 100644
>> --- a/rust/kernel/time/delay.rs
>> +++ b/rust/kernel/time/delay.rs
>> @@ -35,7 +35,7 @@ pub fn fsleep(delta: Delta) {
>> let delta = if (Delta::ZERO..=MAX_DELTA).contains(&delta) {
>> delta
>> } else {
>> - // TODO: Add WARN_ONCE() when it's supported.
>> + crate::pr_warn_once!("delta out of range, clamping to maximum\n");
>> MAX_DELTA
>> };
>
> pr_warn_once() and WARN_ONCE() are different; WARN_ONCE() also dumps a
> stack trace, which is more appropriate here, I think.
I think this is also true for patch 1. I think it's fine to add pr_warn_once
before we add `warn_once!()` but the TODO should be kept.
Best,
Gary
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 4/4] rust: time: add `pr_warn_once!` for clamped delta in `fsleep`
2026-02-26 12:59 ` FUJITA Tomonori
2026-02-26 14:18 ` Gary Guo
@ 2026-02-26 14:36 ` Greg KH
1 sibling, 0 replies; 8+ messages in thread
From: Greg KH @ 2026-02-26 14:36 UTC (permalink / raw)
To: FUJITA Tomonori
Cc: adarshdas950, ojeda, boqun, gary, bjorn3_gh, lossin, a.hindborg,
aliceryhl, tmgross, dakr, rust-for-linux
On Thu, Feb 26, 2026 at 09:59:23PM +0900, FUJITA Tomonori wrote:
> On Thu, 26 Feb 2026 17:38:48 +0530
> Adarsh Das <adarshdas950@gmail.com> wrote:
>
> > Add a warning when the delta is clamped to the maximum value and remove the TODO comment.
> >
> > Signed-off-by: Adarsh Das <adarshdas950@gmail.com>
> > ---
> > rust/kernel/time/delay.rs | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/rust/kernel/time/delay.rs b/rust/kernel/time/delay.rs
> > index b5b1b42797a0..0965fcb6eb80 100644
> > --- a/rust/kernel/time/delay.rs
> > +++ b/rust/kernel/time/delay.rs
> > @@ -35,7 +35,7 @@ pub fn fsleep(delta: Delta) {
> > let delta = if (Delta::ZERO..=MAX_DELTA).contains(&delta) {
> > delta
> > } else {
> > - // TODO: Add WARN_ONCE() when it's supported.
> > + crate::pr_warn_once!("delta out of range, clamping to maximum\n");
> > MAX_DELTA
> > };
>
> pr_warn_once() and WARN_ONCE() are different; WARN_ONCE() also dumps a
> stack trace, which is more appropriate here, I think.
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.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-02-26 14:36 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox