diff mbox series

[RFC,2/3] riscv: add build infra for JIT compiler

Message ID 20190115083518.10149-3-bjorn.topel@gmail.com
State RFC
Delegated to: BPF Maintainers
Headers show
Series RV64G eBPF JIT | expand

Commit Message

Björn Töpel Jan. 15, 2019, 8:35 a.m. UTC
Signed-off-by: Björn Töpel <bjorn.topel@gmail.com>
---
 arch/riscv/Kconfig            | 1 +
 arch/riscv/Makefile           | 4 ++++
 arch/riscv/net/Makefile       | 5 +++++
 arch/riscv/net/bpf_jit_comp.c | 4 ++++
 4 files changed, 14 insertions(+)
 create mode 100644 arch/riscv/net/Makefile
 create mode 100644 arch/riscv/net/bpf_jit_comp.c

Comments

Christoph Hellwig Jan. 15, 2019, 3:43 p.m. UTC | #1
>  core-y += arch/riscv/kernel/ arch/riscv/mm/
>  
> +ifeq ($(CONFIG_ARCH_RV64I),y)
> +core-y += arch/riscv/net/
> +endif

I think this should be core-$(CONFIG_ARCH_RV64I) to get the same result.
Or even better just core-y given that the Kconfig dependencies should
ensure you can't ever enable CONFIG_BPF_JIT for 32-bit builds.

> new file mode 100644
> index 000000000000..b0b6ac13edf5
> --- /dev/null
> +++ b/arch/riscv/net/Makefile
> @@ -0,0 +1,5 @@
> +#
> +# RISCV networking code
> +#

I don't think this comment adds any value.  In fact it is highly
confusing given that we use bpf for a lot more than networking these
days.

> diff --git a/arch/riscv/net/bpf_jit_comp.c b/arch/riscv/net/bpf_jit_comp.c
> new file mode 100644
> index 000000000000..7e359d3249ee
> --- /dev/null
> +++ b/arch/riscv/net/bpf_jit_comp.c
> @@ -0,0 +1,4 @@
> +struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
> +{
> +	return prog;
> +}

Please don't just add stubs files.  This patch should probably be merged
into the one adding the actual implementation.
Björn Töpel Jan. 15, 2019, 4:09 p.m. UTC | #2
Den tis 15 jan. 2019 kl 16:43 skrev Christoph Hellwig <hch@infradead.org>:
>
> >  core-y += arch/riscv/kernel/ arch/riscv/mm/
> >
> > +ifeq ($(CONFIG_ARCH_RV64I),y)
> > +core-y += arch/riscv/net/
> > +endif
>
> I think this should be core-$(CONFIG_ARCH_RV64I) to get the same result.
> Or even better just core-y given that the Kconfig dependencies should
> ensure you can't ever enable CONFIG_BPF_JIT for 32-bit builds.
>

Good point! I'll address that!

> > new file mode 100644
> > index 000000000000..b0b6ac13edf5
> > --- /dev/null
> > +++ b/arch/riscv/net/Makefile
> > @@ -0,0 +1,5 @@
> > +#
> > +# RISCV networking code
> > +#
>
> I don't think this comment adds any value.  In fact it is highly
> confusing given that we use bpf for a lot more than networking these
> days.
>

Yeah, I agree. I'll remove that.

> > diff --git a/arch/riscv/net/bpf_jit_comp.c b/arch/riscv/net/bpf_jit_comp.c
> > new file mode 100644
> > index 000000000000..7e359d3249ee
> > --- /dev/null
> > +++ b/arch/riscv/net/bpf_jit_comp.c
> > @@ -0,0 +1,4 @@
> > +struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
> > +{
> > +     return prog;
> > +}
>
> Please don't just add stubs files.  This patch should probably be merged
> into the one adding the actual implementation.

Noted! I'll remove that!

Thanks for taking a look, Christoph!


Björn
diff mbox series

Patch

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index f13220904d7c..3edaa5958262 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -50,6 +50,7 @@  config RISCV
 	select GENERIC_IRQ_MULTI_HANDLER
 	select ARCH_HAS_PTE_SPECIAL
 	select HAVE_EFFICIENT_UNALIGNED_ACCESS
+	select HAVE_EBPF_JIT if 64BIT
 
 config MMU
 	def_bool y
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 4b594f2e4f7e..ad487f3c1d7b 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -79,6 +79,10 @@  head-y := arch/riscv/kernel/head.o
 
 core-y += arch/riscv/kernel/ arch/riscv/mm/
 
+ifeq ($(CONFIG_ARCH_RV64I),y)
+core-y += arch/riscv/net/
+endif
+
 libs-y += arch/riscv/lib/
 
 PHONY += vdso_install
diff --git a/arch/riscv/net/Makefile b/arch/riscv/net/Makefile
new file mode 100644
index 000000000000..b0b6ac13edf5
--- /dev/null
+++ b/arch/riscv/net/Makefile
@@ -0,0 +1,5 @@ 
+#
+# RISCV networking code
+#
+
+obj-$(CONFIG_BPF_JIT) += bpf_jit_comp.o
diff --git a/arch/riscv/net/bpf_jit_comp.c b/arch/riscv/net/bpf_jit_comp.c
new file mode 100644
index 000000000000..7e359d3249ee
--- /dev/null
+++ b/arch/riscv/net/bpf_jit_comp.c
@@ -0,0 +1,4 @@ 
+struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
+{
+	return prog;
+}