Re: [PATCH 09/13] libbpf: Add bpf_insn__interpret function

2018-03-12 Thread Jiri Olsa
On Mon, Mar 12, 2018 at 12:44:03PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Mar 12, 2018 at 10:43:09AM +0100, Jiri Olsa escreveu:
> > Adding bpf_insn__interpret function to run ebpf program
> > in user space.
> > 
> > It's 'borrowed' from systemtap code, I still need to figure
> > the proper credits, that will go to the file header in case
> > this would ever go in.
> 
> What is the license? GPL?

yes GPLv2

>  
> > Link: http://lkml.kernel.org/n/tip-qqxsyw6imdisj3dydd6e2...@git.kernel.org
> > Signed-off-by: Jiri Olsa 
> > 
> > +++ b/tools/lib/bpf/Build
> > @@ -1 +1 @@
> > -libbpf-y := libbpf.o bpf.o nlattr.o
> > +libbpf-y := libbpf.o bpf.o nlattr.o interp.o
> > diff --git a/tools/lib/bpf/interp.c b/tools/lib/bpf/interp.c
> > new file mode 100644
> > index ..2ceb6a0836c3
> > --- /dev/null
> > +++ b/tools/lib/bpf/interp.c
> > @@ -0,0 +1,245 @@
> > +#include 
> > +#include 
> > +#include "interp.h"
> > +
> > +u64 bpf_interp__run(struct bpf_interp *interp)
> > +{
> 
> > +
> > +   case BPF_JMP | BPF_EXIT:
> > +   return regs[0];
> > +
> > +   default:
> > +   abort();
> 
> And this should be converted to returning some error that the users can
> tell the user using whatever UI (TUI, etc).

right, I want to get rid of all abort calls, I think there's one more

jirka


Re: [PATCH 09/13] libbpf: Add bpf_insn__interpret function

2018-03-12 Thread Jiri Olsa
On Mon, Mar 12, 2018 at 12:44:03PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Mar 12, 2018 at 10:43:09AM +0100, Jiri Olsa escreveu:
> > Adding bpf_insn__interpret function to run ebpf program
> > in user space.
> > 
> > It's 'borrowed' from systemtap code, I still need to figure
> > the proper credits, that will go to the file header in case
> > this would ever go in.
> 
> What is the license? GPL?

yes GPLv2

>  
> > Link: http://lkml.kernel.org/n/tip-qqxsyw6imdisj3dydd6e2...@git.kernel.org
> > Signed-off-by: Jiri Olsa 
> > 
> > +++ b/tools/lib/bpf/Build
> > @@ -1 +1 @@
> > -libbpf-y := libbpf.o bpf.o nlattr.o
> > +libbpf-y := libbpf.o bpf.o nlattr.o interp.o
> > diff --git a/tools/lib/bpf/interp.c b/tools/lib/bpf/interp.c
> > new file mode 100644
> > index ..2ceb6a0836c3
> > --- /dev/null
> > +++ b/tools/lib/bpf/interp.c
> > @@ -0,0 +1,245 @@
> > +#include 
> > +#include 
> > +#include "interp.h"
> > +
> > +u64 bpf_interp__run(struct bpf_interp *interp)
> > +{
> 
> > +
> > +   case BPF_JMP | BPF_EXIT:
> > +   return regs[0];
> > +
> > +   default:
> > +   abort();
> 
> And this should be converted to returning some error that the users can
> tell the user using whatever UI (TUI, etc).

right, I want to get rid of all abort calls, I think there's one more

jirka


Re: [PATCH 09/13] libbpf: Add bpf_insn__interpret function

2018-03-12 Thread Arnaldo Carvalho de Melo
Em Mon, Mar 12, 2018 at 10:43:09AM +0100, Jiri Olsa escreveu:
> Adding bpf_insn__interpret function to run ebpf program
> in user space.
> 
> It's 'borrowed' from systemtap code, I still need to figure
> the proper credits, that will go to the file header in case
> this would ever go in.

What is the license? GPL?
 
> Link: http://lkml.kernel.org/n/tip-qqxsyw6imdisj3dydd6e2...@git.kernel.org
> Signed-off-by: Jiri Olsa 
> 
> +++ b/tools/lib/bpf/Build
> @@ -1 +1 @@
> -libbpf-y := libbpf.o bpf.o nlattr.o
> +libbpf-y := libbpf.o bpf.o nlattr.o interp.o
> diff --git a/tools/lib/bpf/interp.c b/tools/lib/bpf/interp.c
> new file mode 100644
> index ..2ceb6a0836c3
> --- /dev/null
> +++ b/tools/lib/bpf/interp.c
> @@ -0,0 +1,245 @@
> +#include 
> +#include 
> +#include "interp.h"
> +
> +u64 bpf_interp__run(struct bpf_interp *interp)
> +{

> +
> + case BPF_JMP | BPF_EXIT:
> + return regs[0];
> +
> + default:
> + abort();

And this should be converted to returning some error that the users can
tell the user using whatever UI (TUI, etc).

> + }
> +
> + regs[i->dst_reg] = dr;
> + nowrite:
> + i++;
> + }
> +
> + return 0;
> +}
> -- 
> 2.13.6


Re: [PATCH 09/13] libbpf: Add bpf_insn__interpret function

2018-03-12 Thread Arnaldo Carvalho de Melo
Em Mon, Mar 12, 2018 at 10:43:09AM +0100, Jiri Olsa escreveu:
> Adding bpf_insn__interpret function to run ebpf program
> in user space.
> 
> It's 'borrowed' from systemtap code, I still need to figure
> the proper credits, that will go to the file header in case
> this would ever go in.

What is the license? GPL?
 
> Link: http://lkml.kernel.org/n/tip-qqxsyw6imdisj3dydd6e2...@git.kernel.org
> Signed-off-by: Jiri Olsa 
> 
> +++ b/tools/lib/bpf/Build
> @@ -1 +1 @@
> -libbpf-y := libbpf.o bpf.o nlattr.o
> +libbpf-y := libbpf.o bpf.o nlattr.o interp.o
> diff --git a/tools/lib/bpf/interp.c b/tools/lib/bpf/interp.c
> new file mode 100644
> index ..2ceb6a0836c3
> --- /dev/null
> +++ b/tools/lib/bpf/interp.c
> @@ -0,0 +1,245 @@
> +#include 
> +#include 
> +#include "interp.h"
> +
> +u64 bpf_interp__run(struct bpf_interp *interp)
> +{

> +
> + case BPF_JMP | BPF_EXIT:
> + return regs[0];
> +
> + default:
> + abort();

And this should be converted to returning some error that the users can
tell the user using whatever UI (TUI, etc).

> + }
> +
> + regs[i->dst_reg] = dr;
> + nowrite:
> + i++;
> + }
> +
> + return 0;
> +}
> -- 
> 2.13.6