public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-6.12-fixes] sched_ext: fix fmt__str variables in kfuncs
@ 2024-10-22  7:40 Andrea Righi
  2024-10-22  9:58 ` Thorsten Leemhuis
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Andrea Righi @ 2024-10-22  7:40 UTC (permalink / raw)
  To: Tejun Heo, David Vernet; +Cc: Kumar Kartikeya Dwivedi, linux-kernel

Commit 3e99aee7ce48 ("sched-ext: Use correct annotation for strings in
kfuncs") renamed some parameters without updating the body of the
functions, triggering build errors like this:

kernel/sched/ext.c:6881:45: error: ‘fmt’ undeclared (first use in this function)
6881 |       if (bstr_format(&scx_exit_bstr_buf, fmt, data, data__sz) >= 0)
     |                                             ^~~

Fix by renaming also the varibles in the affected kfuncs.

Fixes: 3e99aee7ce48 ("sched-ext: Use correct annotation for strings in kfuncs")
Signed-off-by: Andrea Righi <andrea.righi@linux.dev>
---
 kernel/sched/ext.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index ff24d652c386..280beea63fa9 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -6738,7 +6738,7 @@ __bpf_kfunc void scx_bpf_exit_bstr(s64 exit_code, char *fmt__str,
 	unsigned long flags;
 
 	raw_spin_lock_irqsave(&scx_exit_bstr_buf_lock, flags);
-	if (bstr_format(&scx_exit_bstr_buf, fmt, data, data__sz) >= 0)
+	if (bstr_format(&scx_exit_bstr_buf, fmt__str, data, data__sz) >= 0)
 		scx_ops_exit_kind(SCX_EXIT_UNREG_BPF, exit_code, "%s",
 				  scx_exit_bstr_buf.line);
 	raw_spin_unlock_irqrestore(&scx_exit_bstr_buf_lock, flags);
@@ -6759,7 +6759,7 @@ __bpf_kfunc void scx_bpf_error_bstr(char *fmt__str, unsigned long long *data,
 	unsigned long flags;
 
 	raw_spin_lock_irqsave(&scx_exit_bstr_buf_lock, flags);
-	if (bstr_format(&scx_exit_bstr_buf, fmt, data, data__sz) >= 0)
+	if (bstr_format(&scx_exit_bstr_buf, fmt__str, data, data__sz) >= 0)
 		scx_ops_exit_kind(SCX_EXIT_ERROR_BPF, 0, "%s",
 				  scx_exit_bstr_buf.line);
 	raw_spin_unlock_irqrestore(&scx_exit_bstr_buf_lock, flags);
@@ -6791,10 +6791,10 @@ __bpf_kfunc void scx_bpf_dump_bstr(char *fmt__str, unsigned long long *data,
 
 	/* append the formatted string to the line buf */
 	ret = __bstr_format(buf->data, buf->line + dd->cursor,
-			    sizeof(buf->line) - dd->cursor, fmt, data, data__sz);
+			    sizeof(buf->line) - dd->cursor, fmt__str, data, data__sz);
 	if (ret < 0) {
 		dump_line(dd->s, "%s[!] (\"%s\", %p, %u) failed to format (%d)",
-			  dd->prefix, fmt, data, data__sz, ret);
+			  dd->prefix, fmt__str, data, data__sz, ret);
 		return;
 	}
 
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH for-6.12-fixes] sched_ext: fix fmt__str variables in kfuncs
  2024-10-22  7:40 [PATCH for-6.12-fixes] sched_ext: fix fmt__str variables in kfuncs Andrea Righi
@ 2024-10-22  9:58 ` Thorsten Leemhuis
  2024-10-22 10:10 ` Kumar Kartikeya Dwivedi
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Thorsten Leemhuis @ 2024-10-22  9:58 UTC (permalink / raw)
  To: Andrea Righi, Tejun Heo, David Vernet
  Cc: Kumar Kartikeya Dwivedi, linux-kernel

On 22.10.24 09:40, Andrea Righi wrote:
> Commit 3e99aee7ce48 ("sched-ext: Use correct annotation for strings in
> kfuncs") renamed some parameters without updating the body of the
> functions, triggering build errors like this:
> 
> kernel/sched/ext.c:6881:45: error: ‘fmt’ undeclared (first use in this function)
> 6881 |       if (bstr_format(&scx_exit_bstr_buf, fmt, data, data__sz) >= 0)
>      |                                             ^~~
> 
> Fix by renaming also the varibles in the affected kfuncs.
> 
> Fixes: 3e99aee7ce48 ("sched-ext: Use correct annotation for strings in kfuncs")

Thx for this: ran into a build error with my daily -next builds earlier
today[1] and this fixes things (it's still compiling, but I'm past the
point where this happened afaics).

Tested-by: Thorsten Leemhuis <linux@leemhuis.info>

Ciao, Thorsten

[1]
https://download.copr.fedorainfracloud.org/results/@kernel-vanilla/next/fedora-41-x86_64/08165136-next-next-all/builder-live.log.gz

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH for-6.12-fixes] sched_ext: fix fmt__str variables in kfuncs
  2024-10-22  7:40 [PATCH for-6.12-fixes] sched_ext: fix fmt__str variables in kfuncs Andrea Righi
  2024-10-22  9:58 ` Thorsten Leemhuis
