public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vishal Chourasia <vishalc@linux.ibm.com>
To: Tejun Heo <tj@kernel.org>
Cc: David Vernet <void@manifault.com>, Josh Don <joshdon@google.com>,
	Hao Luo <haoluo@google.com>, Barret Rhoden <brho@google.com>,
	linux-kernel@vger.kernel.org
Subject: sched_ext: build errors when building flatcg and qmap schedulers
Date: Tue, 1 Oct 2024 17:08:58 +0530	[thread overview]
Message-ID: <ZvvfUqRNM4-jYQzH@linux.ibm.com> (raw)

Hi, 

Getting build error when trying to compile example schedulers in
tools/sched_ext/* (logs shared in the end)


tools/sched_ext # make -s -k


git repo state
$ git log --oneline
e32cde8d2bd7d (HEAD -> master, origin/master, origin/HEAD) Merge tag 'sched_ext-for-6.12-rc1-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext
190ecde722dd0 Merge tag 'probes-fixes-v6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
a5f24c795513f Merge tag 'vfs-6.12-rc2.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
f801850bc263d netfs: Fix the netfs_folio tracepoint to handle NULL mapping
28e8c5c095ec2 netfs: Add folio_queue API documentation
2007d28ec0095 bcachefs: rename version -> bversion for big endian builds
34820304cc2cd uprobes: fix kernel info leak via "[uprobes]" vma
9852d85ec9d49 (tag: v6.12-rc1) Linux 6.12-rc1


Adding __weak attribute seems to have fixed it and compilation completed
with no errors.

diff --git a/tools/sched_ext/include/scx/common.bpf.h b/tools/sched_ext/include/scx/common.bpf.h
index 225f61f9bfca..27749c51c3ec 100644
--- a/tools/sched_ext/include/scx/common.bpf.h
+++ b/tools/sched_ext/include/scx/common.bpf.h
@@ -41,8 +41,8 @@ void scx_bpf_dispatch_vtime(struct task_struct *p, u64 dsq_id, u64 slice, u64 vt
 u32 scx_bpf_dispatch_nr_slots(void) __ksym;
 void scx_bpf_dispatch_cancel(void) __ksym;
 bool scx_bpf_consume(u64 dsq_id) __ksym;
-void scx_bpf_dispatch_from_dsq_set_slice(struct bpf_iter_scx_dsq *it__iter, u64 slice) __ksym;
-void scx_bpf_dispatch_from_dsq_set_vtime(struct bpf_iter_scx_dsq *it__iter, u64 vtime) __ksym;
+void scx_bpf_dispatch_from_dsq_set_slice(struct bpf_iter_scx_dsq *it__iter, u64 slice) __ksym __weak;
+void scx_bpf_dispatch_from_dsq_set_vtime(struct bpf_iter_scx_dsq *it__iter, u64 vtime) __ksym __weak;
 bool scx_bpf_dispatch_from_dsq(struct bpf_iter_scx_dsq *it__iter, struct task_struct *p, u64 dsq_id, u64 enq_flags) __ksym __weak;
 bool scx_bpf_dispatch_vtime_from_dsq(struct bpf_iter_scx_dsq *it__iter, struct task_struct *p, u64 dsq_id, u64 enq_flags) __ksym __weak;
 u32 scx_bpf_reenqueue_local(void) __ksym;
@@ -71,7 +71,7 @@ s32 scx_bpf_pick_any_cpu(const cpumask_t *cpus_allowed, u64 flags) __ksym;
 bool scx_bpf_task_running(const struct task_struct *p) __ksym;
 s32 scx_bpf_task_cpu(const struct task_struct *p) __ksym;
 struct rq *scx_bpf_cpu_rq(s32 cpu) __ksym;
-struct cgroup *scx_bpf_task_cgroup(struct task_struct *p) __ksym;
+struct cgroup *scx_bpf_task_cgroup(struct task_struct *p) __ksym __weak;

 /*
  * Use the following as @it__iter when calling



---- Start of error log 

$ make -s -k
Warning: Kernel ABI header at 'tools/include/uapi/linux/bpf.h' differs from latest version at 'include/uapi/linux/bpf.h'
Warning: Kernel ABI header at 'tools/include/uapi/linux/if_xdp.h' differs from latest version at 'include/uapi/linux/if_xdp.h'

Auto-detecting system features:
...                         clang-bpf-co-re: [ on  ]
...                                    llvm: [ on  ]
...                                  libcap: [ OFF ]
...                                  libbfd: [ OFF ]

scx_qmap.bpf.c:321:4: error: static assertion failed due to requirement '!__builtin_constant_p(!!scx_bpf_dispatch_from_dsq_set_slice)': scx_bpf_dispatch_from_dsq_set_slice should be marked as __weak
  321 |                         __COMPAT_scx_bpf_dispatch_from_dsq_set_slice(
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  322 |                                 BPF_FOR_EACH_ITER, slice_ns * 2);
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$HOME/linux-x86/tools/sched_ext/include/scx/compat.bpf.h:25:3: note: expanded from macro '__COMPAT_scx_bpf_dispatch_from_dsq_set_slice'
   25 |         (bpf_ksym_exists(scx_bpf_dispatch_from_dsq_set_slice) ?                 \
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$HOME/linux-x86/tools/sched_ext/build/include/bpf/bpf_helpers.h:191:17: note: expanded from macro 'bpf_ksym_exists'
  191 |         _Static_assert(!__builtin_constant_p(!!sym),                    \
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
scx_qmap.bpf.c:323:4: error: static assertion failed due to requirement '!__builtin_constant_p(!!scx_bpf_dispatch_from_dsq_set_vtime)': scx_bpf_dispatch_from_dsq_set_vtime should be marked as __weak
  323 |                         __COMPAT_scx_bpf_dispatch_from_dsq_set_vtime(
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  324 |                                 BPF_FOR_EACH_ITER, highpri_seq++);
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$HOME/linux-x86/tools/sched_ext/include/scx/compat.bpf.h:28:3: note: expanded from macro '__COMPAT_scx_bpf_dispatch_from_dsq_set_vtime'
   28 |         (bpf_ksym_exists(scx_bpf_dispatch_from_dsq_set_vtime) ?                 \
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$HOME/linux-x86/tools/sched_ext/build/include/bpf/bpf_helpers.h:191:17: note: expanded from macro 'bpf_ksym_exists'
  191 |         _Static_assert(!__builtin_constant_p(!!sym),                    \
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
make: *** [Makefile:165: $HOME/linux-x86/tools/sched_ext/build/obj/sched_ext/scx_qmap.bpf.o] Error 1
scx_flatcg.bpf.c:388:9: error: static assertion failed due to requirement '!__builtin_constant_p(!!scx_bpf_task_cgroup)': scx_bpf_task_cgroup should be marked as __weak
  388 |         cgrp = __COMPAT_scx_bpf_task_cgroup(p);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$HOME/linux-x86/tools/sched_ext/include/scx/compat.bpf.h:20:3: note: expanded from macro '__COMPAT_scx_bpf_task_cgroup'
   20 |         (bpf_ksym_exists(scx_bpf_task_cgroup) ?                                 \
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$HOME/linux-x86/tools/sched_ext/build/include/bpf/bpf_helpers.h:191:17: note: expanded from macro 'bpf_ksym_exists'
  191 |         _Static_assert(!__builtin_constant_p(!!sym),                    \
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
scx_flatcg.bpf.c:514:9: error: static assertion failed due to requirement '!__builtin_constant_p(!!scx_bpf_task_cgroup)': scx_bpf_task_cgroup should be marked as __weak
  514 |         cgrp = __COMPAT_scx_bpf_task_cgroup(p);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$HOME/linux-x86/tools/sched_ext/include/scx/compat.bpf.h:20:3: note: expanded from macro '__COMPAT_scx_bpf_task_cgroup'
   20 |         (bpf_ksym_exists(scx_bpf_task_cgroup) ?                                 \
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$HOME/linux-x86/tools/sched_ext/build/include/bpf/bpf_helpers.h:191:17: note: expanded from macro 'bpf_ksym_exists'
  191 |         _Static_assert(!__builtin_constant_p(!!sym),                    \
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
scx_flatcg.bpf.c:527:9: error: static assertion failed due to requirement '!__builtin_constant_p(!!scx_bpf_task_cgroup)': scx_bpf_task_cgroup should be marked as __weak
  527 |         cgrp = __COMPAT_scx_bpf_task_cgroup(p);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$HOME/linux-x86/tools/sched_ext/include/scx/compat.bpf.h:20:3: note: expanded from macro '__COMPAT_scx_bpf_task_cgroup'
   20 |         (bpf_ksym_exists(scx_bpf_task_cgroup) ?                                 \
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$HOME/linux-x86/tools/sched_ext/build/include/bpf/bpf_helpers.h:191:17: note: expanded from macro 'bpf_ksym_exists'
  191 |         _Static_assert(!__builtin_constant_p(!!sym),                    \
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
scx_flatcg.bpf.c:570:9: error: static assertion failed due to requirement '!__builtin_constant_p(!!scx_bpf_task_cgroup)': scx_bpf_task_cgroup should be marked as __weak
  570 |         cgrp = __COMPAT_scx_bpf_task_cgroup(p);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$HOME/linux-x86/tools/sched_ext/include/scx/compat.bpf.h:20:3: note: expanded from macro '__COMPAT_scx_bpf_task_cgroup'
   20 |         (bpf_ksym_exists(scx_bpf_task_cgroup) ?                                 \
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$HOME/linux-x86/tools/sched_ext/build/include/bpf/bpf_helpers.h:191:17: note: expanded from macro 'bpf_ksym_exists'
  191 |         _Static_assert(!__builtin_constant_p(!!sym),                    \
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
scx_flatcg.bpf.c:584:9: error: static assertion failed due to requirement '!__builtin_constant_p(!!scx_bpf_task_cgroup)': scx_bpf_task_cgroup should be marked as __weak
  584 |         cgrp = __COMPAT_scx_bpf_task_cgroup(p);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$HOME/linux-x86/tools/sched_ext/include/scx/compat.bpf.h:20:3: note: expanded from macro '__COMPAT_scx_bpf_task_cgroup'
   20 |         (bpf_ksym_exists(scx_bpf_task_cgroup) ?                                 \
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$HOME/linux-x86/tools/sched_ext/build/include/bpf/bpf_helpers.h:191:17: note: expanded from macro 'bpf_ksym_exists'
  191 |         _Static_assert(!__builtin_constant_p(!!sym),                    \
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 errors generated.
make: *** [Makefile:165: $HOME/linux-x86/tools/sched_ext/build/obj/sched_ext/scx_flatcg.bpf.o] Error 1
make: Target 'all' not remade because of errors.

---- End of error log 



             reply	other threads:[~2024-10-01 11:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-01 11:38 Vishal Chourasia [this message]
2024-10-01 20:45 ` sched_ext: build errors when building flatcg and qmap schedulers Tejun Heo
2024-10-02  5:17   ` Vishal Chourasia

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=ZvvfUqRNM4-jYQzH@linux.ibm.com \
    --to=vishalc@linux.ibm.com \
    --cc=brho@google.com \
    --cc=haoluo@google.com \
    --cc=joshdon@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=void@manifault.com \
    /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