All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: Jiri Kosina <jikos@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>, Shuah Khan <shuah@kernel.org>,
	Dave Marchevsky <davemarchevsky@fb.com>,
	Joe Stringer <joe@cilium.io>, Jonathan Corbet <corbet@lwn.net>,
	Tero Kristo <tero.kristo@linux.intel.com>,
	lkml <linux-kernel@vger.kernel.org>,
	"open list:HID CORE LAYER" <linux-input@vger.kernel.org>,
	Networking <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
	"open list:KERNEL SELFTEST FRAMEWORK" 
	<linux-kselftest@vger.kernel.org>,
	Linux Doc Mailing List <linux-doc@vger.kernel.org>
Subject: Re: [PATCH bpf-next v6 12/23] HID: initial BPF implementation
Date: Fri, 15 Jul 2022 13:43:49 +0200	[thread overview]
Message-ID: <YtFS9UeLF8ZefT/F@kroah.com> (raw)
In-Reply-To: <CAO-hwJ+d6mNO2L5kZtOC6QVrDy+LZ6ECoY2f83C93GFPKbSx7g@mail.gmail.com>

On Fri, Jul 15, 2022 at 11:56:46AM +0200, Benjamin Tissoires wrote:
> On Fri, Jul 15, 2022 at 7:02 AM Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > On Tue, Jul 12, 2022 at 04:58:39PM +0200, Benjamin Tissoires wrote:
> > > --- /dev/null
> > > +++ b/drivers/hid/bpf/Kconfig
> > > @@ -0,0 +1,19 @@
> > > +# SPDX-License-Identifier: GPL-2.0-only
> > > +menu "HID-BPF support"
> > > +     #depends on x86_64
> > > +
> > > +config HID_BPF
> > > +     bool "HID-BPF support"
> > > +     default y
> >
> > Things are only default y if you can't boot your machine without it.
> > Perhaps just mirror what HID is to start with and do not select HID?
> >
> > > +     depends on BPF && BPF_SYSCALL
> > > +     select HID
> >
> > select is rough, why not depend?
> 
> Let me try to explain this mess, maybe you can give me the piece that
> I am missing:
> 
> The requirements I have (or want) are:
> - HID-BPF should be "part" of HID-core (or something similar of "part"):
>   I intend to have device fixes as part of the regular HID flow, so
> allowing distros to opt out seems a little bit dangerous
> - the HID tree is not as clean as some other trees:
>   drivers/hid/ sees both core elements and leaf drivers
>   transport layers are slightly better, they are in their own
> subdirectories, but some transport layers are everywhere in the kernel
> code or directly in drivers/hid (uhid and hid-logitech-dj for
> instance)
> - HID can be loaded as a module (only ubuntu is using that), and this
> is less and less relevant because of all of the various transport
> layers we have basically prevent a clean unloading of the module
> 
> These made me think that I should have a separate bpf subdir for
> HID-BPF, to keep things separated, which means I can not include
> HID-BPF in hid.ko directly, it goes into a separate driver. And then I
> have a chicken and egg problem:
> - HID-core needs to call functions from HID-BPF (to hook into it)
> - but HID-BPF needs to also call functions from HID-core (for
> accessing HID internals)
> 
> I have solved that situation with struct hid_bpf_ops but it is not the
> cleanest possible way.
> 
> And that's also why I did "select HID", because HID-BPF without HID is
> pointless.
> 
> One last bit I should add. hid-bpf.ko should be allowed to be compiled
> in as a module, but I had issues at boot because kfuncs were not
> getting registered properly (though it works for the net test driver).
> So I decided to make hid-bpf a boolean instead of a tristate.
> 
> As I type all of this, I am starting to wonder if I should not tackle
> the very first point and separate hid-core in its own subdir. This way
> I can have a directory with only the core part, and having hid-bpf in
> here wouldn't be too much of an issue.

We've had this problem with the USB core in the past, and yes, that was
the simplest solution (see drivers/usb/core/)

Otherwise you could do:
	default HID
as the dependancy here, but that might get messy if hid can be a module.

Try splitting the hid core out first, you want to do that anyway and
that should make this simpler as you found out :)

thanks,

