All of lore.kernel.org
 help / color / mirror / Atom feed
* BPF assembler?
@ 2017-08-31  4:06 Jakub Kicinski
  2017-08-31  4:14 ` Alexei Starovoitov
  0 siblings, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2017-08-31  4:06 UTC (permalink / raw)
  To: xdp-newbies

Hi!

Is there any way to write eBPF programs in some form of an assembly
language?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: BPF assembler?
  2017-08-31  4:06 BPF assembler? Jakub Kicinski
@ 2017-08-31  4:14 ` Alexei Starovoitov
  2017-08-31  4:24   ` Jakub Kicinski
  2017-08-31  4:58   ` David Miller
  0 siblings, 2 replies; 7+ messages in thread
From: Alexei Starovoitov @ 2017-08-31  4:14 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: xdp-newbies

On Wed, Aug 30, 2017 at 9:06 PM, Jakub Kicinski <kubakici@wp.pl> wrote:
> Hi!
>
> Is there any way to write eBPF programs in some form of an assembly
> language?

was Dave's gnu asm upstreamed? I lost the track while away...
llvm assembler is almost there too, but it needs some work.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: BPF assembler?
  2017-08-31  4:14 ` Alexei Starovoitov
@ 2017-08-31  4:24   ` Jakub Kicinski
  2017-08-31  4:58   ` David Miller
  1 sibling, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2017-08-31  4:24 UTC (permalink / raw)
  To: Alexei Starovoitov; +Cc: xdp-newbies

On Wed, 30 Aug 2017 21:14:33 -0700, Alexei Starovoitov wrote:
> On Wed, Aug 30, 2017 at 9:06 PM, Jakub Kicinski <kubakici@wp.pl> wrote:
> > Hi!
> >
> > Is there any way to write eBPF programs in some form of an assembly
> > language?  
> 
> was Dave's gnu asm upstreamed? I lost the track while away...

I'm not sure, I don't see it here:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git

> llvm assembler is almost there too, but it needs some work.

Does it use the "verifier instruction format"?  Is it available
somewhere to look at?

Either way, I would be happy to help finish at least one of them :)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: BPF assembler?
  2017-08-31  4:14 ` Alexei Starovoitov
  2017-08-31  4:24   ` Jakub Kicinski
@ 2017-08-31  4:58   ` David Miller
  1 sibling, 0 replies; 7+ messages in thread
From: David Miller @ 2017-08-31  4:58 UTC (permalink / raw)
  To: alexei.starovoitov; +Cc: kubakici, xdp-newbies

From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Date: Wed, 30 Aug 2017 21:14:33 -0700

> On Wed, Aug 30, 2017 at 9:06 PM, Jakub Kicinski <kubakici@wp.pl> wrote:
>> Hi!
>>
>> Is there any way to write eBPF programs in some form of an assembly
>> language?
> 
> was Dave's gnu asm upstreamed? I lost the track while away...
> llvm assembler is almost there too, but it needs some work.

No, I never was able to move forward on that unfortunately.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: BPF assembler?
  2017-08-31  5:32 ` Y Song
@ 2017-08-31 18:19   ` Zvi Effron
  0 siblings, 0 replies; 7+ messages in thread
From: Zvi Effron @ 2017-08-31 18:19 UTC (permalink / raw)
  To: Y Song; +Cc: Alexei Starovoitov, Jakub Kicinski, xdp-newbies, Yonghong Song

Would this include support for inline eBPF asm in C eBPF programs?
That would be very nice for when new instructions are added to the
kernel that have yet to be given a builtin in clang (such as the new
BPF_END instructions).

--Zvi

