All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florent Revest <revest@chromium.org>
To: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Mark Rutland <mark.rutland@arm.com>,
	KP Singh <kpsingh@kernel.org>, Jon Hunter <jonathanh@nvidia.com>,
	Greg KH <gregkh@linuxfoundation.org>,
	Jiri Kosina <jikos@kernel.org>, Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <shuah@kernel.org>,
	Tero Kristo <tero.kristo@linux.intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"open list:HID CORE LAYER" <linux-input@vger.kernel.org>,
	bpf <bpf@vger.kernel.org>,
	"open list:KERNEL SELFTEST FRAMEWORK" 
	<linux-kselftest@vger.kernel.org>,
	"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
	"linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>
Subject: Re: [PATCH hid v12 03/15] HID: initial BPF implementation
Date: Tue, 29 Nov 2022 19:00:35 +0100	[thread overview]
Message-ID: <CABRcYmKyRchQhabi1Vd9RcMQFCcb=EtWyEbFDFRTc-L-U8WhgA@mail.gmail.com> (raw)
In-Reply-To: <CAO-hwJJGxvrLRGSt7g0T1rYiuCCigVzQ-L6yKLM1-44EpYqmsQ@mail.gmail.com>

On Thu, Nov 24, 2022 at 4:50 PM Benjamin Tissoires
<benjamin.tissoires@redhat.com> wrote:
>
> On Wed, Nov 23, 2022 at 9:14 PM Alexei Starovoitov
> <alexei.starovoitov@gmail.com> wrote:
> >
> > On Wed, Nov 23, 2022 at 6:53 AM Benjamin Tissoires
> > <benjamin.tissoires@redhat.com> wrote:
> > >
> > > Hi Jon,
> > >
> > > On Wed, Nov 23, 2022 at 2:25 PM Jon Hunter <jonathanh@nvidia.com> wrote:
> > > >
> > > > We have a kernel test that checks for new warning and error messages on
> > > > boot and with this change I am now seeing the following error message on
> > > > our Tegra platforms ...
> > > >
> > > >   WARNING KERN hid_bpf: error while preloading HID BPF dispatcher: -13
> > > >
> > > > I have a quick look at the code, but I can't say I am familiar with
> > > > this. So I wanted to ask if a way to fix this or avoid this? I see the
> > > > code returns 0, so one option would be to make this an informational or
> > > > debug print.
> > >
> > > I am not in favor of debug in that case, because I suspect it'll hide
> > > too much when getting a bug report. Informational could do, yes.
> > >
> > > However, before that, I'd like to dig a little bit more on why it is
> > > failing. I thought arm64 now has support of tracing bpf programs, so I
> > > would not expect this to fail.