greg k-h

  reply	other threads:[~2022-07-15 11:44 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-12 14:58 [PATCH bpf-next v6 00/23] Introduce eBPF support for HID devices Benjamin Tissoires
2022-07-12 14:58 ` [PATCH bpf-next v6 01/23] selftests/bpf: fix config for CLS_BPF Benjamin Tissoires
2022-07-15 23:55   ` Yonghong Song
2022-07-12 14:58 ` [PATCH bpf-next v6 02/23] bpf/verifier: allow kfunc to read user provided context Benjamin Tissoires
2022-07-15 23:56   ` Yonghong Song
2022-07-16 19:47   ` Kumar Kartikeya Dwivedi
2022-07-18 13:53     ` Benjamin Tissoires
2022-07-12 14:58 ` [PATCH bpf-next v6 03/23] bpf/verifier: do not clear meta in check_mem_size Benjamin Tissoires
2022-07-16  0:03   ` Yonghong Song
2022-07-12 14:58 ` [PATCH bpf-next v6 04/23] selftests/bpf: add test for accessing ctx from syscall program type Benjamin Tissoires
2022-07-16  0:17   ` Yonghong Song
2022-07-12 14:58 ` [PATCH bpf-next v6 05/23] bpf/verifier: allow kfunc to return an allocated mem Benjamin Tissoires
2022-07-16  4:29   ` Yonghong Song
2022-07-18 14:36     ` Benjamin Tissoires
2022-07-19 16:05       ` Yonghong Song
2022-07-16 20:32   ` Kumar Kartikeya Dwivedi
2022-07-18 15:28     ` Benjamin Tissoires
2022-07-12 14:58 ` [PATCH bpf-next v6 06/23] selftests/bpf: Add tests for kfunc returning a memory pointer Benjamin Tissoires
2022-07-16  4:33   ` Yonghong Song
2022-07-18  8:42     ` Benjamin Tissoires
2022-07-12 14:58 ` [PATCH bpf-next v6 07/23] bpf: prepare for more bpf syscall to be used from kernel and user space Benjamin Tissoires
2022-07-16  4:37   ` Yonghong Song
2022-07-12 14:58 ` [PATCH bpf-next v6 08/23] libbpf: add map_get_fd_by_id and map_delete_elem in light skeleton Benjamin Tissoires
2022-07-16  4:41   ` Yonghong Song
2022-07-12 14:58 ` [PATCH bpf-next v6 09/23] HID: core: store the unique system identifier in hid_device Benjamin Tissoires
2022-07-15  5:00   ` Greg KH
2022-07-12 14:58 ` [PATCH bpf-next v6 10/23] HID: export hid_report_type to uapi Benjamin Tissoires
2022-07-15  5:00   ` Greg KH
2022-07-12 14:58 ` [PATCH bpf-next v6 11/23] HID: convert defines of HID class requests into a proper enum Benjamin Tissoires
2022-07-15  5:01   ` Greg KH
2022-07-12 14:58 ` [PATCH bpf-next v6 12/23] HID: initial BPF implementation Benjamin Tissoires
2022-07-13  8:48   ` Quentin Monnet
2022-07-13 11:36     ` Benjamin Tissoires
2022-07-14 14:49   ` kernel test robot
2022-07-14 16:42   ` kernel test robot
2022-07-15  9:28     ` Benjamin Tissoires
2022-07-15  9:28       ` Benjamin Tissoires
2022-07-15  5:02   ` Greg KH
2022-07-15  9:56     ` Benjamin Tissoires
2022-07-15 11:43       ` Greg KH [this message]
2022-07-12 14:58 ` [PATCH bpf-next v6 13/23] selftests/bpf: add tests for the HID-bpf initial implementation Benjamin Tissoires
2022-07-12 14:58 ` [PATCH bpf-next v6 14/23] HID: bpf: allocate data memory for device_event BPF programs Benjamin Tissoires
2022-07-12 14:58 ` [PATCH bpf-next v6 15/23] selftests/bpf/hid: add test to change the report size Benjamin Tissoires
2022-07-12 14:58 ` [PATCH bpf-next v6 16/23] HID: bpf: introduce hid_hw_request() Benjamin Tissoires
2022-07-12 14:58 ` [PATCH bpf-next v6 17/23] selftests/bpf: add tests for bpf_hid_hw_request Benjamin Tissoires
2022-07-12 14:58 ` [PATCH bpf-next v6 18/23] HID: bpf: allow to change the report descriptor Benjamin Tissoires
2022-07-12 14:58 ` [PATCH bpf-next v6 19/23] selftests/bpf: add report descriptor fixup tests Benjamin Tissoires
2022-07-12 14:58 ` [PATCH bpf-next v6 20/23] selftests/bpf: Add a test for BPF_F_INSERT_HEAD Benjamin Tissoires
2022-07-12 14:58 ` [PATCH bpf-next v6 21/23] samples/bpf: add new hid_mouse example Benjamin Tissoires
2022-07-13 12:06   ` Dominique Martinet
2022-07-13 12:32     ` Benjamin Tissoires
2022-07-12 14:58 ` [PATCH bpf-next v6 22/23] HID: bpf: add Surface Dial example Benjamin Tissoires
2022-07-12 14:58 ` [PATCH bpf-next v6 23/23] Documentation: add HID-BPF docs Benjamin Tissoires
2022-07-14 21:39 ` [PATCH bpf-next v6 00/23] Introduce eBPF support for HID devices Alexei Starovoitov
2022-07-15 17:34   ` Kumar Kartikeya Dwivedi
  -- strict thread matches above, loose matches on Subject: below --
2022-07-14 18:55 [PATCH bpf-next v6 12/23] HID: initial BPF implementation kernel test robot

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=YtFS9UeLF8ZefT/F@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=benjamin.tissoires@redhat.com \
    --cc=bpf@vger.kernel.org \
    --cc=corbet@lwn.net \
    --cc=daniel@iogearbox.net \
    --cc=davemarchevsky@fb.com \
    --cc=jikos@kernel.org \
    --cc=joe@cilium.io \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.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=netdev@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=songliubraving@fb.com \
    --cc=tero.kristo@linux.intel.com \
    --cc=yhs@fb.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.