linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] HID-BPF: Kconfig fix
@ 2022-11-30 10:10 Benjamin Tissoires
  2022-11-30 10:10 ` [PATCH 1/2] HID: bpf: enforce HID_BPF dependencies Benjamin Tissoires
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Benjamin Tissoires @ 2022-11-30 10:10 UTC (permalink / raw)
  To: Jiri Kosina, Florent Revest, Jon Hunter
  Cc: linux-input, linux-kernel, Benjamin Tissoires

Hi,

As discussed in [1], we need to add some more dependencies to HID-BPF in
the Kconfig. This way, when fmod_ret will be available on arm64, HID-BPF
will get enabled automatically.

Jon, would you mind giving a shot at that patch on your test system and
confirm the error disappeard?

Cheers,
Benjamin



[1] https://lore.kernel.org/r/CABRcYmKyRchQhabi1Vd9RcMQFCcb=EtWyEbFDFRTc-L-U8WhgA@mail.gmail.com

Benjamin Tissoires (2):
  HID: bpf: enforce HID_BPF dependencies
  selftests: hid: ensures we have the proper requirements in config

 drivers/hid/bpf/Kconfig            | 4 +++-
 tools/testing/selftests/hid/config | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

-- 
2.38.1


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

* [PATCH 1/2] HID: bpf: enforce HID_BPF dependencies
  2022-11-30 10:10 [PATCH 0/2] HID-BPF: Kconfig fix Benjamin Tissoires
@ 2022-11-30 10:10 ` Benjamin Tissoires
  2022-12-01 13:13   ` Jon Hunter
  2022-12-02  0:40   ` Jiri Kosina
  2022-11-30 10:10 ` [PATCH 2/2] selftests: hid: ensures we have the proper requirements in config Benjamin Tissoires
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 7+ messages in thread
From: Benjamin Tissoires @ 2022-11-30 10:10 UTC (permalink / raw)
  To: Jiri Kosina, Florent Revest, Jon Hunter
  Cc: linux-input, linux-kernel, Benjamin Tissoires

As mentioned in the link below, having JIT and BPF is not enough to
have fmod_ret and error injection APIs. This resolves the error that
happens on a system without tracing enabled when hid-bpf tries to
load itself.

Link: https://lore.kernel.org/r/CABRcYmKyRchQhabi1Vd9RcMQFCcb=EtWyEbFDFRTc-L-U8WhgA@mail.gmail.com
Fixes: f5c27da4e3c8 ("HID: initial BPF implementation")
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
 drivers/hid/bpf/Kconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/bpf/Kconfig b/drivers/hid/bpf/Kconfig
index 298634fc3335..498232f9faa9 100644
--- a/drivers/hid/bpf/Kconfig
+++ b/drivers/hid/bpf/Kconfig
@@ -4,7 +4,9 @@ menu "HID-BPF support"
 config HID_BPF
 	bool "HID-BPF support"
 	default HID_SUPPORT
-	depends on BPF && BPF_SYSCALL
+	depends on BPF && BPF_SYSCALL && \
+		   DYNAMIC_FTRACE_WITH_DIRECT_CALLS && \
+		   FUNCTION_ERROR_INJECTION
 	help
 	This option allows to support eBPF programs on the HID subsystem.
 	eBPF programs can fix HID devices in a lighter way than a full
-- 
2.38.1


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

* [PATCH 2/2] selftests: hid: ensures we have the proper requirements in config
  2022-11-30 10:10 [PATCH 0/2] HID-BPF: Kconfig fix Benjamin Tissoires
  2022-11-30 10:10 ` [PATCH 1/2] HID: bpf: enforce HID_BPF dependencies Benjamin Tissoires