@ 2024-10-22 10:10 ` Kumar Kartikeya Dwivedi
  2024-10-22 15:42 ` Tejun Heo
  2024-10-23 19:03 ` Tejun Heo
  3 siblings, 0 replies; 5+ messages in thread
From: Kumar Kartikeya Dwivedi @ 2024-10-22 10:10 UTC (permalink / raw)
  To: Andrea Righi; +Cc: Tejun Heo, David Vernet, linux-kernel

On Tue, 22 Oct 2024 at 09:40, Andrea Righi <andrea.righi@linux.dev> wrote:
>
> Commit 3e99aee7ce48 ("sched-ext: Use correct annotation for strings in
> kfuncs") renamed some parameters without updating the body of the
> functions, triggering build errors like this:
>
> kernel/sched/ext.c:6881:45: error: ‘fmt’ undeclared (first use in this function)
> 6881 |       if (bstr_format(&scx_exit_bstr_buf, fmt, data, data__sz) >= 0)
>      |                                             ^~~
>
> Fix by renaming also the varibles in the affected kfuncs.
>
> Fixes: 3e99aee7ce48 ("sched-ext: Use correct annotation for strings in kfuncs")
> Signed-off-by: Andrea Righi <andrea.righi@linux.dev>
> ---

Ah, thanks, this is embarrassing.
I didn't realize sched-ext was disabled in the .config when testing
this with other patches in the queue.
Sorry about that.

Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH for-6.12-fixes] sched_ext: fix fmt__str variables in kfuncs
  2024-10-22  7:40 [PATCH for-6.12-fixes] sched_ext: fix fmt__str variables in kfuncs Andrea Righi
  2024-10-22  9:58 ` Thorsten Leemhuis
  2024-10-22 10:10 ` Kumar Kartikeya Dwivedi
@ 2024-10-22 15:42 ` Tejun Heo
  2024-10-23 19:03 ` Tejun Heo
  3 siblings, 0 replies; 5+ messages in thread
From: Tejun Heo @ 2024-10-22 15:42 UTC (permalink / raw)
  To: Andrea Righi; +Cc: David Vernet, Kumar Kartikeya Dwivedi, linux-kernel

On Tue, Oct 22, 2024 at 09:40:35AM +0200, Andrea Righi wrote:
> Commit 3e99aee7ce48 ("sched-ext: Use correct annotation for strings in
> kfuncs") renamed some parameters without updating the body of the
> functions, triggering build errors like this:
> 
> kernel/sched/ext.c:6881:45: error: ‘fmt’ undeclared (first use in this function)
> 6881 |       if (bstr_format(&scx_exit_bstr_buf, fmt, data, data__sz) >= 0)
>      |                                             ^~~
> 
> Fix by renaming also the varibles in the affected kfuncs.
> 
> Fixes: 3e99aee7ce48 ("sched-ext: Use correct annotation for strings in kfuncs")
> Signed-off-by: Andrea Righi <andrea.righi@linux.dev>

Applied to sched_ext/for-6.12-fixes.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH for-6.12-fixes] sched_ext: fix fmt__str variables in kfuncs
  2024-10-22  7:40 [PATCH for-6.12-fixes] sched_ext: fix fmt__str variables in kfuncs Andrea Righi
                   ` (2 preceding siblings ...)
  2024-10-22 15:42 ` Tejun Heo
@ 2024-10-23 19:03 ` Tejun Heo
  3 siblings, 0 replies; 5+ messages in thread
From: Tejun Heo @ 2024-10-23 19:03 UTC (permalink / raw)
  To: Andrea Righi; +Cc: David Vernet, Kumar Kartikeya Dwivedi, linux-kernel

On Tue, Oct 22, 2024 at 09:40:35AM +0200, Andrea Righi wrote:
> Commit 3e99aee7ce48 ("sched-ext: Use correct annotation for strings in
> kfuncs") renamed some parameters without updating the body of the
> functions, triggering build errors like this:
> 
> kernel/sched/ext.c:6881:45: error: ‘fmt’ undeclared (first use in this function)
> 6881 |       if (bstr_format(&scx_exit_bstr_buf, fmt, data, data__sz) >= 0)
>      |                                             ^~~
> 
> Fix by renaming also the varibles in the affected kfuncs.
> 
> Fixes: 3e99aee7ce48 ("sched-ext: Use correct annotation for strings in kfuncs")
> Signed-off-by: Andrea Righi <andrea.righi@linux.dev>

I removed this patch along with 3e99aee7ce48 ("sched-ext: Use correct
annotation for strings in kfuncs"). This breaks compatibility in a way which
is difficult to work around. If we want to do this, I think we should do it
by introducing new set of kfuncs and than phasing out the old ones. Also,
it's unclear what the practical benefits of the change are anyway.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-23 19:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-22  7:40 [PATCH for-6.12-fixes] sched_ext: fix fmt__str variables in kfuncs Andrea Righi
2024-10-22  9:58 ` Thorsten Leemhuis
2024-10-22 10:10 ` Kumar Kartikeya Dwivedi
2024-10-22 15:42 ` Tejun Heo
2024-10-23 19:03 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox