[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250208.120103.2120997372702679311.fujita.tomonori@gmail.com>
Date: Sat, 08 Feb 2025 12:01:03 +0900 (JST)
From: FUJITA Tomonori <fujita.tomonori@...il.com>
To: david.laight.linux@...il.com, aliceryhl@...gle.com, boqun.feng@...il.com
Cc: fujita.tomonori@...il.com, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org, netdev@...r.kernel.org, andrew@...n.ch,
hkallweit1@...il.com, tmgross@...ch.edu, ojeda@...nel.org,
alex.gaynor@...il.com, gary@...yguo.net, bjorn3_gh@...tonmail.com,
benno.lossin@...ton.me, a.hindborg@...sung.com, anna-maria@...utronix.de,
frederic@...nel.org, tglx@...utronix.de, arnd@...db.de,
jstultz@...gle.com, sboyd@...nel.org, mingo@...hat.com,
peterz@...radead.org, juri.lelli@...hat.com, vincent.guittot@...aro.org,
dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
mgorman@...e.de, vschneid@...hat.com, tgunders@...hat.com, me@...enk.dev
Subject: Re: [PATCH v10 1/8] sched/core: Add __might_sleep_precision()
On Fri, 7 Feb 2025 18:12:58 +0000
David Laight <david.laight.linux@...il.com> wrote:
>> static void print_preempt_disable_ip(int preempt_offset, unsigned long ip)
>> {
>> if (!IS_ENABLED(CONFIG_DEBUG_PREEMPT))
>> @@ -8717,7 +8699,8 @@ static inline bool resched_offsets_ok(unsigned int offsets)
>> return nested == offsets;
>> }
>>
>> -void __might_resched(const char *file, int line, unsigned int offsets)
>> +static void __might_resched_precision(const char *file, int len, int line,
>
> For clarity that ought to be file_len.
Yeah, I'll update.
>> + unsigned int offsets)
>> {
>> /* Ratelimiting timestamp: */
>> static unsigned long prev_jiffy;
>> @@ -8740,8 +8723,10 @@ void __might_resched(const char *file, int line, unsigned int offsets)
>> /* Save this before calling printk(), since that will clobber it: */
>> preempt_disable_ip = get_preempt_disable_ip(current);
>>
>> - pr_err("BUG: sleeping function called from invalid context at %s:%d\n",
>> - file, line);
>> + if (len < 0)
>> + len = strlen(file);
>
> No need for strlen(), just use a big number instead of -1.
> Anything bigger than a sane upper limit on the filename length will do.
Ah, that's right. Just passing the maximum precision (1<<15-1) works.
The precision specifies the maximum length. vsnprintf() always
iterates through a string until it reaches the maximum length or
encounters the null terminator. So strlen() here is useless.
Alice and Boqun, the above change is fine? Can I keep the tags?
Powered by blists - more mailing lists