@ 2022-11-30 10:10 ` Benjamin Tissoires
  2022-11-30 11:19 ` [PATCH 0/2] HID-BPF: Kconfig fix Florent Revest
  2022-12-01 10:08 ` Jon Hunter
  3 siblings, 0 replies; 7+ messages in thread
From: Benjamin Tissoires @ 2022-11-30 10:10 UTC (permalink / raw)
  To: Jiri Kosina, Florent Revest, Jon Hunter
  Cc: linux-input, linux-kernel, Benjamin Tissoires

They are implicit right now but might get defaulted to N in the future,
so force them in the config so we don't get any surprises.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
 tools/testing/selftests/hid/config | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/hid/config b/tools/testing/selftests/hid/config
index d4130489c1b1..e3595b4a3708 100644
--- a/tools/testing/selftests/hid/config
+++ b/tools/testing/selftests/hid/config
@@ -11,8 +11,10 @@ CONFIG_BPF_SYSCALL=y
 CONFIG_BPF=y
 CONFIG_CGROUP_BPF=y
 CONFIG_DEBUG_INFO_BTF=y
+CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS=y
 CONFIG_FPROBE=y
 CONFIG_FTRACE_SYSCALLS=y
+CONFIG_FUNCTION_ERROR_INJECTION=y
 CONFIG_FUNCTION_TRACER=y
 CONFIG_HIDRAW=y
 CONFIG_HID=y
-- 
2.38.1


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

* Re: [PATCH 0/2] HID-BPF: Kconfig fix
  2022-11-30 10:10 [PATCH 0/2] HID-BPF: Kconfig fix Benjamin Tissoires
  2022-11-30 10:10 ` [PATCH 1/2] HID: bpf: enforce HID_BPF dependencies Benjamin Tissoires
  2022-11-30 10:10 ` [PATCH 2/2] selftests: hid: ensures we have the proper requirements in config Benjamin Tissoires
@ 2022-11-30 11:19 ` Florent Revest
  2022-12-01 10:08 ` Jon Hunter
  3 siblings, 0 replies; 7+ messages in thread
From: Florent Revest @ 2022-11-30 11:19 UTC (permalink / raw)
  To: Benjamin Tissoires; +Cc: Jiri Kosina, Jon Hunter, linux-input, linux-kernel

On Wed, Nov 30, 2022 at 11:10 AM Benjamin Tissoires
<benjamin.tissoires@redhat.com> wrote:
>
> Hi,
>
> As discussed in [1], we need to add some more dependencies to HID-BPF in
> the Kconfig. This way, when fmod_ret will be available on arm64, HID-BPF
> will get enabled automatically.
>
> Jon, would you mind giving a shot at that patch on your test system and
> confirm the error disappeard?
>
> Cheers,
> Benjamin
>
>
>
> [1] https://lore.kernel.org/r/CABRcYmKyRchQhabi1Vd9RcMQFCcb=EtWyEbFDFRTc-L-U8WhgA@mail.gmail.com
>
> Benjamin Tissoires (2):
>   HID: bpf: enforce HID_BPF dependencies
>   selftests: hid: ensures we have the proper requirements in config
>
>  drivers/hid/bpf/Kconfig            | 4 +++-
>  tools/testing/selftests/hid/config | 2 ++
>  2 files changed, 5 insertions(+), 1 deletion(-)
>
> --
> 2.38.1

Reviewed-by: Florent Revest <revest@chromium.org>

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

* Re: [PATCH 0/2] HID-BPF: Kconfig fix
  2022-11-30 10:10 [PATCH 0/2] HID-BPF: Kconfig fix Benjamin Tissoires
                   ` (2 preceding siblings ...)
  2022-11-30 11:19 ` [PATCH 0/2] HID-BPF: Kconfig fix Florent Revest
@ 2022-12-01 10:08 ` Jon Hunter
  3 siblings, 0 replies; 7+ messages in thread
From: Jon Hunter @ 2022-12-01 10:08 UTC (permalink / raw)
  To: Benjamin Tissoires, Jiri Kosina, Florent Revest; +Cc: linux-input, linux-kernel

Hi Benjamin,

On 30/11/2022 10:10, Benjamin Tissoires wrote:
> Hi,
> 
> As discussed in [1], we need to add some more dependencies to HID-BPF in
> the Kconfig. This way, when fmod_ret will be available on arm64, HID-BPF
> will get enabled automatically.
> 
> Jon, would you mind giving a shot at that patch on your test system and
> confirm the error disappeard?

Yes will test today. Thanks!

Jon
-- 
nvpublic

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