On Wed, Aug 30, 2017 at 10:32 PM, Y Song <ys114321@gmail.com> wrote:
> Jakub,
>
> Let me know if you need additional help on this. I think this
> assembler->obj in llvm is the last
> major piece for a complete toolchain for clang/llvm.
>
> Thanks,
>
> Yonghong
>
> On Wed, Aug 30, 2017 at 9:37 PM, Alexei Starovoitov
> <alexei.starovoitov@gmail.com> wrote:
>> On Wed, Aug 30, 2017 at 9:24 PM, Jakub Kicinski <kubakici@wp.pl> wrote:
>>>
>>>> llvm assembler is almost there too, but it needs some work.
>>>
>>> Does it use the "verifier instruction format"?  Is it available
>>> somewhere to look at?
>>
>> yes. you can use verifier instruction format.
>> That was the goal for llvm to be as close as possible to
>> kernel verifier syntax.
>> But, I think, it's fine to deviate if it makes asm code easier to read.
>> What is missing is AsmParser directory in
>> llvm/lib/Target/BPF
>> disassembler, elf tools, codegen are all there.
>> Most of the core backend components are shared in the llvm,
>> so it's only missing text parser.
>> Most backends already have assemblers:
>> ls -d lib/Target/*/AsmParser
>> To make one for BPF requires a lot of copy-paste from others ;)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: BPF assembler?
  2017-08-31  4:37 Alexei Starovoitov
@ 2017-08-31  5:32 ` Y Song
  2017-08-31 18:19   ` Zvi Effron
  0 siblings, 1 reply; 7+ messages in thread
From: Y Song @ 2017-08-31  5:32 UTC (permalink / raw)
  To: Alexei Starovoitov; +Cc: Jakub Kicinski, xdp-newbies, Yonghong Song

Jakub,

Let me know if you need additional help on this. I think this
assembler->obj in llvm is the last
major piece for a complete toolchain for clang/llvm.

Thanks,

Yonghong

On Wed, Aug 30, 2017 at 9:37 PM, Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
> On Wed, Aug 30, 2017 at 9:24 PM, Jakub Kicinski <kubakici@wp.pl> wrote:
>>
>>> llvm assembler is almost there too, but it needs some work.
>>
>> Does it use the "verifier instruction format"?  Is it available
>> somewhere to look at?
>
> yes. you can use verifier instruction format.
> That was the goal for llvm to be as close as possible to
> kernel verifier syntax.
> But, I think, it's fine to deviate if it makes asm code easier to read.
> What is missing is AsmParser directory in
> llvm/lib/Target/BPF
> disassembler, elf tools, codegen are all there.
> Most of the core backend components are shared in the llvm,
> so it's only missing text parser.
> Most backends already have assemblers:
> ls -d lib/Target/*/AsmParser
> To make one for BPF requires a lot of copy-paste from others ;)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: BPF assembler?
@ 2017-08-31  4:37 Alexei Starovoitov
  2017-08-31  5:32 ` Y Song
  0 siblings, 1 reply; 7+ messages in thread
From: Alexei Starovoitov @ 2017-08-31  4:37 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: xdp-newbies, yhs

On Wed, Aug 30, 2017 at 9:24 PM, Jakub Kicinski <kubakici@wp.pl> wrote:
>
>> llvm assembler is almost there too, but it needs some work.
>
> Does it use the "verifier instruction format"?  Is it available
> somewhere to look at?

yes. you can use verifier instruction format.
That was the goal for llvm to be as close as possible to
kernel verifier syntax.
But, I think, it's fine to deviate if it makes asm code easier to read.
What is missing is AsmParser directory in
llvm/lib/Target/BPF
disassembler, elf tools, codegen are all there.
Most of the core backend components are shared in the llvm,
so it's only missing text parser.
Most backends already have assemblers:
ls -d lib/Target/*/AsmParser
To make one for BPF requires a lot of copy-paste from others ;)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-08-31 18:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-31  4:06 BPF assembler? Jakub Kicinski
2017-08-31  4:14 ` Alexei Starovoitov
2017-08-31  4:24   ` Jakub Kicinski
2017-08-31  4:58   ` David Miller
2017-08-31  4:37 Alexei Starovoitov
2017-08-31  5:32 ` Y Song
2017-08-31 18:19   ` Zvi Effron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.