Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2352846pxp; Mon, 7 Mar 2022 13:36:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJzP+hmJIaDXwNvbIhtTVLL5QWBMfHXksDx2P1QYwFitY7I1VWH9HqjwkOqImZKzXNk3nZsa X-Received: by 2002:a05:6402:1941:b0:413:2555:53e3 with SMTP id f1-20020a056402194100b00413255553e3mr13126062edz.164.1646688982464; Mon, 07 Mar 2022 13:36:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646688982; cv=none; d=google.com; s=arc-20160816; b=mwhZAWL17LwTlaO1wGHlHqUne93OyQLcC05NmJ6B/b6grf4j8cFs05revl0pQfERyx dfmsnwZQERXOq/b2ubz5G9XlueionRc+8lrSXV1eKY0uDiLy4MuvIQ5aFbPzUJCubBxw oN+GSERidAldn0w6Bq78B4qXe2Reb4kaHr5H6RVxhVHCAh1nziyY3q4jQ8kam6Nti7a4 OLPuGFmQQGZyp7SSFTmDcsz3Gwl02WDydU9ayyNLP9LlYRFsd++B+M7JrX+8Rq2b/NND sexfjZ46IBybEhz/7kLYBkFj3RW9IqYdHNWdhKS0Xyj/kPKXbbBMhj7XlrfxUpM0A2c6 lwBQ== 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=qabPsRxIhiF0scUXtLZldwp+QF6+FtOJ3D5d1Orw9sI=; b=b4jOcB3RRzRbwh4V5vXtu29QXwN1/Okdhn4Dr5Wz1EkBlGBaYA+sX7Uxt/mqPdaZ1S ilUySo5Vc02yHBcdCHueR1Luw0WSlVAvIUXvNduNU0owfyi8rGnSs81/VQTXO+JxPiKp gxTsY8AmctwpeGcplMFSOxLjzAVZihjFjuBWXLSIYzI1yVwTYBTmNGi/eV1JvxAFVfpm Zg9x00KiquMSk4uBIq5cyCIgi8mhfNJuIp3hy+C4Y4pjjWaW/WC9oveF+px9DHrXJW4l QNlHxjw4nzHhEsYjwBb5rZLa11WEN9N/likMNe9Zh2woi+ZVn6dhi4tgO/n8KGOTX2FF XO2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uEGbH611; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w12-20020a05640234cc00b0041663fefc70si1051903edc.22.2022.03.07.13.36.00; Mon, 07 Mar 2022 13:36:22 -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=@kernel.org header.s=k20201202 header.b=uEGbH611; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239769AbiCGSNB (ORCPT + 99 others); Mon, 7 Mar 2022 13:13:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241596AbiCGSM6 (ORCPT ); Mon, 7 Mar 2022 13:12:58 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFA5265813; Mon, 7 Mar 2022 10:12:03 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7B154612D8; Mon, 7 Mar 2022 18:12:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4755C340EF; Mon, 7 Mar 2022 18:12:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646676722; bh=7SnCPkdwsxJGwpkdFqlHuUuDSdeXpOUHPBz01VNaJaE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=uEGbH611keqViMtcvSDFfr04yicHxU+HboFesqdEiydQBak3alHEjkzuKTxpzPGla 3pMmSIxsb3NxypO7rjoFWjjTNLHIX6nmFSkkH4wZXmF7ZB028kTBBdqOJ/rMbHu+X+ BDbhxVhTw8AGyjKAR6vBiPFFfjjzfIMp5ULo9OY1abxANhVz9xryZY0QLs8zNnKN9V g4+k7MheWv5Mt6jQFMEG7lhWbTjj4OG/527rGF+IB1Ll7I+W7w9eaXRQg64lkN748R GXmM4mZyVp82jCm841EXGRBQrdm306+l67gXeZxnBMfLznjcwMshImBfm9vQ0HxsaL +a4fVodNPsHvA== Received: by mail-yb1-f170.google.com with SMTP id l2so13190233ybe.8; Mon, 07 Mar 2022 10:12:02 -0800 (PST) X-Gm-Message-State: AOAM532L66tU+k/9qKud/syfLhoVLo3D3RjqxA5KEFWSCh0nEWYtBDPV knhJ7ETIHq1kHbQhtaJpk204SoJI3BpcfSI+XoQ= X-Received: by 2002:a25:8b81:0:b0:629:17d5:68c1 with SMTP id j1-20020a258b81000000b0062917d568c1mr8199079ybl.449.1646676721862; Mon, 07 Mar 2022 10:12:01 -0800 (PST) MIME-Version: 1.0 References: <20220304172852.274126-1-benjamin.tissoires@redhat.com> In-Reply-To: From: Song Liu Date: Mon, 7 Mar 2022 10:11:51 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH bpf-next v2 00/28] Introduce eBPF support for HID devices To: Benjamin Tissoires Cc: Greg KH , 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 , Tero Kristo , open list , "open list:HID CORE LAYER" , Networking , bpf , linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Sat, Mar 5, 2022 at 2:23 AM Benjamin Tissoires wrote: > > > > > > > The set looks good so far. I will review the rest later. > > > > [...] > > > > A quick note about how we organize these patches. Maybe we can > > merge some of these patches like: > > Just to be sure we are talking about the same thing: you mean squash > the patch together? Right, squash some patches together. > > > > > > bpf: introduce hid program type > > > bpf/hid: add a new attach type to change the report descriptor > > > bpf/hid: add new BPF type to trigger commands from userspace > > I guess the three can merge into one. > > > > > HID: hook up with bpf > > > HID: allow to change the report descriptor from an eBPF program > > > HID: bpf: compute only the required buffer size for the device > > > HID: bpf: only call hid_bpf_raw_event() if a ctx is available > > I haven't read through all of them, but I guess they can probably merge > > as well. > > There are certainly patches that we could squash together (3 and 4 > from this list into the previous ones), but I'd like to keep some sort > of granularity here to not have a patch bomb that gets harder to come > back later. Totally agreed with the granularity of patches. I am not a big fan of patch bombs either. :) I guess the problem I have with the current version is that I don't have a big picture of the design while reading through relatively big patches. A overview with the following information in the cover letter would be really help here: 1. How different types of programs are triggered (IRQ, user input, etc.); 2. What are the operations and/or outcomes of these programs; 3. How would programs of different types (or attach types) interact with each other (via bpf maps? chaining?) 4. What's the new uapi; 5. New helpers and other logistics Sometimes, I find the changes to uapi are the key for me to understand the patches, and I would like to see one or two patches with all the UAPI changes (i.e. bpf_hid_attach_type). However, that may or may not apply to this set due to granularity concerns. Does this make sense? Thanks, Song > > > > > > libbpf: add HID program type and API > > > libbpf: add new attach type BPF_HID_RDESC_FIXUP > > > libbpf: add new attach type BPF_HID_USER_EVENT > > There 3 can merge, and maybe also the one below > > > libbpf: add handling for BPF_F_INSERT_HEAD in HID programs > > Yeah, the libbpf changes are small enough to not really justify > separate patches. > > > > > > samples/bpf: add new hid_mouse example > > > samples/bpf: add a report descriptor fixup > > > samples/bpf: fix bpf_program__attach_hid() api change > > Maybe it makes sense to merge these 3? > > Sure, why not. > > > > > > bpf/hid: add hid_{get|set}_data helpers > > > HID: bpf: implement hid_bpf_get|set_data > > > bpf/hid: add bpf_hid_raw_request helper function > > > HID: add implementation of bpf_hid_raw_request > > We can have 1 or 2 patches for these helpers > > OK, the patches should be self-contained enough. > > > > > > selftests/bpf: add tests for the HID-bpf initial implementation > > > selftests/bpf: add report descriptor fixup tests > > > selftests/bpf: add tests for hid_{get|set}_data helpers > > > selftests/bpf: add test for user call of HID bpf programs > > > selftests/bpf: hid: rely on uhid event to know if a test device is > > > ready > > > selftests/bpf: add tests for bpf_hid_hw_request > > > selftests/bpf: Add a test for BPF_F_INSERT_HEAD > > These selftests could also merge into 1 or 2 patches I guess. > > I'd still like to link them to the granularity of the bpf changes, so > I can refer a selftest change to a specific commit/functionality > added. But that's just my personal taste, and I can be convinced > otherwise. This should give us maybe 4 patches instead of 7. > > > > > I understand rearranging these patches may take quite some effort. > > But I do feel that's a cleaner approach (from someone doesn't know > > much about HID). If you really hate it that way, we can discuss... > > > > No worries. I don't mind iterating on the series. IIRC I already > rewrote it twice from scratch, and that's when the selftests I > introduced in the second rewrite were tremendously helpful :) And > honestly I don't think it'll be too much effort to reorder/squash the > patches given that the v2 is *very* granular. > > Anyway, I prefer having the reviewers happy so we can have a solid > rock API from day 1 than keeping it obscure for everyone and having to > deal with design issues forever. So if it takes 10 or 20 revisions to > have everybody on the same page, that's fine with me (not that I want > to have that many revisions, just that I won't be afraid of the > bikeshedding we might have at some point). > > Cheers, > Benjamin >