* Re: [PATCH 1/2] HID: bpf: enforce HID_BPF dependencies
  2022-11-30 10:10 ` [PATCH 1/2] HID: bpf: enforce HID_BPF dependencies Benjamin Tissoires
@ 2022-12-01 13:13   ` Jon Hunter
  2022-12-02  0:40   ` Jiri Kosina
  1 sibling, 0 replies; 7+ messages in thread
From: Jon Hunter @ 2022-12-01 13:13 UTC (permalink / raw)
  To: Benjamin Tissoires, Jiri Kosina, Florent Revest
  Cc: linux-input, linux-kernel, linux-tegra@vger.kernel.org


On 30/11/2022 10:10, Benjamin Tissoires wrote:
> As mentioned in the link below, having JIT and BPF is not enough to
> have fmod_ret and error injection APIs. This resolves the error that
> happens on a system without tracing enabled when hid-bpf tries to
> load itself.
> 
> Link: https://lore.kernel.org/r/CABRcYmKyRchQhabi1Vd9RcMQFCcb=EtWyEbFDFRTc-L-U8WhgA@mail.gmail.com
> Fixes: f5c27da4e3c8 ("HID: initial BPF implementation")
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> ---
>   drivers/hid/bpf/Kconfig | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/bpf/Kconfig b/drivers/hid/bpf/Kconfig
> index 298634fc3335..498232f9faa9 100644
> --- a/drivers/hid/bpf/Kconfig
> +++ b/drivers/hid/bpf/Kconfig
> @@ -4,7 +4,9 @@ menu "HID-BPF support"
>   config HID_BPF
>   	bool "HID-BPF support"
>   	default HID_SUPPORT
> -	depends on BPF && BPF_SYSCALL
> +	depends on BPF && BPF_SYSCALL && \
> +		   DYNAMIC_FTRACE_WITH_DIRECT_CALLS && \
> +		   FUNCTION_ERROR_INJECTION
>   	help
>   	This option allows to support eBPF programs on the HID subsystem.
>   	eBPF programs can fix HID devices in a lighter way than a full


This fixes it for me!

Tested-by: Jon Hunter <jonathanh@nvidia.com>

Thanks!
Jon

-- 
nvpublic

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

* Re: [PATCH 1/2] HID: bpf: enforce HID_BPF dependencies
  2022-11-30 10:10 ` [PATCH 1/2] HID: bpf: enforce HID_BPF dependencies Benjamin Tissoires
  2022-12-01 13:13   ` Jon Hunter
@ 2022-12-02  0:40   ` Jiri Kosina
  1 sibling, 0 replies; 7+ messages in thread
From: Jiri Kosina @ 2022-12-02  0:40 UTC (permalink / raw)
  To: Benjamin Tissoires; +Cc: Florent Revest, Jon Hunter, linux-input, linux-kernel

On Wed, 30 Nov 2022, Benjamin Tissoires wrote:

> As mentioned in the link below, having JIT and BPF is not enough to
> have fmod_ret and error injection APIs. This resolves the error that
> happens on a system without tracing enabled when hid-bpf tries to
> load itself.
> 
> Link: https://lore.kernel.org/r/CABRcYmKyRchQhabi1Vd9RcMQFCcb=EtWyEbFDFRTc-L-U8WhgA@mail.gmail.com
> Fixes: f5c27da4e3c8 ("HID: initial BPF implementation")
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> ---
>  drivers/hid/bpf/Kconfig | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/bpf/Kconfig b/drivers/hid/bpf/Kconfig
> index 298634fc3335..498232f9faa9 100644
> --- a/drivers/hid/bpf/Kconfig
> +++ b/drivers/hid/bpf/Kconfig
> @@ -4,7 +4,9 @@ menu "HID-BPF support"
>  config HID_BPF
>  	bool "HID-BPF support"
>  	default HID_SUPPORT
> -	depends on BPF && BPF_SYSCALL
> +	depends on BPF && BPF_SYSCALL && \
> +		   DYNAMIC_FTRACE_WITH_DIRECT_CALLS && \
> +		   FUNCTION_ERROR_INJECTION

FUNCTION_ERROR_INJECTION is a purely debugging feature, and not something 
we want to have enabled in production kernels (which is where HID-BPF 
should, on the other hand, be enabled). I am afraid this needs to go back 
to the drawing board.

JFTR, to make sure this gets properly discussed before 6.2 merge window 
opens up

	Nacked-by: Jiri Kosina <jkosina@suse.cz>

Which unfortunately means the whole hid-bpf implementation would need to 
be revised and postponed for 6.3 at least.

Sorry,

-- 
Jiri Kosina
SUSE Labs


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

end of thread, other threads:[~2022-12-02  0:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-30 10:10 [PATCH 0/2] HID-BPF: Kconfig fix Benjamin Tissoires
2022-11-30 10:10 ` [PATCH 1/2] HID: bpf: enforce HID_BPF dependencies Benjamin Tissoires
2022-12-01 13:13   ` Jon Hunter
2022-12-02  0:40   ` Jiri Kosina
2022-11-30 10:10 ` [PATCH 2/2] selftests: hid: ensures we have the proper requirements in config Benjamin Tissoires
2022-11-30 11:19 ` [PATCH 0/2] HID-BPF: Kconfig fix Florent Revest
2022-12-01 10:08 ` Jon Hunter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).