Skip to contentSkip to conversation

m68k: Wire up bpf

PATCH In review Geert Uytterhoeven 2 participants 6 messages Oct 21, 2014 – Oct 22, 2014

Subsystems (2)
lore
Share & tools
lore

Geert Uytterhoeven

author maintainer
#0 lore raw

PATCH 1/1 m68k: Wire up bpf

---
 arch/m68k/include/asm/unistd.h      | 2 +-
 arch/m68k/include/uapi/asm/unistd.h | 1 +
 arch/m68k/kernel/syscalltable.S     | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)
arch/m68k/include/asm/unistd.h +1 -1
index 4ef7a54813e6b72d..75e75d7b1702fb64 100644
@@ -4,7 +4,7 @@
 #include <uapi/asm/unistd.h>
 
 
-#define NR_syscalls		354
+#define NR_syscalls		355
 
 #define __ARCH_WANT_OLD_READDIR
 #define __ARCH_WANT_OLD_STAT
arch/m68k/include/uapi/asm/unistd.h +1 -0
index b419c6b7ac3739b1..2c1bec9a14b67da4 100644
@@ -359,5 +359,6 @@
 #define __NR_renameat2		351
 #define __NR_getrandom		352
 #define __NR_memfd_create	353
+#define __NR_bpf		354
 
 #endif /* _UAPI_ASM_M68K_UNISTD_H_ */
arch/m68k/kernel/syscalltable.S +1 -0
index 05b46c2b08b8d8d4..2ca219e184cd16e6 100644
@@ -374,4 +374,5 @@ ENTRY(sys_call_table)
 	.long sys_renameat2
 	.long sys_getrandom
 	.long sys_memfd_create
+	.long sys_bpf
 
Signature · 1 line
1.9.1
#1 lore raw
Quoted 6 lines · Geert Uytterhoeven
---
 arch/m68k/include/asm/unistd.h      | 2 +-
 arch/m68k/include/uapi/asm/unistd.h | 1 +
 arch/m68k/kernel/syscalltable.S     | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

did the tests pass in samples/bpf/test_verifier ?
Thank you for taking care of it.

author maintainer
#3 lore raw

Hi Alexei,

Quoted 10 lines · Alexei Starovoitov
Quoted 6 lines · Geert Uytterhoeven
---
 arch/m68k/include/asm/unistd.h      | 2 +-
 arch/m68k/include/uapi/asm/unistd.h | 1 +
 arch/m68k/kernel/syscalltable.S     | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

did the tests pass in samples/bpf/test_verifier ?

Thanks for reminding me about the existence of the tests ;-)

Yes, they passed.

Note that gcc 4.1.2 doesn't like C99-initialization of anonymous struct and union members, so I had to use the patch below:

include/uapi/linux/bpf.h +3 -3
index d18316f9e9c488b0..6ec5060a6ece8f23 100644
@@ -123,7 +123,7 @@ union bpf_attr {
 		__u32	key_size;	/* size of key in bytes */
 		__u32	value_size;	/* size of value in bytes */
 		__u32	max_entries;	/* max number of entries in a map */
-	};
+	} create;
 
 	struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */
 		__u32		map_fd;
@@ -132,7 +132,7 @@ union bpf_attr {
 			__aligned_u64 value;
 			__aligned_u64 next_key;
 		};
-	};
+	} elem;
 
 	struct { /* anonymous struct used by BPF_PROG_LOAD command */
 		__u32		prog_type;	/* one of enum bpf_prog_type */
@@ -142,7 +142,7 @@ union bpf_attr {
 		__u32		log_level;	/* verbosity level of verifier */
 		__u32		log_size;	/* size of user buffer */
 		__aligned_u64	log_buf;	/* user supplied buffer */
-	};
+	} load;
 } __attribute__((aligned(8)));
 
 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
samples/bpf/libbpf.c +22 -22

83 lines not on this page · raw message

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#4 lore raw
Quoted 12 lines · Geert Uytterhoeven

Hi Alexei,

Quoted 9 lines · Alexei Starovoitov
Quoted 6 lines · Geert Uytterhoeven
---
 arch/m68k/include/asm/unistd.h      | 2 +-
 arch/m68k/include/uapi/asm/unistd.h | 1 +
 arch/m68k/kernel/syscalltable.S     | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)
Quoted 5 lines
Quoted 1 line

did the tests pass in samples/bpf/test_verifier ?

Thanks for reminding me about the existence of the tests ;-)

Yes, they passed.

Great, then:

include/uapi/linux/bpf.h union bpf_attr { · line 126

Quoted 13 lines

Note that gcc 4.1.2 doesn't like C99-initialization of anonymous struct and union members, so I had to use the patch below:

include/uapi/linux/bpf.h +1 -1
index d18316f9e9c488b0..6ec5060a6ece8f23 100644
@@ -123,7 +123,7 @@ union bpf_attr {
                __u32   key_size;       /* size of key in bytes */
                __u32   value_size;     /* size of value in bytes */
                __u32   max_entries;    /* max number of entries in a map */
-       };
+       } create;

I've tested this stuff with 4.2 and up, since that's the oldest we have in kernel.org cross-compilers repo.
4.1 was a first release with brand new C front-end which had all sorts of gotchas and just like 4.0 was a massive release too. Nowadays I wouldn't touch anything below 4.4

#5 lore raw
In reply to Geert Uytterhoeven
Quoted 12 lines · Geert Uytterhoeven

Hi Alexei,

Quoted 9 lines · Alexei Starovoitov
Quoted 6 lines · Geert Uytterhoeven
---
 arch/m68k/include/asm/unistd.h      | 2 +-
 arch/m68k/include/uapi/asm/unistd.h | 1 +
 arch/m68k/kernel/syscalltable.S     | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)
Quoted 5 lines
Quoted 1 line

did the tests pass in samples/bpf/test_verifier ?

Thanks for reminding me about the existence of the tests ;-)

Yes, they passed.

Great, then:

include/uapi/linux/bpf.h union bpf_attr { · line 126

Quoted 13 lines

Note that gcc 4.1.2 doesn't like C99-initialization of anonymous struct and union members, so I had to use the patch below:

include/uapi/linux/bpf.h +1 -1
index d18316f9e9c488b0..6ec5060a6ece8f23 100644
@@ -123,7 +123,7 @@ union bpf_attr {
                __u32   key_size;       /* size of key in bytes */
                __u32   value_size;     /* size of value in bytes */
                __u32   max_entries;    /* max number of entries in a map */
-       };
+       } create;

I've tested this stuff with 4.2 and up, since that's the oldest we have in kernel.org cross-compilers repo.
4.1 was a first release with brand new C front-end which had all sorts of gotchas and just like 4.0 was a massive release too. Nowadays I wouldn't touch anything below 4.4