We have BPF trampolines on arm64 already but no ftrace direct calls
right now. (so trampolines get jitted but don't get called eheh :)) So
indeed BPF tracing programs (fentry/fexit/fmod_ret) do not work on
arm64 at the moment.

> > Unfortunately the patches to add support for such tracing bpf progs got stuck.
> > Florent/Mark can probably share the latest status.

We are working on an implementation of ftrace direct calls that would
fit within the constraints of arm64 and play nice with the other users
of the ftrace call site. Hopefully we have a patch to share in the
next couple of weeks I'd say!

> Oh... I noticed Jon's config was lacking CONFIG_FTRACE. So should I
> also add a depends on CONFIG_FTRACE to enable HID-BPF?

If HID-BPF fundamentally depends on a fmod_ret program being attached
to function, it seems to me that it should depend on both:
    CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS (CONFIG_FTRACE or even
CONFIG_DYNAMIC_FTRACE aren't enough, there can be architectures that
do not support direct calls. here you noticed it on arm64 which
luckily should get fixed someday soon but there could be other
architectures with that issue too)
and
    CONFIG_FUNCTION_ERROR_INJECTION (since [1] error injection needs
to be explicitly opted-in, it's easy to miss it and fail to attach
fmod_ret programs in mysterious ways)

I'm thinking that maybe encoding these two dependencies in the
CONFIG_HID_BPF is leaking too much of the bpf tracing abstraction to
the user. Maybe the BPF Kconfig could provide "proxy" configs like
HAVE_BPF_FENTRY_FEXIT, HAVE_BPF_FMOD_RET (naming is hard) to expose
these dependencies better ?

1: https://lore.kernel.org/lkml/20221121104403.1545f9b5@gandalf.local.home/

  reply	other threads:[~2022-11-29 18:00 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 15:57 [PATCH hid v12 00/15] Introduce eBPF support for HID devices Benjamin Tissoires
2022-11-03 15:57 ` [PATCH hid v12 01/15] HID: fix I2C_HID not selected when I2C_HID_OF_ELAN is Benjamin Tissoires
2022-11-15 15:27   ` Jiri Kosina
2022-11-03 15:57 ` [PATCH hid v12 02/15] HID: Kconfig: split HID support and hid-core compilation Benjamin Tissoires
2022-11-03 15:57 ` [PATCH hid v12 03/15] HID: initial BPF implementation Benjamin Tissoires
2022-11-23 13:25   ` Jon Hunter
2022-11-23 14:48     ` Benjamin Tissoires
2022-11-23 18:47       ` Jon Hunter
2022-11-23 20:13       ` Alexei Starovoitov
2022-11-24 15:50         ` Benjamin Tissoires
2022-11-29 18:00           ` Florent Revest [this message]
2022-11-30  8:49             ` Benjamin Tissoires
2022-11-03 15:57 ` [PATCH hid v12 04/15] selftests: add tests for the HID-bpf initial implementation Benjamin Tissoires
2022-11-03 15:57 ` [PATCH hid v12 05/15] HID: bpf jmp table: simplify the logic of cleaning up programs Benjamin Tissoires
2022-12-12 17:02   ` Benjamin Tissoires
2022-12-12 17:08     ` Jiri Kosina
2022-12-12 17:52     ` Yonghong Song
2022-12-12 18:20       ` Greg KH
2022-12-12 18:39         ` Yonghong Song
2022-12-13  6:28           ` Greg KH
2022-12-13  7:59             ` Benjamin Tissoires
2022-12-13 18:13             ` Yonghong Song
2022-11-03 15:57 ` [PATCH hid v12 06/15] HID: bpf: allocate data memory for device_event BPF programs Benjamin Tissoires
2022-11-03 15:57 ` [PATCH hid v12 07/15] selftests/hid: add test to change the report size Benjamin Tissoires
2022-11-03 15:57 ` [PATCH hid v12 08/15] HID: bpf: introduce hid_hw_request() Benjamin Tissoires
2022-11-03 15:57 ` [PATCH hid v12 09/15] selftests/hid: add tests for bpf_hid_hw_request Benjamin Tissoires
2022-11-03 15:57 ` [PATCH hid v12 10/15] HID: bpf: allow to change the report descriptor Benjamin Tissoires
2022-11-03 15:57 ` [PATCH hid v12 11/15] selftests/hid: add report descriptor fixup tests Benjamin Tissoires
2022-11-03 15:57 ` [PATCH hid v12 12/15] selftests/hid: Add a test for BPF_F_INSERT_HEAD Benjamin Tissoires
2022-11-03 15:57 ` [PATCH hid v12 13/15] samples/hid: add new hid BPF example Benjamin Tissoires
2022-11-03 15:57 ` [PATCH hid v12 14/15] samples/hid: add Surface Dial example Benjamin Tissoires
2022-11-03 15:57 ` [PATCH hid v12 15/15] Documentation: add HID-BPF docs Benjamin Tissoires
2022-11-15 15:32 ` [PATCH hid v12 00/15] Introduce eBPF support for HID devices Jiri Kosina

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='CABRcYmKyRchQhabi1Vd9RcMQFCcb=EtWyEbFDFRTc-L-U8WhgA@mail.gmail.com' \
    --to=revest@chromium.org \
    --cc=alexei.starovoitov@gmail.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=bpf@vger.kernel.org \
    --cc=corbet@lwn.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=jikos@kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=shuah@kernel.org \
    --cc=tero.kristo@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.