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>,
Kumar Kartikeya Dwivedi <memxor@gmail.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>,
linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
netdev@vger.kernel.org, bpf@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH bpf-next v7 23/24] HID: bpf: add Surface Dial example
Date: Thu, 28 Jul 2022 17:12:38 +0200 [thread overview]
Message-ID: <YuKnZjtOtHAKVIqX@kroah.com> (raw)
In-Reply-To: <20220721153625.1282007-24-benjamin.tissoires@redhat.com>
On Thu, Jul 21, 2022 at 05:36:24PM +0200, Benjamin Tissoires wrote:
> Add a more complete HID-BPF example.
>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
>
> ---
>
> changes in v7:
> - remove unnecessary __must_check definition
>
> new in v6
>
> fix surface dial
> ---
> samples/bpf/.gitignore | 1 +
> samples/bpf/Makefile | 6 +-
> samples/bpf/hid_surface_dial.bpf.c | 161 ++++++++++++++++++++++
> samples/bpf/hid_surface_dial.c | 212 +++++++++++++++++++++++++++++
> 4 files changed, 379 insertions(+), 1 deletion(-)
> create mode 100644 samples/bpf/hid_surface_dial.bpf.c
> create mode 100644 samples/bpf/hid_surface_dial.c
>
> diff --git a/samples/bpf/.gitignore b/samples/bpf/.gitignore
> index 65440bd618b2..6a1079d3d064 100644
> --- a/samples/bpf/.gitignore
> +++ b/samples/bpf/.gitignore
> @@ -3,6 +3,7 @@ cpustat
> fds_example
> hbm
> hid_mouse
> +hid_surface_dial
> ibumad
> lathist
> lwt_len_hist
> diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
> index a965bbfaca47..5f5aa7b32565 100644
> --- a/samples/bpf/Makefile
> +++ b/samples/bpf/Makefile
> @@ -58,6 +58,7 @@ tprogs-y += xdp_redirect
> tprogs-y += xdp_monitor
>
> tprogs-y += hid_mouse
> +tprogs-y += hid_surface_dial
>
> # Libbpf dependencies
> LIBBPF_SRC = $(TOOLS_PATH)/lib/bpf
> @@ -122,6 +123,7 @@ xdp_monitor-objs := xdp_monitor_user.o $(XDP_SAMPLE)
> xdp_router_ipv4-objs := xdp_router_ipv4_user.o $(XDP_SAMPLE)
>
> hid_mouse-objs := hid_mouse.o
> +hid_surface_dial-objs := hid_surface_dial.o
>
> # Tell kbuild to always build the programs
> always-y := $(tprogs-y)
> @@ -343,6 +345,7 @@ $(obj)/hbm.o: $(src)/hbm.h
> $(obj)/hbm_edt_kern.o: $(src)/hbm.h $(src)/hbm_kern.h
>
> $(obj)/hid_mouse.o: $(obj)/hid_mouse.skel.h
> +$(obj)/hid_surface_dial.o: $(obj)/hid_surface_dial.skel.h
>
> # Override includes for xdp_sample_user.o because $(srctree)/usr/include in
> # TPROGS_CFLAGS causes conflicts
> @@ -429,9 +432,10 @@ $(BPF_SKELS_LINKED): $(BPF_OBJS_LINKED) $(BPFTOOL)
> $(Q)$(BPFTOOL) gen skeleton $(@:.skel.h=.lbpf.o) name $(notdir $(@:.skel.h=)) > $@
>
> # Generate BPF skeletons for non XDP progs
> -OTHER_BPF_SKELS := hid_mouse.skel.h
> +OTHER_BPF_SKELS := hid_mouse.skel.h hid_surface_dial.skel.h
>
> hid_mouse.skel.h-deps := hid_mouse.bpf.o
> +hid_surface_dial.skel.h-deps := hid_surface_dial.bpf.o
>
> OTHER_BPF_SRCS_LINKED := $(patsubst %.skel.h,%.bpf.c, $(OTHER_BPF_SKELS))
> OTHER_BPF_OBJS_LINKED := $(patsubst %.bpf.c,$(obj)/%.bpf.o, $(OTHER_BPF_SRCS_LINKED))
> diff --git a/samples/bpf/hid_surface_dial.bpf.c b/samples/bpf/hid_surface_dial.bpf.c
> new file mode 100644
> index 000000000000..16c821d3decf
> --- /dev/null
> +++ b/samples/bpf/hid_surface_dial.bpf.c
> @@ -0,0 +1,161 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/* Copyright (c) 2022 Benjamin Tissoires
> + */
No hints as to what this, and the other program are doing here in a
comment?
> +
> + while (running)
> + ;
That's burning up a CPU, why not sleep/yield/something to allow the cpu
to not just pound on this variable and allow other things to happen?
thanks,
greg k-h
next prev parent reply other threads:[~2022-07-28 15:12 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-21 15:36 [PATCH bpf-next v7 00/24] Introduce eBPF support for HID devices Benjamin Tissoires
2022-07-21 15:36 ` [PATCH bpf-next v7 01/24] selftests/bpf: fix config for CLS_BPF Benjamin Tissoires
2022-07-21 15:36 ` [PATCH bpf-next v7 02/24] bpf/verifier: allow kfunc to read user provided context Benjamin Tissoires
2022-07-21 20:15 ` Kumar Kartikeya Dwivedi
2022-07-22 8:43 ` Benjamin Tissoires
2022-07-22 8:45 ` [PATCH bpf-next v8 " Benjamin Tissoires
2022-07-22 16:16 ` Alexei Starovoitov
2022-07-25 16:36 ` Benjamin Tissoires
2022-08-24 9:57 ` Benjamin Tissoires
2022-07-21 15:36 ` [PATCH bpf-next v7 03/24] bpf/verifier: do not clear meta in check_mem_size Benjamin Tissoires
2022-07-21 15:36 ` [PATCH bpf-next v7 04/24] selftests/bpf: add test for accessing ctx from syscall program type Benjamin Tissoires
2022-07-21 15:36 ` [PATCH bpf-next v7 05/24] bpf/verifier: allow kfunc to return an allocated mem Benjamin Tissoires
2022-07-21 21:05 ` Kumar Kartikeya Dwivedi
2022-07-21 15:36 ` [PATCH bpf-next v7 06/24] selftests/bpf: Add tests for kfunc returning a memory pointer Benjamin Tissoires
2022-07-21 15:36 ` [PATCH bpf-next v7 07/24] bpf: prepare for more bpf syscall to be used from kernel and user space Benjamin Tissoires
2022-07-21 15:36 ` [PATCH bpf-next v7 08/24] libbpf: add map_get_fd_by_id and map_delete_elem in light skeleton Benjamin Tissoires
2022-07-21 15:36 ` [PATCH bpf-next v7 09/24] HID: core: store the unique system identifier in hid_device Benjamin Tissoires
2022-07-21 15:36 ` [PATCH bpf-next v7 10/24] HID: export hid_report_type to uapi Benjamin Tissoires
2022-07-21 15:36 ` [PATCH bpf-next v7 11/24] HID: convert defines of HID class requests into a proper enum Benjamin Tissoires
2022-07-21 15:36 ` [PATCH bpf-next v7 12/24] HID: Kconfig: split HID support and hid-core compilation Benjamin Tissoires
2022-07-28 14:14 ` Greg KH
2022-07-21 15:36 ` [PATCH bpf-next v7 13/24] HID: initial BPF implementation Benjamin Tissoires
2022-07-28 14:15 ` Greg KH
2022-08-24 9:41 ` Benjamin Tissoires
2022-07-28 14:19 ` Greg KH
2022-08-24 9:48 ` Benjamin Tissoires
2022-07-21 15:36 ` [PATCH bpf-next v7 14/24] selftests/bpf: add tests for the HID-bpf initial implementation Benjamin Tissoires
2022-07-21 15:36 ` [PATCH bpf-next v7 15/24] HID: bpf: allocate data memory for device_event BPF programs Benjamin Tissoires
2022-07-28 15:10 ` Greg KH
2022-07-21 15:36 ` [PATCH bpf-next v7 16/24] selftests/bpf/hid: add test to change the report size Benjamin Tissoires
2022-07-21 15:36 ` [PATCH bpf-next v7 17/24] HID: bpf: introduce hid_hw_request() Benjamin Tissoires
2022-07-28 15:10 ` Greg KH
2022-07-21 15:36 ` [PATCH bpf-next v7 18/24] selftests/bpf: add tests for bpf_hid_hw_request Benjamin Tissoires
2022-07-21 15:36 ` [PATCH bpf-next v7 19/24] HID: bpf: allow to change the report descriptor Benjamin Tissoires
2022-07-28 15:10 ` Greg KH
2022-07-21 15:36 ` [PATCH bpf-next v7 20/24] selftests/bpf: add report descriptor fixup tests Benjamin Tissoires
2022-07-21 15:36 ` [PATCH bpf-next v7 21/24] selftests/bpf: Add a test for BPF_F_INSERT_HEAD Benjamin Tissoires
2022-07-21 15:36 ` [PATCH bpf-next v7 22/24] samples/bpf: add new hid_mouse example Benjamin Tissoires
2022-07-28 15:13 ` Greg KH
2022-07-21 15:36 ` [PATCH bpf-next v7 23/24] HID: bpf: add Surface Dial example Benjamin Tissoires
2022-07-28 15:12 ` Greg KH [this message]
2022-07-21 15:36 ` [PATCH bpf-next v7 24/24] Documentation: add HID-BPF docs Benjamin Tissoires
2022-08-25 2:52 ` Bagas Sanjaya
2022-08-30 13:30 ` Benjamin Tissoires
2022-08-03 7:41 ` [PATCH bpf-next v7 00/24] Introduce eBPF support for HID devices Tero Kristo
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=YuKnZjtOtHAKVIqX@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=memxor@gmail.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).