Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp575516pxm; Fri, 25 Feb 2022 14:09:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJzR7j84abI+jbIHbzOBK+9tMHTRd0/2AgEak+RmpLK9DfR8C8g5WIjgkSJbtsRBUb+kWGGz X-Received: by 2002:a05:6402:298c:b0:413:2ba0:17a6 with SMTP id eq12-20020a056402298c00b004132ba017a6mr8807893edb.420.1645826969799; Fri, 25 Feb 2022 14:09:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645826969; cv=none; d=google.com; s=arc-20160816; b=e3+cIMbMkRgIacbBIgDxJskQIMOiWO9az0HLnlRcS7vU0zImxSqDEEyNJXHuVqH7/q YwufSqw6z9Y50B19xLg1FDkL6ggPoNdgTWAKmM4smKz2luou2qdoD/mJys2t5hoAXy/Z 0lmf4oPu33WDoaRmvkydKnLDKtXJTVuZ3BUQpNsCARbFtj86HvlXDjVWAWrMmsRVRfY1 RI2iuJ3eurrRErkxuwes+3H2GqrjNo2A34w1YyFsekguod6bPkhezv5f6eJCSKD8/CND 3quEzzG/3RJR3WeYt5Pr0uA+uO+01cUKZuU5o8diS/PBsxlVKzebAD7AFVanJRcE5Eci Prnw== 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=JtNsOA458FeQEet3eOy2MiWL9UbbHGcWhapQcMGFooY=; b=gn4TXICK01kZLUihvlGEgZQ5tHD5G/ZxKDL2ayKJ8qYSLC6YSOObE/QZL63538L+/O NufdtDq35xaipapXaABOBHviDn+Pe9HXlSnZ/srHs5LB4qpVugw2uKsFfMt+rm/YpeNy Na/2/D7oKB2aOvH+jMdv4SNxU+YwCiHiQ52oe58EMiKmh5mMo5ZLxHcDTGfR58qdX8Wm U3NIpQbELSKJhfOfX+DeEl4+oODw4qVQPv1m/bu2RTctNvI37pQPJ04sz2ktkKvaW9GY MgqEqGSs5NLn+EQjsy6UoBVkDWAd5g65fGGj2vSyXMvTGG+DImtImxQUF/21cuhX9jxw YOLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EvriBeJm; 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 y24-20020a1709064b1800b006cfd116b384si2249129eju.707.2022.02.25.14.09.06; Fri, 25 Feb 2022 14:09:29 -0800 (PST) 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=EvriBeJm; 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 S242626AbiBYQHY (ORCPT + 99 others); Fri, 25 Feb 2022 11:07:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242620AbiBYQHU (ORCPT ); Fri, 25 Feb 2022 11:07:20 -0500 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 00F75211320 for ; Fri, 25 Feb 2022 08:06:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645805206; 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=JtNsOA458FeQEet3eOy2MiWL9UbbHGcWhapQcMGFooY=; b=EvriBeJmaKA9toWJMbVMuqAfxqoSfBrtIM4qzuETChFtVohuFJS+6d5EnlEeYoaHr08LXw P8iNNd0z262mnqlm0ljVnGszJsogvmlJHk8lkEMi7IP91a16U3YITDbqlRUkdOa+6psCMA 3Ir7MxKR/xGDNsY3GIl87QQmWwxC5dQ= Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-518-978ktIK7N7iHSodVq-ZZPQ-1; Fri, 25 Feb 2022 11:06:44 -0500 X-MC-Unique: 978ktIK7N7iHSodVq-ZZPQ-1 Received: by mail-pl1-f200.google.com with SMTP id z14-20020a170902ccce00b0014d7a559635so3218500ple.16 for ; Fri, 25 Feb 2022 08:06:44 -0800 (PST) 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=JtNsOA458FeQEet3eOy2MiWL9UbbHGcWhapQcMGFooY=; b=rxcojd5Wwy8Y6Ytw1vv+yzCmyJksLdDDNLELUZA2HZdUOE+QQjDmaYMEQ9q4RBljB/ rxHTRIhYSpNim23uNHUK6EgBgm4eIHK5ltCqHjfP3m4yArgmfjswWwTvOgXvyMif18mI DpRz+Amra1fg6U9yGY02w9VMgIrdw88Xa4c6ejcHo5DUVCwGz2/Noi3ghHzT7yGZYO4Q y8vOzg16BiE1wJrY6CJVjYO/GqKjIdx/HNdgPTsPxYCCfOqNmjj7i0do2C6C5mP/GPls g9MW3O/eDf8+A8LcaVWAiL+0y1Xynq7M+TjHcX/qb97uD7bNLdUImjyuDwf4CCZoH9In u3HQ== X-Gm-Message-State: AOAM530bTQoNC5Jpd529A+15Cz5SuuhF1fIUIEWujRmLlXsLTE1K5SWH GtJ72ArOgMPRw99nawkJYpotFBME0ZEI+ne37wN+0m6yMtE4+haSn46a3fjNoqtGAOX6wjoZpfO Fvjd1OhUL+qD8fCSooc6zbUNplkM4VSzfiEasiNKo X-Received: by 2002:a17:902:9308:b0:14e:def5:e6b5 with SMTP id bc8-20020a170902930800b0014edef5e6b5mr8295942plb.73.1645805203631; Fri, 25 Feb 2022 08:06:43 -0800 (PST) X-Received: by 2002:a17:902:9308:b0:14e:def5:e6b5 with SMTP id bc8-20020a170902930800b0014edef5e6b5mr8295906plb.73.1645805203288; Fri, 25 Feb 2022 08:06:43 -0800 (PST) MIME-Version: 1.0 References: <20220224110828.2168231-1-benjamin.tissoires@redhat.com> In-Reply-To: From: Benjamin Tissoires Date: Fri, 25 Feb 2022 17:06:32 +0100 Message-ID: Subject: Re: [PATCH bpf-next v1 0/6] Introduce eBPF support for HID devices To: Yonghong Song Cc: Greg KH , Jiri Kosina , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , John Fastabend , KP Singh , Shuah Khan , Dave Marchevsky , Joe Stringer , Tero Kristo , lkml , "open list:HID CORE LAYER" , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, Peter Hutterer Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 Thu, Feb 24, 2022 at 6:21 PM Yonghong Song wrote: > > > > On 2/24/22 5:49 AM, Benjamin Tissoires wrote: > > Hi Greg, > > > > Thanks for the quick answer :) > > > > On Thu, Feb 24, 2022 at 12:31 PM Greg KH wrote: > >> > >> On Thu, Feb 24, 2022 at 12:08:22PM +0100, Benjamin Tissoires wrote: > >>> Hi there, > >>> > >>> This series introduces support of eBPF for HID devices. > >>> > >>> I have several use cases where eBPF could be interesting for those > >>> input devices: > >>> > >>> - simple fixup of report descriptor: > >>> > >>> In the HID tree, we have half of the drivers that are "simple" and > >>> that just fix one key or one byte in the report descriptor. > >>> Currently, for users of such devices, the process of fixing them > >>> is long and painful. > >>> With eBPF, we could externalize those fixups in one external repo, > >>> ship various CoRe bpf programs and have those programs loaded at boot > >>> time without having to install a new kernel (and wait 6 months for the > >>> fix to land in the distro kernel) > >> > >> Why would a distro update such an external repo faster than they update > >> the kernel? Many sane distros update their kernel faster than other > >> packages already, how about fixing your distro? :) > > > > Heh, I'm going to try to dodge the incoming rhel bullet :) > > > > It's true that thanks to the work of the stable folks we don't have to > > wait 6 months for a fix to come in. However, I think having a single > > file to drop in a directory would be easier for development/testing > > (and distribution of that file between developers/testers) than > > requiring people to recompile their kernel. > > > > Brain fart: is there any chance we could keep the validated bpf > > programs in the kernel tree? > > Yes, see kernel/bpf/preload/iterators/iterators.bpf.c. Thanks. This is indeed interesting. I am not sure the exact usage of it though :) One thing I wonder too while we are on this topic, is it possible to load a bpf program from the kernel directly, in the same way we can request firmwares? Because if we can do that, in my HID use case we could replace simple drivers with bpf programs entirely and reduce the development cycle to a bare minimum. Cheers, Benjamin > > > > >> > >> I'm all for the idea of using ebpf for HID devices, but now we have to > >> keep track of multiple packages to be in sync here. Is this making > >> things harder overall? > > > > Probably, and this is also maybe opening a can of worms. Vendors will > > be able to say "use that bpf program for my HID device because the > > firmware is bogus". > > > > OTOH, as far as I understand, you can not load a BPF program in the > > kernel that uses GPL-declared functions if your BPF program is not > > GPL. Which means that if firmware vendors want to distribute blobs > > through BPF, either it's GPL and they have to provide the sources, or > > it's not happening. > > > > I am not entirely clear on which plan I want to have for userspace. > > I'd like to have libinput on board, but right now, Peter's stance is > > "not in my garden" (and he has good reasons for it). > > So my initial plan is to cook and hold the bpf programs in hid-tools, > > which is the repo I am using for the regression tests on HID. > > > > I plan on building a systemd intrinsic that would detect the HID > > VID/PID and then load the various BPF programs associated with the > > small fixes. > > Note that everything can not be fixed through eBPF, simply because at > > boot we don't always have the root partition mounted. > [...] >