Message ID | 20181105203047.15258-1-ps.report@gmx.net (mailing list archive) |
---|---|
State | Rejected, archived |
Delegated to: | Sean Young |
Headers |
Received: from vger.kernel.org ([209.132.180.67]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from <linux-media-owner@vger.kernel.org>) id 1gJlWN-0002rK-33; Mon, 05 Nov 2018 20:30:51 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726340AbeKFFwN (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Tue, 6 Nov 2018 00:52:13 -0500 Received: from mout.gmx.net ([212.227.15.19]:56679 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725910AbeKFFwN (ORCPT <rfc822;linux-media@vger.kernel.org>); Tue, 6 Nov 2018 00:52:13 -0500 Received: from localhost.localdomain ([94.216.45.190]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LkgAG-1flXEJ22VA-00aT4z for <linux-media@vger.kernel.org>; Mon, 05 Nov 2018 21:30:47 +0100 Received: from localhost.localdomain ([94.216.45.190]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LkgAG-1flXEJ22VA-00aT4z for <linux-media@vger.kernel.org>; Mon, 05 Nov 2018 21:30:47 +0100 From: Peter Seiderer <ps.report@gmx.net> To: linux-media@vger.kernel.org Subject: [PATCH v4l-utils] Add missing linux/bpf_common.h Date: Mon, 5 Nov 2018 21:30:47 +0100 Message-Id: <20181105203047.15258-1-ps.report@gmx.net> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:EHsFXcybtgB1pLdVIiZGHp61LVQcw2FZshwuzq7eBHY6G1A+mO+ 57LqncaGI8qOXG+TUo93svz+JYS3OLwyrmz22jVSVlOSEc5PjhFPaplC+v9lPqm7nSblToO GTRH6Bqt5+SSmLUVa/CKqdsVg34NnrlsfBIQr5EEDl89MI9YYJKALmyVkb5yZzsFdYWH1aG KzwrLff+qQ54u1nEBF5DQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V01:K0:l5lpbLDVkwI=:pYFrqNFi6VrEOZQ9c2STkq BBATU/v4A/Lg1rAgtafO4Trh1FmCcph+34NwdTBxJgEv0lepNgKGGnMgl69EJlM28fl+/Z2ef NCnDqKKQPdcG4an6weBDGb8C8MzHpqax/3CJpSgFMvfbpq4JaQEW9UU7BZQHeJGXRahmusVve vD0X1VG98OFpY2SbMhnb5CQIbDPIXGCfaef3Fii7nV2QkFG9beUi/PBQYhKC8r7k1RpXxC5Hx l77jUWo4w9vHmn6+k/B8GL4oJ7a0fe+N7yCS4P58j9lSw6/pXcgNUDvyHNp8nkCBOm4ZP3Pi+ /f2Ao1+DjXe0skNm8DRI/zm/nkLb3V7DuExiABayQ2h5XuheG3pQhv2rmbSVaDaBVvfhn8F0G ifoHk0DTCnPFhfWVMFon4HZqIEDBDA/0p7NahrP97X1z264XkmWrGeH4rqCEXPEkIVbXO/3Pr A6wZFHjVNSJp6jjCKSy+LaIADVk8sgE3dZFcZHYnMo3tKMU5ZlWdvKK7TlMapUFzqgAaxnGry M3x4k7bSq0NmML8FulwRF3LLk55qmSKOw9EDslp51B5uEZeQAgPDLPps7hdWsLvVCcuVUbm/v IrBUwH1yvesDeUKJALQ7ShEQHj3SQjV8Biu8mqAaIlO3HnW2A29/MsHQTIli9CC1jBuedTF9v ZWcoyx2dP1LZchmAMqcbcspzDeXxMHcb/vUk+TGAIRIl8rTJcoRHroimYUVuW4guUktqf1N/a Z8VVTeWWNm92Ay7BdsYe3onPRDsmi9crr/GwoFZE+bacsOW2G5A7ORVPUTQaCiWbzTievcF/L /OFEjtlJsR1uaSBQ0eu2Z+O08fpHQ== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org |
Commit Message
Peter Seiderer
Nov. 5, 2018, 8:30 p.m. UTC
Copy from [1], needed by bpf.h.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/include/uapi/linux/bpf_common.h?h=v4.19
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
include/linux/bpf_common.h | 57 ++++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
create mode 100644 include/linux/bpf_common.h
Comments
On Mon, Nov 05, 2018 at 09:30:47PM +0100, Peter Seiderer wrote: > Copy from [1], needed by bpf.h. > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/include/uapi/linux/bpf_common.h?h=v4.19 So bpf.h does include this file, but we don't use anything from it in v4l-utils. This include file is for the original BPF, which has been around for a long time. So why is this include file missing, i.e. what problem are you trying to solve? Lastely, the file should be included in the sync-with-kernel target so it does not get out of sync -- should it really be necessary to add the file. Sean > > Signed-off-by: Peter Seiderer <ps.report@gmx.net> > --- > include/linux/bpf_common.h | 57 ++++++++++++++++++++++++++++++++++++++ > 1 file changed, 57 insertions(+) > create mode 100644 include/linux/bpf_common.h > > diff --git a/include/linux/bpf_common.h b/include/linux/bpf_common.h > new file mode 100644 > index 00000000..ee97668b > --- /dev/null > +++ b/include/linux/bpf_common.h > @@ -0,0 +1,57 @@ > +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ > +#ifndef _UAPI__LINUX_BPF_COMMON_H__ > +#define _UAPI__LINUX_BPF_COMMON_H__ > + > +/* Instruction classes */ > +#define BPF_CLASS(code) ((code) & 0x07) > +#define BPF_LD 0x00 > +#define BPF_LDX 0x01 > +#define BPF_ST 0x02 > +#define BPF_STX 0x03 > +#define BPF_ALU 0x04 > +#define BPF_JMP 0x05 > +#define BPF_RET 0x06 > +#define BPF_MISC 0x07 > + > +/* ld/ldx fields */ > +#define BPF_SIZE(code) ((code) & 0x18) > +#define BPF_W 0x00 /* 32-bit */ > +#define BPF_H 0x08 /* 16-bit */ > +#define BPF_B 0x10 /* 8-bit */ > +/* eBPF BPF_DW 0x18 64-bit */ > +#define BPF_MODE(code) ((code) & 0xe0) > +#define BPF_IMM 0x00 > +#define BPF_ABS 0x20 > +#define BPF_IND 0x40 > +#define BPF_MEM 0x60 > +#define BPF_LEN 0x80 > +#define BPF_MSH 0xa0 > + > +/* alu/jmp fields */ > +#define BPF_OP(code) ((code) & 0xf0) > +#define BPF_ADD 0x00 > +#define BPF_SUB 0x10 > +#define BPF_MUL 0x20 > +#define BPF_DIV 0x30 > +#define BPF_OR 0x40 > +#define BPF_AND 0x50 > +#define BPF_LSH 0x60 > +#define BPF_RSH 0x70 > +#define BPF_NEG 0x80 > +#define BPF_MOD 0x90 > +#define BPF_XOR 0xa0 > + > +#define BPF_JA 0x00 > +#define BPF_JEQ 0x10 > +#define BPF_JGT 0x20 > +#define BPF_JGE 0x30 > +#define BPF_JSET 0x40 > +#define BPF_SRC(code) ((code) & 0x08) > +#define BPF_K 0x00 > +#define BPF_X 0x08 > + > +#ifndef BPF_MAXINSNS > +#define BPF_MAXINSNS 4096 > +#endif > + > +#endif /* _UAPI__LINUX_BPF_COMMON_H__ */ > -- > 2.19.1
Hello Sean, On Tue, 6 Nov 2018 10:38:56 +0000, Sean Young <sean@mess.org> wrote: > On Mon, Nov 05, 2018 at 09:30:47PM +0100, Peter Seiderer wrote: > > Copy from [1], needed by bpf.h. > > > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/include/uapi/linux/bpf_common.h?h=v4.19 > > So bpf.h does include this file, but we don't use anything from it in > v4l-utils. > Maybe alternative fix is to remove the include (or not if your want the headers to be in sync with the kernel ones, but then they should be complete enough to be used for compile)? > This include file is for the original BPF, which has been around for a > long time. So why is this include file missing, i.e. what problem are you > trying to solve? A buildroot autobuild failure (see [1] for details) with older toolchains not providing this header... > > Lastely, the file should be included in the sync-with-kernel target so > it does not get out of sync -- should it really be necessary to add the > file. O.k, can do it on next patch iteration... Regards, Peter [1] http://lists.busybox.net/pipermail/buildroot/2018-November/234840.html > > > Sean > > > > > Signed-off-by: Peter Seiderer <ps.report@gmx.net> > > --- > > include/linux/bpf_common.h | 57 ++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 57 insertions(+) > > create mode 100644 include/linux/bpf_common.h > > > > diff --git a/include/linux/bpf_common.h b/include/linux/bpf_common.h > > new file mode 100644 > > index 00000000..ee97668b > > --- /dev/null > > +++ b/include/linux/bpf_common.h > > @@ -0,0 +1,57 @@ > > +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ > > +#ifndef _UAPI__LINUX_BPF_COMMON_H__ > > +#define _UAPI__LINUX_BPF_COMMON_H__ > > + > > +/* Instruction classes */ > > +#define BPF_CLASS(code) ((code) & 0x07) > > +#define BPF_LD 0x00 > > +#define BPF_LDX 0x01 > > +#define BPF_ST 0x02 > > +#define BPF_STX 0x03 > > +#define BPF_ALU 0x04 > > +#define BPF_JMP 0x05 > > +#define BPF_RET 0x06 > > +#define BPF_MISC 0x07 > > + > > +/* ld/ldx fields */ > > +#define BPF_SIZE(code) ((code) & 0x18) > > +#define BPF_W 0x00 /* 32-bit */ > > +#define BPF_H 0x08 /* 16-bit */ > > +#define BPF_B 0x10 /* 8-bit */ > > +/* eBPF BPF_DW 0x18 64-bit */ > > +#define BPF_MODE(code) ((code) & 0xe0) > > +#define BPF_IMM 0x00 > > +#define BPF_ABS 0x20 > > +#define BPF_IND 0x40 > > +#define BPF_MEM 0x60 > > +#define BPF_LEN 0x80 > > +#define BPF_MSH 0xa0 > > + > > +/* alu/jmp fields */ > > +#define BPF_OP(code) ((code) & 0xf0) > > +#define BPF_ADD 0x00 > > +#define BPF_SUB 0x10 > > +#define BPF_MUL 0x20 > > +#define BPF_DIV 0x30 > > +#define BPF_OR 0x40 > > +#define BPF_AND 0x50 > > +#define BPF_LSH 0x60 > > +#define BPF_RSH 0x70 > > +#define BPF_NEG 0x80 > > +#define BPF_MOD 0x90 > > +#define BPF_XOR 0xa0 > > + > > +#define BPF_JA 0x00 > > +#define BPF_JEQ 0x10 > > +#define BPF_JGT 0x20 > > +#define BPF_JGE 0x30 > > +#define BPF_JSET 0x40 > > +#define BPF_SRC(code) ((code) & 0x08) > > +#define BPF_K 0x00 > > +#define BPF_X 0x08 > > + > > +#ifndef BPF_MAXINSNS > > +#define BPF_MAXINSNS 4096 > > +#endif > > + > > +#endif /* _UAPI__LINUX_BPF_COMMON_H__ */ > > -- > > 2.19.1
Hi Peter, On Tue, Nov 06, 2018 at 10:43:58PM +0100, Peter Seiderer wrote: > On Tue, 6 Nov 2018 10:38:56 +0000, Sean Young <sean@mess.org> wrote: > > > On Mon, Nov 05, 2018 at 09:30:47PM +0100, Peter Seiderer wrote: > > > Copy from [1], needed by bpf.h. > > > > > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/include/uapi/linux/bpf_common.h?h=v4.19 > > > > So bpf.h does include this file, but we don't use anything from it in > > v4l-utils. > > > > Maybe alternative fix is to remove the include (or not if your want > the headers to be in sync with the kernel ones, but then they should > be complete enough to be used for compile)? > > > This include file is for the original BPF, which has been around for a > > long time. So why is this include file missing, i.e. what problem are you > > trying to solve? > > A buildroot autobuild failure (see [1] for details) with older toolchains > not providing this header... > > > > > Lastely, the file should be included in the sync-with-kernel target so > > it does not get out of sync -- should it really be necessary to add the > > file. > > O.k, can do it on next patch iteration... > > Regards, > Peter > > [1] http://lists.busybox.net/pipermail/buildroot/2018-November/234840.html So here libelf was not detected, hence ir-keytable should have been built without BPF support, but it is still including bpf.h despite it not being used. I've just sent a patch for better support for building without BPF, see here: https://patchwork.linuxtv.org/patch/52841/ Would you mind seeing if that works for you? Thanks, Sean
Hello Sean, On Wed, 7 Nov 2018 12:05:45 +0000, Sean Young <sean@mess.org> wrote: > Hi Peter, > > On Tue, Nov 06, 2018 at 10:43:58PM +0100, Peter Seiderer wrote: > > On Tue, 6 Nov 2018 10:38:56 +0000, Sean Young <sean@mess.org> wrote: > > > > > On Mon, Nov 05, 2018 at 09:30:47PM +0100, Peter Seiderer wrote: > > > > Copy from [1], needed by bpf.h. > > > > > > > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/include/uapi/linux/bpf_common.h?h=v4.19 > > > > > > So bpf.h does include this file, but we don't use anything from it in > > > v4l-utils. > > > > > > > Maybe alternative fix is to remove the include (or not if your want > > the headers to be in sync with the kernel ones, but then they should > > be complete enough to be used for compile)? > > > > > This include file is for the original BPF, which has been around for a > > > long time. So why is this include file missing, i.e. what problem are you > > > trying to solve? > > > > A buildroot autobuild failure (see [1] for details) with older toolchains > > not providing this header... > > > > > > > > Lastely, the file should be included in the sync-with-kernel target so > > > it does not get out of sync -- should it really be necessary to add the > > > file. > > > > O.k, can do it on next patch iteration... > > > > Regards, > > Peter > > > > [1] http://lists.busybox.net/pipermail/buildroot/2018-November/234840.html > > So here libelf was not detected, hence ir-keytable should have been built > without BPF support, but it is still including bpf.h despite it not > being used. > > I've just sent a patch for better support for building without BPF, > see here: > https://patchwork.linuxtv.org/patch/52841/ > > > Would you mind seeing if that works for you? Thanks, works for the buildroot use case (disabling bpf support unconditionally)... The reason to provide copies of the linux kernel headers in v4l-utils is to be independent of old(-er) headers provided by toolchains? If so a copy of bpf_common.h is still needed (and the fallback, for out of linux kernel usage, define for __NR_bpf in bpf.h enhanced for all supported archs)? Regards, Peter > > > Thanks, > > Sean
Hi Peter, On Thu, Nov 08, 2018 at 10:13:38PM +0100, Peter Seiderer wrote: > Thanks, works for the buildroot use case (disabling > bpf support unconditionally)... > > The reason to provide copies of the linux kernel headers in v4l-utils > is to be independent of old(-er) headers provided by toolchains? > > If so a copy of bpf_common.h is still needed (and the fallback, for > out of linux kernel usage, define for __NR_bpf in bpf.h enhanced for > all supported archs)? I have seen this problem on debian 7. Why do we care about compiling on something that ancient? Sean
Hello Sean, On Fri, 9 Nov 2018 12:10:38 +0000, Sean Young <sean@mess.org> wrote: > Hi Peter, > > On Thu, Nov 08, 2018 at 10:13:38PM +0100, Peter Seiderer wrote: > > Thanks, works for the buildroot use case (disabling > > bpf support unconditionally)... > > > > The reason to provide copies of the linux kernel headers in v4l-utils > > is to be independent of old(-er) headers provided by toolchains? > > > > If so a copy of bpf_common.h is still needed (and the fallback, for > > out of linux kernel usage, define for __NR_bpf in bpf.h enhanced for > > all supported archs)? > > I have seen this problem on debian 7. Why do we care about compiling > on something that ancient? It is not about compiling on what system, it is about which toolchain is used (for cross-compile), and the initial failure comes from the buildroot [1] embedded system autobuild tests... Personally I do not care about these toolchains (but the buildroot people think it is worth to do automatic build tests with them) and can live with the disabling of the bpf support.... Regards, Peter [1] https://buildroot.org/ > > > Sean
diff --git a/include/linux/bpf_common.h b/include/linux/bpf_common.h new file mode 100644 index 00000000..ee97668b --- /dev/null +++ b/include/linux/bpf_common.h @@ -0,0 +1,57 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _UAPI__LINUX_BPF_COMMON_H__ +#define _UAPI__LINUX_BPF_COMMON_H__ + +/* Instruction classes */ +#define BPF_CLASS(code) ((code) & 0x07) +#define BPF_LD 0x00 +#define BPF_LDX 0x01 +#define BPF_ST 0x02 +#define BPF_STX 0x03 +#define BPF_ALU 0x04 +#define BPF_JMP 0x05 +#define BPF_RET 0x06 +#define BPF_MISC 0x07 + +/* ld/ldx fields */ +#define BPF_SIZE(code) ((code) & 0x18) +#define BPF_W 0x00 /* 32-bit */ +#define BPF_H 0x08 /* 16-bit */ +#define BPF_B 0x10 /* 8-bit */ +/* eBPF BPF_DW 0x18 64-bit */ +#define BPF_MODE(code) ((code) & 0xe0) +#define BPF_IMM 0x00 +#define BPF_ABS 0x20 +#define BPF_IND 0x40 +#define BPF_MEM 0x60 +#define BPF_LEN 0x80 +#define BPF_MSH 0xa0 + +/* alu/jmp fields */ +#define BPF_OP(code) ((code) & 0xf0) +#define BPF_ADD 0x00 +#define BPF_SUB 0x10 +#define BPF_MUL 0x20 +#define BPF_DIV 0x30 +#define BPF_OR 0x40 +#define BPF_AND 0x50 +#define BPF_LSH 0x60 +#define BPF_RSH 0x70 +#define BPF_NEG 0x80 +#define BPF_MOD 0x90 +#define BPF_XOR 0xa0 + +#define BPF_JA 0x00 +#define BPF_JEQ 0x10 +#define BPF_JGT 0x20 +#define BPF_JGE 0x30 +#define BPF_JSET 0x40 +#define BPF_SRC(code) ((code) & 0x08) +#define BPF_K 0x00 +#define BPF_X 0x08 + +#ifndef BPF_MAXINSNS +#define BPF_MAXINSNS 4096 +#endif + +#endif /* _UAPI__LINUX_BPF_COMMON_H__ */