Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The stack allocator introduced in #948 fails to build #1051

Closed
anh0516 opened this issue Dec 6, 2024 · 4 comments
Closed

The stack allocator introduced in #948 fails to build #1051

anh0516 opened this issue Dec 6, 2024 · 4 comments
Assignees

Comments

@anh0516
Copy link
Contributor

anh0516 commented Dec 6, 2024

INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /usr/bin/ninja -C /home/avraham/Documents/scx/build
ninja: Entering directory `/home/avraham/Documents/scx/build'
[1/40] Generating libbpf with a custom command

[5/40] Generating bpftool_target with a custom command

[16/40] Generating 'scheds/c/scx_sdt.p/scx_sdt.bpf.o'
FAILED: scheds/c/scx_sdt.p/scx_sdt.bpf.o 
/usr/lib/llvm/19/bin/clang -g -O2 -Wall -Wno-compare-distinct-pointer-types -D__TARGET_ARCH_x86 -mcpu=v3 -mlittle-endian '-idirafter /usr/lib/llvm/19/bin/../../../../lib/clang/19/include' '-idirafter /usr/include' -target bpf -I /home/avraham/Documents/scx/scheds/include -I /home/avraham/Documents/scx/scheds/include/arch/x86 -I /home/avraham/Documents/scx/scheds/include/bpf-compat -c ../scheds/c/scx_sdt.bpf.c -o scheds/c/scx_sdt.p/scx_sdt.bpf.o
In file included from ../scheds/c/scx_sdt.bpf.c:3:
In file included from /home/avraham/Documents/scx/scheds/include/scx/sdt_task_impl.bpf.h:9:
/home/avraham/Documents/scx/scheds/include/scx/sdt_task.h:51:19: error: field may not be qualified with an address space
   51 |         __u64                           __arena payload[];
      |                                                 ^
In file included from ../scheds/c/scx_sdt.bpf.c:3:
/home/avraham/Documents/scx/scheds/include/scx/sdt_task_impl.bpf.h:236:35: error: passing 'struct sdt_task_pool *' to parameter of type '__arena struct sdt_task_pool *' changes address space of pointer
  236 |         chunk = sdt_task_alloc_from_pool(&sdt_task_chunk_pool, stack);
      |                                          ^~~~~~~~~~~~~~~~~~~~
/home/avraham/Documents/scx/scheds/include/scx/sdt_task_impl.bpf.h:204:70: note: passing argument to parameter 'pool' here
  204 | void __arena *sdt_task_alloc_from_pool(struct sdt_task_pool __arena *pool,
      |                                                                      ^
/home/avraham/Documents/scx/scheds/include/scx/sdt_task_impl.bpf.h:237:34: error: passing 'struct sdt_task_pool *' to parameter of type '__arena struct sdt_task_pool *' changes address space of pointer
  237 |         desc = sdt_task_alloc_from_pool(&sdt_task_desc_pool, stack);
      |                                         ^~~~~~~~~~~~~~~~~~~
/home/avraham/Documents/scx/scheds/include/scx/sdt_task_impl.bpf.h:204:70: note: passing argument to parameter 'pool' here
  204 | void __arena *sdt_task_alloc_from_pool(struct sdt_task_pool __arena *pool,
      |                                                                      ^
/home/avraham/Documents/scx/scheds/include/scx/sdt_task_impl.bpf.h:279:26: error: passing 'struct sdt_task_pool *' to parameter of type '__arena struct sdt_task_pool *' changes address space of pointer
  279 |         ret = sdt_pool_set_size(&sdt_task_chunk_pool, sizeof(struct sdt_task_chunk));
      |                                 ^~~~~~~~~~~~~~~~~~~~
/home/avraham/Documents/scx/scheds/include/scx/sdt_task_impl.bpf.h:251:78: note: passing argument to parameter 'pool' here
  251 | static SDT_TASK_FN_ATTRS int sdt_pool_set_size(struct sdt_task_pool __arena *pool, __u64 data_size)
      |                                                                              ^
/home/avraham/Documents/scx/scheds/include/scx/sdt_task_impl.bpf.h:283:26: error: passing 'struct sdt_task_pool *' to parameter of type '__arena struct sdt_task_pool *' changes address space of pointer
  283 |         ret = sdt_pool_set_size(&sdt_task_desc_pool, sizeof(struct sdt_task_desc));
      |                                 ^~~~~~~~~~~~~~~~~~~
/home/avraham/Documents/scx/scheds/include/scx/sdt_task_impl.bpf.h:251:78: note: passing argument to parameter 'pool' here
  251 | static SDT_TASK_FN_ATTRS int sdt_pool_set_size(struct sdt_task_pool __arena *pool, __u64 data_size)
      |                                                                              ^
/home/avraham/Documents/scx/scheds/include/scx/sdt_task_impl.bpf.h:291:26: error: passing 'struct sdt_task_pool *' to parameter of type '__arena struct sdt_task_pool *' changes address space of pointer
  291 |         ret = sdt_pool_set_size(&sdt_task_data_pool, data_size);
      |                                 ^~~~~~~~~~~~~~~~~~~
/home/avraham/Documents/scx/scheds/include/scx/sdt_task_impl.bpf.h:251:78: note: passing argument to parameter 'pool' here
  251 | static SDT_TASK_FN_ATTRS int sdt_pool_set_size(struct sdt_task_pool __arena *pool, __u64 data_size)
      |                                                                              ^
/home/avraham/Documents/scx/scheds/include/scx/sdt_task_impl.bpf.h:375:8: error: assigning '__arena struct sdt_task_desc *' (aka 'struct sdt_task_desc *__attribute__((address_space(1)))') to '__arena struct sdt_task_desc *' (aka '__attribute__((address_space(1))) struct sdt_task_desc *') changes address space of pointer
  375 |                 desc = desc_children[pos];
      |                      ^ ~~~~~~~~~~~~~~~~~~
/home/avraham/Documents/scx/scheds/include/scx/sdt_task_impl.bpf.h:514:8: error: assigning '__arena struct sdt_task_desc *' (aka 'struct sdt_task_desc *__attribute__((address_space(1)))') to '__arena struct sdt_task_desc *' (aka '__attribute__((address_space(1))) struct sdt_task_desc *') changes address space of pointer
  514 |                 desc = desc_children[pos];
      |                      ^ ~~~~~~~~~~~~~~~~~~
/home/avraham/Documents/scx/scheds/include/scx/sdt_task_impl.bpf.h:516:27: error: passing 'struct sdt_alloc_stack *' to parameter of type '__arena struct sdt_alloc_stack *' changes address space of pointer
  516 |                         desc = sdt_alloc_chunk(stack);
      |                                                ^~~~~
/home/avraham/Documents/scx/scheds/include/scx/sdt_task_impl.bpf.h:230:79: note: passing argument to parameter 'stack' here
  230 | struct sdt_task_desc __arena *sdt_alloc_chunk(struct sdt_alloc_stack __arena *stack)
      |                                                                               ^
/home/avraham/Documents/scx/scheds/include/scx/sdt_task_impl.bpf.h:517:23: error: assigning '__arena struct sdt_task_desc *' (aka '__attribute__((address_space(1))) struct sdt_task_desc *') to '__arena struct sdt_task_desc *' (aka 'struct sdt_task_desc *__attribute__((address_space(1)))') changes address space of pointer
  517 |                         desc_children[pos] = desc;
      |                                            ^ ~~~~
/home/avraham/Documents/scx/scheds/include/scx/sdt_task_impl.bpf.h:536:9: error: assigning '__arena struct sdt_task_desc *' (aka '__attribute__((address_space(1))) struct sdt_task_desc *') to '__arena struct sdt_task_desc *' (aka 'struct sdt_task_desc *__attribute__((address_space(1)))') changes address space of pointer
  536 |         *descp = desc;
      |                ^ ~~~~
/home/avraham/Documents/scx/scheds/include/scx/sdt_task_impl.bpf.h:564:48: error: passing '__arena struct sdt_alloc_stack *' to parameter of type 'struct sdt_alloc_stack *' changes address space of pointer
  564 |         ret = sdt_task_find_empty(sdt_task_desc_root, stack, &desc, &idx);
      |                                                       ^~~~~
/home/avraham/Documents/scx/scheds/include/scx/sdt_task_impl.bpf.h:471:26: note: passing argument to parameter 'stack' here
  471 |         struct sdt_alloc_stack *stack,
      |                                 ^
/home/avraham/Documents/scx/scheds/include/scx/sdt_task_impl.bpf.h:579:35: error: passing 'struct sdt_task_pool *' to parameter of type '__arena struct sdt_task_pool *' changes address space of pointer
  579 |                 data = sdt_task_alloc_from_pool(&sdt_task_data_pool, stack);
      |                                                 ^~~~~~~~~~~~~~~~~~~
/home/avraham/Documents/scx/scheds/include/scx/sdt_task_impl.bpf.h:204:70: note: passing argument to parameter 'pool' here
  204 | void __arena *sdt_task_alloc_from_pool(struct sdt_task_pool __arena *pool,
      |                                                                      ^
13 errors generated.
[24/40] Generating rust_all with a custom command (wrapped by meson to set env)
ninja: build stopped: subcommand failed.

I'm running Linux 6.12.2 and LLVM/Clang 19.1.5 on Gentoo; this is with up-to-date main branch.

@etsal
Copy link
Contributor

etsal commented Dec 6, 2024

@anh0516 Thank you for opening the issue. These errors happen because LLVM 19 is stricter in its use of the __arena primitive than LLVM 18. I will be uploading a fix today or tomorrow, do you mind applying and testing to make sure it works?

@anh0516
Copy link
Contributor Author

anh0516 commented Dec 6, 2024

Of course, thanks.

@etsal
Copy link
Contributor

etsal commented Dec 6, 2024

Could you try and see if #1061 works for you?

@anh0516
Copy link
Contributor Author

anh0516 commented Dec 7, 2024

It works. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants