progs/hid_bpf_helpers.h:117:31: error: declaration of 'struct bpf_wq' will not be visible outside of this function
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/vdso head: f7178f159b2a36d070fd43b0d751e4e4415ec39e commit: 912632a7fd4cc1eac2778828d92e8fe46939d6bd [37/45] vdso/datapage: Trim down unnecessary includes config: riscv-allnoconfig-bpf (https://download.01.org/0day-ci/archive/20260311/[email protected]/config) compiler: riscv64-linux-gnu-gcc (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260311/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from progs/hid.c:3:
>> progs/hid_bpf_helpers.h:117:31: error: declaration of 'struct bpf_wq' will not be visible outside of this function [-Werror,-Wvisibility]
117 | extern int bpf_wq_init(struct bpf_wq *wq, void *p__map, unsigned int flags) __weak __ksym;
| ^
progs/hid_bpf_helpers.h:118:32: error: declaration of 'struct bpf_wq' will not be visible outside of this function [-Werror,-Wvisibility]
118 | extern int bpf_wq_start(struct bpf_wq *wq, unsigned int flags) __weak __ksym;
| ^
progs/hid_bpf_helpers.h:119:39: error: declaration of 'struct bpf_wq' will not be visible outside of this function [-Werror,-Wvisibility]
119 | extern int bpf_wq_set_callback(struct bpf_wq *wq,
| ^
>> progs/hid.c:448:16: error: field has incomplete type 'struct bpf_wq'
448 | struct bpf_wq work;
| ^
progs/hid.c:448:9: note: forward declaration of 'struct bpf_wq'
448 | struct bpf_wq work;
| ^
>> progs/hid.c:487:18: error: incompatible pointer types passing 'struct bpf_wq *' to parameter of type 'struct bpf_wq *' [-Wincompatible-pointer-types]
487 | if (bpf_wq_init(wq, &hmap, 0) != 0)
| ^~
progs/hid_bpf_helpers.h:117:39: note: passing argument to parameter 'wq' here
117 | extern int bpf_wq_init(struct bpf_wq *wq, void *p__map, unsigned int flags) __weak __ksym;
| ^
progs/hid.c:490:26: error: incompatible pointer types passing 'struct bpf_wq *' to parameter of type 'struct bpf_wq *' [-Wincompatible-pointer-types]
490 | if (bpf_wq_set_callback(wq, wq_cb_sleepable, 0))
| ^~
progs/hid_bpf_helpers.h:119:47: note: passing argument to parameter 'wq' here
119 | extern int bpf_wq_set_callback(struct bpf_wq *wq,
| ^
progs/hid.c:493:19: error: incompatible pointer types passing 'struct bpf_wq *' to parameter of type 'struct bpf_wq *' [-Wincompatible-pointer-types]
493 | if (bpf_wq_start(wq, 0))
| ^~
progs/hid_bpf_helpers.h:118:40: note: passing argument to parameter 'wq' here
118 | extern int bpf_wq_start(struct bpf_wq *wq, unsigned int flags) __weak __ksym;
| ^
progs/hid.c:503:24: error: incomplete definition of type 'struct hid_device'
503 | int hid = hid_ctx->hid->id;
| ~~~~~~~~~~~~^
progs/hid_bpf_helpers.h:59:9: note: forward declaration of 'struct hid_device'
59 | struct hid_device *hid;
| ^8 errors generated.
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Hi Jiri and Benjamin,
could you take a look at the report below?
This looks like an issue in the HID BPF subsystem, surfaced by my unrelated change. Does this ring a bell for you?
I wasn't able to reproduce it so far, but will continue looking into it.
Thomas
Quoted 59 lines · kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/vdso head: f7178f159b2a36d070fd43b0d751e4e4415ec39e commit: 912632a7fd4cc1eac2778828d92e8fe46939d6bd [37/45] vdso/datapage: Trim down unnecessary includes config: riscv-allnoconfig-bpf (https://download.01.org/0day-ci/archive/20260311/[email protected]/config) compiler: riscv64-linux-gnu-gcc (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260311/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/All errors (new ones prefixed by >>):
In file included from
progs/hid.c:3:Quoted 1 line
Quoted 1 line
progs/hid_bpf_helpers.h:117:31: error: declaration of 'structbpf_wq' will not be visible outside of this function [-Werror,-Wvisibility]117 | extern int bpf_wq_init(struct bpf_wq *wq, void *p__map, unsigned int flags) __weak __ksym; | ^ progs/hid_bpf_helpers.h:118:32: error: declaration of 'struct bpf_wq' will not be visible outside of this function [-Werror,-Wvisibility] 118 | extern int bpf_wq_start(struct bpf_wq *wq, unsigned int flags) __weak __ksym; | ^
progs/hid_bpf_helpers.h:119:39: error: declaration of 'structbpf_wq' will not be visible outside of this function [-Werror,-Wvisibility]
119 | extern int bpf_wq_set_callback(structbpf_wq*wq,
| ^Quoted 1 line
Quoted 1 line
progs/hid.c:448:16: error: field has incomplete type 'structbpf_wq'448 | struct bpf_wq work; | ^ progs/hid.c:448:9: note: forward declaration of 'struct bpf_wq' 448 | struct bpf_wq work; | ^Quoted 1 line
Quoted 1 line
progs/hid.c:487:18: error: incompatible pointer types passing 'structbpf_wq*' to parameter of type 'structbpf_wq*' [-Wincompatible-pointer-types]487 | if (bpf_wq_init(wq, &hmap, 0) != 0) | ^~ progs/hid_bpf_helpers.h:117:39: note: passing argument to parameter 'wq' here 117 | extern int bpf_wq_init(struct bpf_wq *wq, void *p__map, unsigned int flags) __weak __ksym; | ^ progs/hid.c:490:26: error: incompatible pointer types passing 'struct bpf_wq *' to parameter of type 'struct bpf_wq *' [-Wincompatible-pointer-types] 490 | if (bpf_wq_set_callback(wq, wq_cb_sleepable, 0)) | ^~ progs/hid_bpf_helpers.h:119:47: note: passing argument to parameter 'wq' here 119 | extern int bpf_wq_set_callback(struct bpf_wq *wq, | ^ progs/hid.c:493:19: error: incompatible pointer types passing 'struct bpf_wq *' to parameter of type 'struct bpf_wq *' [-Wincompatible-pointer-types] 493 | if (bpf_wq_start(wq, 0)) | ^~ progs/hid_bpf_helpers.h:118:40: note: passing argument to parameter 'wq' here 118 | extern int bpf_wq_start(struct bpf_wq *wq, unsigned int flags) __weak __ksym; | ^ progs/hid.c:503:24: error: incomplete definition of type 'struct hid_device' 503 | int hid = hid_ctx->hid->id; | ~~~~~~~~~~~~^ progs/hid_bpf_helpers.h:59:9: note: forward declaration of 'struct hid_device' 59 | struct hid_device *hid; | ^8 errors generated.
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Benjamin Tissoires
maintainerQuoted 7 lines · Thomas Weißschuh
Hi Jiri and Benjamin,
could you take a look at the report below?
This looks like an issue in the HID BPF subsystem, surfaced by my unrelated change. Does this ring a bell for you?I wasn't able to reproduce it so far, but will continue looking into it.
Both struct bpf_wq and struct hid_device should be generated in the vmlinux.h that we include in the selftests. So this is definitely not related to your patch AFAICT.
Looking in the config, we have # CONFIG_HID_SUPPORT is not set -> so that would explain why struct hid_device is not available. But in that case, why are the HID selftests even built?
The bpf_wq bits should be related to a similar-ish issue where one config setting is not set and so it's not included in the final BTF.
I paged out how we can ignore selftests based on the .config, so if you have any hints, that would be nice :)
Cheers,
Benjamin
Quoted 65 lines
Thomas
Quoted 59 lines · kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/vdso head: f7178f159b2a36d070fd43b0d751e4e4415ec39e commit: 912632a7fd4cc1eac2778828d92e8fe46939d6bd [37/45] vdso/datapage: Trim down unnecessary includes config: riscv-allnoconfig-bpf (https://download.01.org/0day-ci/archive/20260311/[email protected]/config) compiler: riscv64-linux-gnu-gcc (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260311/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/All errors (new ones prefixed by >>):
In file included from
progs/hid.c:3:Quoted 1 line
Quoted 1 line
progs/hid_bpf_helpers.h:117:31: error: declaration of 'structbpf_wq' will not be visible outside of this function [-Werror,-Wvisibility]117 | extern int bpf_wq_init(struct bpf_wq *wq, void *p__map, unsigned int flags) __weak __ksym; | ^ progs/hid_bpf_helpers.h:118:32: error: declaration of 'struct bpf_wq' will not be visible outside of this function [-Werror,-Wvisibility] 118 | extern int bpf_wq_start(struct bpf_wq *wq, unsigned int flags) __weak __ksym; | ^
progs/hid_bpf_helpers.h:119:39: error: declaration of 'structbpf_wq' will not be visible outside of this function [-Werror,-Wvisibility]
119 | extern int bpf_wq_set_callback(structbpf_wq*wq,
| ^Quoted 1 line
Quoted 1 line
progs/hid.c:448:16: error: field has incomplete type 'structbpf_wq'448 | struct bpf_wq work; | ^ progs/hid.c:448:9: note: forward declaration of 'struct bpf_wq' 448 | struct bpf_wq work; | ^Quoted 1 line
Quoted 1 line
progs/hid.c:487:18: error: incompatible pointer types passing 'structbpf_wq*' to parameter of type 'structbpf_wq*' [-Wincompatible-pointer-types]487 | if (bpf_wq_init(wq, &hmap, 0) != 0) | ^~ progs/hid_bpf_helpers.h:117:39: note: passing argument to parameter 'wq' here 117 | extern int bpf_wq_init(struct bpf_wq *wq, void *p__map, unsigned int flags) __weak __ksym; | ^ progs/hid.c:490:26: error: incompatible pointer types passing 'struct bpf_wq *' to parameter of type 'struct bpf_wq *' [-Wincompatible-pointer-types] 490 | if (bpf_wq_set_callback(wq, wq_cb_sleepable, 0)) | ^~ progs/hid_bpf_helpers.h:119:47: note: passing argument to parameter 'wq' here 119 | extern int bpf_wq_set_callback(struct bpf_wq *wq, | ^ progs/hid.c:493:19: error: incompatible pointer types passing 'struct bpf_wq *' to parameter of type 'struct bpf_wq *' [-Wincompatible-pointer-types] 493 | if (bpf_wq_start(wq, 0)) | ^~ progs/hid_bpf_helpers.h:118:40: note: passing argument to parameter 'wq' here 118 | extern int bpf_wq_start(struct bpf_wq *wq, unsigned int flags) __weak __ksym; | ^ progs/hid.c:503:24: error: incomplete definition of type 'struct hid_device' 503 | int hid = hid_ctx->hid->id; | ~~~~~~~~~~~~^ progs/hid_bpf_helpers.h:59:9: note: forward declaration of 'struct hid_device' 59 | struct hid_device *hid; | ^8 errors generated.
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Hi Benjamin,
thanks for the quick response.
Quoted 10 lines · Benjamin Tissoires
Quoted 5 lines · Thomas Weißschuh
could you take a look at the report below?
This looks like an issue in the HID BPF subsystem, surfaced by my unrelated change. Does this ring a bell for you?I wasn't able to reproduce it so far, but will continue looking into it.
Both struct
bpf_wqand structhid_deviceshould be generated in thevmlinux.hthat we include in the selftests. So this is definitely not related to your patch AFAICT.
Ack. To be sure I sent this branch again through 0day and will see if it breaks on the same commit.
Quoted 3 lines
Looking in the config, we have
# CONFIG_HID_SUPPORT is not set-> so that would explain why structhid_deviceis not available. But in that case, why are the HID selftests even built?
CONFIG_DEBUG_INFO_BTF is also not set. So there should be no vmlinux.h at all in the first. Which is exactly what happens in my attempts to reproduce the issue. But even when fixing that up, the issue persists.
Quoted 2 lines
The
bpf_wqbits should be related to a similar-ish issue where one config setting is not set and so it's not included in the final BTF.
I'll look into how exactly things end up in vmlinux.h.
At least the headers for 'struct bpf_wq' are always included somewhere. But maybe the type also needs to be used to define some structure.
Quoted 2 lines
I paged out how we can ignore selftests based on the .config, so if you have any hints, that would be nice :)
Inspecting the kernel configuration might be hard, as there might be no file for it available. Could you use vmlinux.h itself for feature detection?
Thomas
Quoted 61 lines
Quoted 61 lines · kernel test robot
Quoted 59 lines
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/vdso head: f7178f159b2a36d070fd43b0d751e4e4415ec39e commit: 912632a7fd4cc1eac2778828d92e8fe46939d6bd [37/45] vdso/datapage: Trim down unnecessary includes config: riscv-allnoconfig-bpf (https://download.01.org/0day-ci/archive/20260311/[email protected]/config) compiler: riscv64-linux-gnu-gcc (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260311/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/All errors (new ones prefixed by >>):
In file included from
progs/hid.c:3:Quoted 1 line
Quoted 1 line
progs/hid_bpf_helpers.h:117:31: error: declaration of 'structbpf_wq' will not be visible outside of this function [-Werror,-Wvisibility]117 | extern int bpf_wq_init(struct bpf_wq *wq, void *p__map, unsigned int flags) __weak __ksym; | ^ progs/hid_bpf_helpers.h:118:32: error: declaration of 'struct bpf_wq' will not be visible outside of this function [-Werror,-Wvisibility] 118 | extern int bpf_wq_start(struct bpf_wq *wq, unsigned int flags) __weak __ksym; | ^
progs/hid_bpf_helpers.h:119:39: error: declaration of 'structbpf_wq' will not be visible outside of this function [-Werror,-Wvisibility]
119 | extern int bpf_wq_set_callback(structbpf_wq*wq,
| ^Quoted 1 line
Quoted 1 line
progs/hid.c:448:16: error: field has incomplete type 'structbpf_wq'448 | struct bpf_wq work; | ^ progs/hid.c:448:9: note: forward declaration of 'struct bpf_wq' 448 | struct bpf_wq work; | ^Quoted 1 line
Quoted 1 line
progs/hid.c:487:18: error: incompatible pointer types passing 'structbpf_wq*' to parameter of type 'structbpf_wq*' [-Wincompatible-pointer-types]487 | if (bpf_wq_init(wq, &hmap, 0) != 0) | ^~ progs/hid_bpf_helpers.h:117:39: note: passing argument to parameter 'wq' here 117 | extern int bpf_wq_init(struct bpf_wq *wq, void *p__map, unsigned int flags) __weak __ksym; | ^ progs/hid.c:490:26: error: incompatible pointer types passing 'struct bpf_wq *' to parameter of type 'struct bpf_wq *' [-Wincompatible-pointer-types] 490 | if (bpf_wq_set_callback(wq, wq_cb_sleepable, 0)) | ^~ progs/hid_bpf_helpers.h:119:47: note: passing argument to parameter 'wq' here 119 | extern int bpf_wq_set_callback(struct bpf_wq *wq, | ^ progs/hid.c:493:19: error: incompatible pointer types passing 'struct bpf_wq *' to parameter of type 'struct bpf_wq *' [-Wincompatible-pointer-types] 493 | if (bpf_wq_start(wq, 0)) | ^~ progs/hid_bpf_helpers.h:118:40: note: passing argument to parameter 'wq' here 118 | extern int bpf_wq_start(struct bpf_wq *wq, unsigned int flags) __weak __ksym; | ^ progs/hid.c:503:24: error: incomplete definition of type 'struct hid_device' 503 | int hid = hid_ctx->hid->id; | ~~~~~~~~~~~~^ progs/hid_bpf_helpers.h:59:9: note: forward declaration of 'struct hid_device' 59 | struct hid_device *hid; | ^8 errors generated.
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Benjamin Tissoires
maintainerQuoted 34 lines · Thomas Weißschuh
Hi Benjamin,
thanks for the quick response.
Quoted 10 lines · Benjamin Tissoires
Quoted 5 lines · Thomas Wei�schuh
could you take a look at the report below?
This looks like an issue in the HID BPF subsystem, surfaced by my unrelated change. Does this ring a bell for you?I wasn't able to reproduce it so far, but will continue looking into it.
Both struct
bpf_wqand structhid_deviceshould be generated in thevmlinux.hthat we include in the selftests. So this is definitely not related to your patch AFAICT.Ack. To be sure I sent this branch again through 0day and will see if it breaks on the same commit.
Quoted 3 lines
Looking in the config, we have
# CONFIG_HID_SUPPORT is not set-> so that would explain why structhid_deviceis not available. But in that case, why are the HID selftests even built?
CONFIG_DEBUG_INFO_BTFis also not set. So there should be novmlinux.hat all in the first. Which is exactly what happens in my attempts to reproduce the issue. But even when fixing that up, the issue persists.Quoted 2 lines
The
bpf_wqbits should be related to a similar-ish issue where one config setting is not set and so it's not included in the final BTF.I'll look into how exactly things end up in
vmlinux.h.
At least the headers for 'structbpf_wq' are always included somewhere. But maybe the type also needs to be used to define some structure.
Quoted 6 lines
Quoted 2 lines
I paged out how we can ignore selftests based on the .config, so if you have any hints, that would be nice :)
Inspecting the kernel configuration might be hard, as there might be no file for it available. Could you use
vmlinux.hitself for feature detection?
Actually I think I remember the rationale:
- because working with config is hard, we just hide any struct definition we need in progs/hid_bpf_helpers.h before including vmlinux.h
- then we manually define them
So it looks like this is a step I forgot to make when I added the last few bits: redefine struct bpf_wq and struct hid_device.
Technically we shouldn't even need to redefine the entire struct, but only the bits we are accessing, because bpf with CO-RE will do the offsets for us :)
Would the following patch fixes the issue?:
---
From bf4030f8116a4bcafe9f8d84f3d03dd2eedc58a4 Mon Sep 17 00:00:00 2001
From: Benjamin Tissoires <[email protected]>
Date: Thu, 12 Mar 2026 18:29:40 +0100
Subject: [PATCH] selftests/hid: fix compilation when bpf_wq and hid_device are
not exported
This can happen in situations when CONFIG_HID_SUPPORT is set to no, or some complex situations where struct bpf_wq is not exported.
So do the usual dance of hiding them before including vmlinux.h, and then redefining them and make use of CO-RE to have the correct offsets.
--- tools/testing/selftests/hid/progs/hid_bpf_helpers.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
tools/testing/selftests/hid/progs/hid_bpf_helpers.h +12 -0
@@ -8,9 +8,11 @@/* "undefine" structs and enums in vmlinux.h, because we "override" them below */ #define hid_bpf_ctx hid_bpf_ctx___not_used#define hid_bpf_ops hid_bpf_ops___not_used +#define hid_device hid_device___not_used#define hid_report_type hid_report_type___not_used#define hid_class_request hid_class_request___not_used#define hid_bpf_attach_flags hid_bpf_attach_flags___not_used +#define bpf_wq bpf_wq___not_used#define HID_INPUT_REPORT HID_INPUT_REPORT___not_used#define HID_OUTPUT_REPORT HID_OUTPUT_REPORT___not_used#define HID_FEATURE_REPORT HID_FEATURE_REPORT___not_used
@@ -29,9 +31,11 @@#undef hid_bpf_ctx#undef hid_bpf_ops +#undef hid_device#undef hid_report_type#undef hid_class_request#undef hid_bpf_attach_flags +#undef bpf_wq#undef HID_INPUT_REPORT#undef HID_OUTPUT_REPORT#undef HID_FEATURE_REPORT
@@ -55,6 +59,14 @@ enum hid_report_type { HID_REPORT_TYPES, }; +struct hid_device { +unsigned int id; +} __attribute__((preserve_access_index)); + +struct bpf_wq { +__u64 __opaque[2 ]; +}; +struct hid_bpf_ctx {struct hid_device *hid;__u32 allocated_size;
Signature · 5 lines
2.52.0 --- Cheers, Benjamin
Quoted 65 lines
Thomas
Quoted 61 lines
Quoted 61 lines · kernel test robot
Quoted 59 lines
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/vdso head: f7178f159b2a36d070fd43b0d751e4e4415ec39e commit: 912632a7fd4cc1eac2778828d92e8fe46939d6bd [37/45] vdso/datapage: Trim down unnecessary includes config: riscv-allnoconfig-bpf (https://download.01.org/0day-ci/archive/20260311/[email protected]/config) compiler: riscv64-linux-gnu-gcc (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260311/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/All errors (new ones prefixed by >>):
In file included from
progs/hid.c:3:Quoted 1 line
Quoted 1 line
progs/hid_bpf_helpers.h:117:31: error: declaration of 'structbpf_wq' will not be visible outside of this function [-Werror,-Wvisibility]117 | extern int bpf_wq_init(struct bpf_wq *wq, void *p__map, unsigned int flags) __weak __ksym; | ^ progs/hid_bpf_helpers.h:118:32: error: declaration of 'struct bpf_wq' will not be visible outside of this function [-Werror,-Wvisibility] 118 | extern int bpf_wq_start(struct bpf_wq *wq, unsigned int flags) __weak __ksym; | ^
progs/hid_bpf_helpers.h:119:39: error: declaration of 'structbpf_wq' will not be visible outside of this function [-Werror,-Wvisibility]
119 | extern int bpf_wq_set_callback(structbpf_wq*wq,
| ^Quoted 1 line
Quoted 1 line
progs/hid.c:448:16: error: field has incomplete type 'structbpf_wq'448 | struct bpf_wq work; | ^ progs/hid.c:448:9: note: forward declaration of 'struct bpf_wq' 448 | struct bpf_wq work; | ^Quoted 1 line
Quoted 1 line
progs/hid.c:487:18: error: incompatible pointer types passing 'structbpf_wq*' to parameter of type 'structbpf_wq*' [-Wincompatible-pointer-types]487 | if (bpf_wq_init(wq, &hmap, 0) != 0) | ^~ progs/hid_bpf_helpers.h:117:39: note: passing argument to parameter 'wq' here 117 | extern int bpf_wq_init(struct bpf_wq *wq, void *p__map, unsigned int flags) __weak __ksym; | ^ progs/hid.c:490:26: error: incompatible pointer types passing 'struct bpf_wq *' to parameter of type 'struct bpf_wq *' [-Wincompatible-pointer-types] 490 | if (bpf_wq_set_callback(wq, wq_cb_sleepable, 0)) | ^~ progs/hid_bpf_helpers.h:119:47: note: passing argument to parameter 'wq' here 119 | extern int bpf_wq_set_callback(struct bpf_wq *wq, | ^ progs/hid.c:493:19: error: incompatible pointer types passing 'struct bpf_wq *' to parameter of type 'struct bpf_wq *' [-Wincompatible-pointer-types] 493 | if (bpf_wq_start(wq, 0)) | ^~ progs/hid_bpf_helpers.h:118:40: note: passing argument to parameter 'wq' here 118 | extern int bpf_wq_start(struct bpf_wq *wq, unsigned int flags) __weak __ksym; | ^ progs/hid.c:503:24: error: incomplete definition of type 'struct hid_device' 503 | int hid = hid_ctx->hid->id; | ~~~~~~~~~~~~^ progs/hid_bpf_helpers.h:59:9: note: forward declaration of 'struct hid_device' 59 | struct hid_device *hid; | ^8 errors generated.
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Quoted 38 lines · Benjamin Tissoires
Quoted 30 lines · Thomas Weißschuh
Quoted 10 lines · Benjamin Tissoires
Quoted 5 lines · Thomas Wei�schuh
could you take a look at the report below?
This looks like an issue in the HID BPF subsystem, surfaced by my unrelated change. Does this ring a bell for you?I wasn't able to reproduce it so far, but will continue looking into it.
Both struct
bpf_wqand structhid_deviceshould be generated in thevmlinux.hthat we include in the selftests. So this is definitely not related to your patch AFAICT.Ack. To be sure I sent this branch again through 0day and will see if it breaks on the same commit.
Quoted 3 lines
Looking in the config, we have
# CONFIG_HID_SUPPORT is not set-> so that would explain why structhid_deviceis not available. But in that case, why are the HID selftests even built?
CONFIG_DEBUG_INFO_BTFis also not set. So there should be novmlinux.hat all in the first. Which is exactly what happens in my attempts to reproduce the issue. But even when fixing that up, the issue persists.Quoted 2 lines
The
bpf_wqbits should be related to a similar-ish issue where one config setting is not set and so it's not included in the final BTF.I'll look into how exactly things end up in
vmlinux.h.
At least the headers for 'structbpf_wq' are always included somewhere. But maybe the type also needs to be used to define some structure.Quoted 6 lines
Quoted 2 lines
I paged out how we can ignore selftests based on the .config, so if you have any hints, that would be nice :)
Inspecting the kernel configuration might be hard, as there might be no file for it available. Could you use
vmlinux.hitself for feature detection?
Quoted 8 lines
Actually I think I remember the rationale:
- because working with config is hard, we just hide any struct definition we need inprogs/hid_bpf_helpers.hbefore includingvmlinux.h
- then we manually define themSo it looks like this is a step I forgot to make when I added the last few bits: redefine struct
bpf_wqand structhid_device.
That makes sense. Thanks for checking.
Quoted 5 lines
Technically we shouldn't even need to redefine the entire struct, but only the bits we are accessing, because bpf with CO-RE will do the offsets for us :)
Would the following patch fixes the issue?:
I expect so. However none of the other bot (re-b)builds reproduced this issue, so I can't validate it. I'll put this down as some sort of fluke that it occurred while building my patch, especially given all the other weirdness in that report. Your patch should fix it for good.
Quoted 133 lines
---
Frombf4030f8116a4bcafe9f8d84f3d03dd2eedc58a4Mon Sep 17 00:00:00 2001
From: Benjamin Tissoires <[email protected]>
Date: Thu, 12 Mar 2026 18:29:40 +0100
Subject: [PATCH] selftests/hid: fix compilation whenbpf_wqandhid_deviceare
not exportedThis can happen in situations when
CONFIG_HID_SUPPORTis set to no, or some complex situations where structbpf_wqis not exported.So do the usual dance of hiding them before including
vmlinux.h, and then redefining them and make use of CO-RE to have the correct offsets.Signed-off-by Benjamin Tissoires <[email protected]>--- tools/testing/selftests/hid/progs/hid_bpf_helpers.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)tools/testing/selftests/hid/progs/hid_bpf_helpers.h +12
-0@@ -8,9 +8,11 @@/* "undefine" structs and enums in vmlinux.h, because we "override" them below */ #define hid_bpf_ctx hid_bpf_ctx___not_used#define hid_bpf_ops hid_bpf_ops___not_used +#define hid_device hid_device___not_used#define hid_report_type hid_report_type___not_used#define hid_class_request hid_class_request___not_used#define hid_bpf_attach_flags hid_bpf_attach_flags___not_used +#define bpf_wq bpf_wq___not_used#define HID_INPUT_REPORT HID_INPUT_REPORT___not_used#define HID_OUTPUT_REPORT HID_OUTPUT_REPORT___not_used#define HID_FEATURE_REPORT HID_FEATURE_REPORT___not_used@@ -29,9 +31,11 @@#undef hid_bpf_ctx#undef hid_bpf_ops +#undef hid_device#undef hid_report_type#undef hid_class_request#undef hid_bpf_attach_flags +#undef bpf_wq#undef HID_INPUT_REPORT#undef HID_OUTPUT_REPORT#undef HID_FEATURE_REPORT@@ -55,6 +59,14 @@ enum hid_report_type { HID_REPORT_TYPES, }; +struct hid_device { +unsigned int id; +} __attribute__((preserve_access_index)); + +struct bpf_wq { +__u64 __opaque[2 ]; +}; +struct hid_bpf_ctx {struct hid_device *hid;__u32 allocated_size;Signature · 5 lines
2.52.0 --- Cheers, BenjaminQuoted 65 lines
Thomas
Quoted 61 lines
Quoted 61 lines · kernel test robot
Quoted 59 lines
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/vdso head: f7178f159b2a36d070fd43b0d751e4e4415ec39e commit: 912632a7fd4cc1eac2778828d92e8fe46939d6bd [37/45] vdso/datapage: Trim down unnecessary includes config: riscv-allnoconfig-bpf (https://download.01.org/0day-ci/archive/20260311/[email protected]/config) compiler: riscv64-linux-gnu-gcc (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260311/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/All errors (new ones prefixed by >>):
In file included from
progs/hid.c:3:Quoted 1 line
Quoted 1 line
progs/hid_bpf_helpers.h:117:31: error: declaration of 'structbpf_wq' will not be visible outside of this function [-Werror,-Wvisibility]117 | extern int bpf_wq_init(struct bpf_wq *wq, void *p__map, unsigned int flags) __weak __ksym; | ^ progs/hid_bpf_helpers.h:118:32: error: declaration of 'struct bpf_wq' will not be visible outside of this function [-Werror,-Wvisibility] 118 | extern int bpf_wq_start(struct bpf_wq *wq, unsigned int flags) __weak __ksym; | ^
progs/hid_bpf_helpers.h:119:39: error: declaration of 'structbpf_wq' will not be visible outside of this function [-Werror,-Wvisibility]
119 | extern int bpf_wq_set_callback(structbpf_wq*wq,
| ^Quoted 1 line
Quoted 1 line
progs/hid.c:448:16: error: field has incomplete type 'structbpf_wq'448 | struct bpf_wq work; | ^ progs/hid.c:448:9: note: forward declaration of 'struct bpf_wq' 448 | struct bpf_wq work; | ^Quoted 1 line
Quoted 1 line
progs/hid.c:487:18: error: incompatible pointer types passing 'structbpf_wq*' to parameter of type 'structbpf_wq*' [-Wincompatible-pointer-types]487 | if (bpf_wq_init(wq, &hmap, 0) != 0) | ^~ progs/hid_bpf_helpers.h:117:39: note: passing argument to parameter 'wq' here 117 | extern int bpf_wq_init(struct bpf_wq *wq, void *p__map, unsigned int flags) __weak __ksym; | ^ progs/hid.c:490:26: error: incompatible pointer types passing 'struct bpf_wq *' to parameter of type 'struct bpf_wq *' [-Wincompatible-pointer-types] 490 | if (bpf_wq_set_callback(wq, wq_cb_sleepable, 0)) | ^~ progs/hid_bpf_helpers.h:119:47: note: passing argument to parameter 'wq' here 119 | extern int bpf_wq_set_callback(struct bpf_wq *wq, | ^ progs/hid.c:493:19: error: incompatible pointer types passing 'struct bpf_wq *' to parameter of type 'struct bpf_wq *' [-Wincompatible-pointer-types] 493 | if (bpf_wq_start(wq, 0)) | ^~ progs/hid_bpf_helpers.h:118:40: note: passing argument to parameter 'wq' here 118 | extern int bpf_wq_start(struct bpf_wq *wq, unsigned int flags) __weak __ksym; | ^ progs/hid.c:503:24: error: incomplete definition of type 'struct hid_device' 503 | int hid = hid_ctx->hid->id; | ~~~~~~~~~~~~^ progs/hid_bpf_helpers.h:59:9: note: forward declaration of 'struct hid_device' 59 | struct hid_device *hid; | ^8 errors generated.
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Benjamin Tissoires
maintainerQuoted 54 lines · Thomas Weißschuh
Quoted 38 lines · Benjamin Tissoires
Quoted 30 lines · Thomas Wei�schuh
Quoted 10 lines · Benjamin Tissoires
Quoted 5 lines · Thomas Wei�schuh
could you take a look at the report below?
This looks like an issue in the HID BPF subsystem, surfaced by my unrelated change. Does this ring a bell for you?I wasn't able to reproduce it so far, but will continue looking into it.
Both struct
bpf_wqand structhid_deviceshould be generated in thevmlinux.hthat we include in the selftests. So this is definitely not related to your patch AFAICT.Ack. To be sure I sent this branch again through 0day and will see if it breaks on the same commit.
Quoted 3 lines
Looking in the config, we have
# CONFIG_HID_SUPPORT is not set-> so that would explain why structhid_deviceis not available. But in that case, why are the HID selftests even built?
CONFIG_DEBUG_INFO_BTFis also not set. So there should be novmlinux.hat all in the first. Which is exactly what happens in my attempts to reproduce the issue. But even when fixing that up, the issue persists.Quoted 2 lines
The
bpf_wqbits should be related to a similar-ish issue where one config setting is not set and so it's not included in the final BTF.I'll look into how exactly things end up in
vmlinux.h.
At least the headers for 'structbpf_wq' are always included somewhere. But maybe the type also needs to be used to define some structure.Quoted 6 lines
Quoted 2 lines
I paged out how we can ignore selftests based on the .config, so if you have any hints, that would be nice :)
Inspecting the kernel configuration might be hard, as there might be no file for it available. Could you use
vmlinux.hitself for feature detection?Quoted 8 lines
Actually I think I remember the rationale:
- because working with config is hard, we just hide any struct definition we need inprogs/hid_bpf_helpers.hbefore includingvmlinux.h
- then we manually define themSo it looks like this is a step I forgot to make when I added the last few bits: redefine struct
bpf_wqand structhid_device.That makes sense. Thanks for checking.
Quoted 4 lines
Technically we shouldn't even need to redefine the entire struct, but only the bits we are accessing, because bpf with CO-RE will do the offsets for us :)
Quoted 6 lines
Quoted 1 line
Would the following patch fixes the issue?:
I expect so. However none of the other bot (re-b)builds reproduced this issue, so I can't validate it. I'll put this down as some sort of fluke that it occurred while building my patch, especially given all the other weirdness in that report. Your patch should fix it for good.
Thanks.
For reference, submitted here:
https://lore.kernel.org/linux-input/[email protected]/T/#u
Cheers,
Benjamin
Quoted 135 lines
Quoted 134 lines
---
Frombf4030f8116a4bcafe9f8d84f3d03dd2eedc58a4Mon Sep 17 00:00:00 2001
From: Benjamin Tissoires <[email protected]>
Date: Thu, 12 Mar 2026 18:29:40 +0100
Subject: [PATCH] selftests/hid: fix compilation whenbpf_wqandhid_deviceare
not exportedThis can happen in situations when
CONFIG_HID_SUPPORTis set to no, or some complex situations where structbpf_wqis not exported.So do the usual dance of hiding them before including
vmlinux.h, and then redefining them and make use of CO-RE to have the correct offsets.Signed-off-by Benjamin Tissoires <[email protected]>--- tools/testing/selftests/hid/progs/hid_bpf_helpers.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)tools/testing/selftests/hid/progs/hid_bpf_helpers.h +12
-0@@ -8,9 +8,11 @@/* "undefine" structs and enums in vmlinux.h, because we "override" them below */ #define hid_bpf_ctx hid_bpf_ctx___not_used#define hid_bpf_ops hid_bpf_ops___not_used +#define hid_device hid_device___not_used#define hid_report_type hid_report_type___not_used#define hid_class_request hid_class_request___not_used#define hid_bpf_attach_flags hid_bpf_attach_flags___not_used +#define bpf_wq bpf_wq___not_used#define HID_INPUT_REPORT HID_INPUT_REPORT___not_used#define HID_OUTPUT_REPORT HID_OUTPUT_REPORT___not_used#define HID_FEATURE_REPORT HID_FEATURE_REPORT___not_used@@ -29,9 +31,11 @@#undef hid_bpf_ctx#undef hid_bpf_ops +#undef hid_device#undef hid_report_type#undef hid_class_request#undef hid_bpf_attach_flags +#undef bpf_wq#undef HID_INPUT_REPORT#undef HID_OUTPUT_REPORT#undef HID_FEATURE_REPORT@@ -55,6 +59,14 @@ enum hid_report_type { HID_REPORT_TYPES, }; +struct hid_device { +unsigned int id; +} __attribute__((preserve_access_index)); + +struct bpf_wq { +__u64 __opaque[2 ]; +}; +struct hid_bpf_ctx {struct hid_device *hid;__u32 allocated_size;Signature · 5 lines
2.52.0 --- Cheers, BenjaminQuoted 65 lines
Thomas
Quoted 61 lines
Quoted 61 lines · kernel test robot
Quoted 59 lines
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/vdso head: f7178f159b2a36d070fd43b0d751e4e4415ec39e commit: 912632a7fd4cc1eac2778828d92e8fe46939d6bd [37/45] vdso/datapage: Trim down unnecessary includes config: riscv-allnoconfig-bpf (https://download.01.org/0day-ci/archive/20260311/[email protected]/config) compiler: riscv64-linux-gnu-gcc (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260311/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/All errors (new ones prefixed by >>):
In file included from
progs/hid.c:3:Quoted 1 line
Quoted 1 line
progs/hid_bpf_helpers.h:117:31: error: declaration of 'structbpf_wq' will not be visible outside of this function [-Werror,-Wvisibility]117 | extern int bpf_wq_init(struct bpf_wq *wq, void *p__map, unsigned int flags) __weak __ksym; | ^ progs/hid_bpf_helpers.h:118:32: error: declaration of 'struct bpf_wq' will not be visible outside of this function [-Werror,-Wvisibility] 118 | extern int bpf_wq_start(struct bpf_wq *wq, unsigned int flags) __weak __ksym; | ^
progs/hid_bpf_helpers.h:119:39: error: declaration of 'structbpf_wq' will not be visible outside of this function [-Werror,-Wvisibility]
119 | extern int bpf_wq_set_callback(structbpf_wq*wq,
| ^Quoted 1 line
Quoted 1 line
progs/hid.c:448:16: error: field has incomplete type 'structbpf_wq'448 | struct bpf_wq work; | ^ progs/hid.c:448:9: note: forward declaration of 'struct bpf_wq' 448 | struct bpf_wq work; | ^Quoted 1 line
Quoted 1 line
progs/hid.c:487:18: error: incompatible pointer types passing 'structbpf_wq*' to parameter of type 'structbpf_wq*' [-Wincompatible-pointer-types]487 | if (bpf_wq_init(wq, &hmap, 0) != 0) | ^~ progs/hid_bpf_helpers.h:117:39: note: passing argument to parameter 'wq' here 117 | extern int bpf_wq_init(struct bpf_wq *wq, void *p__map, unsigned int flags) __weak __ksym; | ^ progs/hid.c:490:26: error: incompatible pointer types passing 'struct bpf_wq *' to parameter of type 'struct bpf_wq *' [-Wincompatible-pointer-types] 490 | if (bpf_wq_set_callback(wq, wq_cb_sleepable, 0)) | ^~ progs/hid_bpf_helpers.h:119:47: note: passing argument to parameter 'wq' here 119 | extern int bpf_wq_set_callback(struct bpf_wq *wq, | ^ progs/hid.c:493:19: error: incompatible pointer types passing 'struct bpf_wq *' to parameter of type 'struct bpf_wq *' [-Wincompatible-pointer-types] 493 | if (bpf_wq_start(wq, 0)) | ^~ progs/hid_bpf_helpers.h:118:40: note: passing argument to parameter 'wq' here 118 | extern int bpf_wq_start(struct bpf_wq *wq, unsigned int flags) __weak __ksym; | ^ progs/hid.c:503:24: error: incomplete definition of type 'struct hid_device' 503 | int hid = hid_ctx->hid->id; | ~~~~~~~~~~~~^ progs/hid_bpf_helpers.h:59:9: note: forward declaration of 'struct hid_device' 59 | struct hid_device *hid; | ^8 errors generated.
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki