bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Standardizing BPF assembly language?
@ 2024-01-23 16:45 dthaler1968
  2024-01-23 16:45 ` [Bpf] " dthaler1968=40googlemail.com
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: dthaler1968 @ 2024-01-23 16:45 UTC (permalink / raw)
  To: bpf; +Cc: bpf

At LSF/MM/BPF 2023, Jose gave a presentation about BPF assembly
language (http://vger.kernel.org/bpfconf2023_material/compiled_bpf.txt).

Jose wrote in that link:
> There are two dialects of BPF assembler in use today:
>
> - A "pseudo-c" dialect (originally "BPF verifier format")
>  : r1 = *(u64 *)(r2 + 0x00f0)
>  : if r1 > 2 goto label
>  : lock *(u32 *)(r2 + 10) += r3
>
> - An "assembler-like" dialect
>  : ldxdw %r1, [%r2 + 0x00f0]
>  : jgt %r1, 2, label
>  : xaddw [%r2 + 2], r3

During Jose's talk, I discovered that uBPF didn't quote match the second
dialect
and submitted a bug report.  By the time the conference was over, uBPF had
been updated to match GCC, so that discussion worked to reduce the number of
variants.

As more instructions get added and supported by more tools and compilers
there's the risk of even more variants unless it's standardized.

Hence I'd recommend that BPF assembly language get documented in some WG
draft.  If folks agree with that premise, the first question is then: which
document?
One possible answer would be the ISA document that specifies the
instructions,
since that would the IANA registry could list the assembly for each
instruction,
and any future documents that add instructions would necessarily need to
specify
the assembly for them, preventing variants from springing up for new
instructions.

A second question would be, which dialect(s) to standardize.  Jose's link
above
argues that the second dialect should be the one standardized (tools are
free to
support multiple dialects for backwards compat if they want).  See the link
for
rationale.

Thoughts?

Dave









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

end of thread, other threads:[~2024-01-27  5:29 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-23 16:45 Standardizing BPF assembly language? dthaler1968
2024-01-23 16:45 ` [Bpf] " dthaler1968=40googlemail.com
2024-01-23 21:31 ` David Vernet
2024-01-23 21:31   ` David Vernet
2024-01-23 21:41   ` dthaler1968
2024-01-23 21:41     ` dthaler1968=40googlemail.com
2024-01-23 21:52     ` David Vernet
2024-01-23 21:52       ` David Vernet
2024-01-23 23:15       ` dthaler1968
2024-01-23 23:15         ` dthaler1968=40googlemail.com
2024-01-25  2:51       ` Alexei Starovoitov
2024-01-25  2:51         ` Alexei Starovoitov
2024-01-27  5:29         ` David Vernet
2024-01-27  5:29           ` David Vernet
2024-01-25  3:13 ` Watson Ladd
2024-01-25  3:13   ` Watson Ladd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).