Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp291992imw; Fri, 15 Jul 2022 03:25:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1smUJdR1D0HNRH1t9TVJLXt9X+Cc6zccXpCzOenhB9iDkelYDYfEnBVq9L84Rn/Sfc5gTQF X-Received: by 2002:a65:6bca:0:b0:411:f92b:5e39 with SMTP id e10-20020a656bca000000b00411f92b5e39mr12057895pgw.259.1657880752640; Fri, 15 Jul 2022 03:25:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657880752; cv=none; d=google.com; s=arc-20160816; b=rGcDYkWNBFm1A8Pe56hajFMm/mUPzaYZgodYX6fizq9MCMlHWDEM+8l/XvpIhAX507 +zTbS4AVBVhAb/mimpB1FXNUuPwLmlvmLJE+OKmF6V3YTgUXwco0N+rNmjqmnf5G0YG3 gUfkBr/YSvrh+bYx4uBM2qQ2I5QXlKRWo+iVi/rdcRb0dCE0EiTHtLyNJStXYqsEO/05 P1ianEOcVdnT+HPM9czitHZXd2RjaXhnXUSUm9ovbqdkj38a5wsapPiqxzaGKgCtIlB6 BIwMWnReQ3rSPfho5anuDxNgH98rMr32HiCwXvNY8s3suNKsagFg6UxoanQxBfFtEaWJ Qcrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=8Hrnh4xSI/kevtIOtrai4yHB4Q/NHMbskcGk41P5Ttk=; b=TVYE37PhljTgpa0Pz+0S5G1Ru/mttxQY7rFMPMpumiwtbu8h6H3XGQK39dhgc+zqyP nSjqOpmxXL2Oie0jbdK+IM5WA0d7imH8RB1jv3gUi5aH83xTjXCgWu/nMIwTtOhC8R1c ghnFr9f5+xMaWobEJJ9k/R92QXKzQICQO+JynngWLgnI8jrdFJdsJtuxRC8qJfcT1duH WbkQo7Jg1+VzVtD0ZmEY7R3OCAe4iwcB9UwhgeHppVmHCG4ypdBILCIi08UzvqlF9Ubz hopZ0Jpg3D88NvJbCXJ2bBAnou2avq0aDiG40QGiJVRmW78l7NbBTimR3nMvoJ5zaCbv rvsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MKp0+mwC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y16-20020a17090322d000b001640bf93e63si5238679plg.206.2022.07.15.03.25.37; Fri, 15 Jul 2022 03:25:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MKp0+mwC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232495AbiGOJ5F (ORCPT + 99 others); Fri, 15 Jul 2022 05:57:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232501AbiGOJ5D (ORCPT ); Fri, 15 Jul 2022 05:57:03 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 471F78149E for ; Fri, 15 Jul 2022 02:57:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657879021; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8Hrnh4xSI/kevtIOtrai4yHB4Q/NHMbskcGk41P5Ttk=; b=MKp0+mwCEOXN6K8gmXaAsHrro0ft0z88s4Y5uaKh0g/Lo0ZfC6CQOGkbKp+fomFafSHH4h GvAfY+sRqv3/B96U2CPa6AvpYKDc4clLjaIQzsj2FH9E4I4OUhA8lOrpOQ58LhjlGi6pG2 nbAsOXajvvJWhNOuia2OVmaJwq5UipE= Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-70-eoheucOMPjm3Ky9vMHmlzw-1; Fri, 15 Jul 2022 05:56:59 -0400 X-MC-Unique: eoheucOMPjm3Ky9vMHmlzw-1 Received: by mail-pj1-f69.google.com with SMTP id c18-20020a17090a8d1200b001ef85196fb4so5075156pjo.4 for ; Fri, 15 Jul 2022 02:56:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8Hrnh4xSI/kevtIOtrai4yHB4Q/NHMbskcGk41P5Ttk=; b=RxD9002zlJQCWEf3k83BX7WUenCaxbk8s2Tc3nvLsTqQU3aSX3gcu07JHG+cjHQaIh 0AFYo2UXX3az2YeVfJpriAGgMGIdmxpH+smi2kpd9rpaZC62HpvxWjjpPPvBiZLV9o/a Rq3b6VArhrrgu4FAjnduQVMnkQiYJhVqwLLKbIahTvC38DKOTRBDu7sO8agEcNWxOEMs e8qQQuqqmcRhsjo2te2qex1uchdPxav5MhjGdf0b2yLj8A5Zh1zKo1+zX8/Vh2o2f3gw CNu1LS8ZlgTml634OENQP46YnVyCJidfp24rRH7V/pIzr+SL7jzVB9ZLm2bYv7kacE8u k4gg== X-Gm-Message-State: AJIora/89DqmUgYtgRBwVO1tLCVFsH+un1UrZx/CQ4QtsrNns4H3lfAb kGGLuO6Y/QwFNDjsEJatIEv9N7lw66urBrMNLoHdIL9u24DuNnraPqDV+Gg92oZhTzLsyDfJBkN FwTikgzeWDQJQA/QoeoW59xmh7RVEU98o12UxFPgs X-Received: by 2002:a17:90a:be0c:b0:1ef:accb:23a5 with SMTP id a12-20020a17090abe0c00b001efaccb23a5mr14728445pjs.113.1657879018490; Fri, 15 Jul 2022 02:56:58 -0700 (PDT) X-Received: by 2002:a17:90a:be0c:b0:1ef:accb:23a5 with SMTP id a12-20020a17090abe0c00b001efaccb23a5mr14728406pjs.113.1657879018230; Fri, 15 Jul 2022 02:56:58 -0700 (PDT) MIME-Version: 1.0 References: <20220712145850.599666-1-benjamin.tissoires@redhat.com> <20220712145850.599666-13-benjamin.tissoires@redhat.com> In-Reply-To: From: Benjamin Tissoires Date: Fri, 15 Jul 2022 11:56:46 +0200 Message-ID: Subject: Re: [PATCH bpf-next v6 12/23] HID: initial BPF implementation To: Greg KH Cc: Jiri Kosina , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Shuah Khan , Dave Marchevsky , Joe Stringer , Jonathan Corbet , Tero Kristo , lkml , "open list:HID CORE LAYER" , Networking , bpf , "open list:KERNEL SELFTEST FRAMEWORK" , Linux Doc Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 15, 2022 at 7:02 AM Greg KH 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. Thoughts? Cheers, Benjamin