Skip to contentSkip to conversation

sched_ext: fix fmt__str variables in kfuncs

PATCH Applied Andrea Righi 4 participants 5 messages Oct 22, 2024 – Oct 23, 2024 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched_ext: fix fmt__str variables in kfuncs

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")
---
 kernel/sched/ext.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/sched/ext.c +4 -4
index ff24d652c386..280beea63fa9 100644
@@ -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;
 	}
 
Signature · 1 line
2.47.0
Tested-by on v1 1/1
#1 lore raw
Quoted 11 lines · Andrea Righi

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).

Ciao, Thorsten

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

Acked-by on v1 1/1
#2 lore raw
In reply to Andrea Righi
Quoted 9 lines · Andrea Righi

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)
| ^~~

Quoted 5 lines

Fix by renaming also the varibles in the affected kfuncs.

Fixes 3e99aee7ce48 ("sched-ext: Use correct annotation for strings in kfuncs")

---

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.

Applied
#3 lore raw
In reply to Andrea Righi
Quoted 4 lines · Andrea Righi

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:

Quoted 8 lines

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")

Applied to sched_ext/for-6.12-fixes.

Thanks.

Signature · 1 line
tejun
#4 lore raw
In reply to Andrea Righi
Quoted 4 lines · Andrea Righi

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:

Quoted 8 lines

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")

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.

Signature · 1 line
tejun