* [PATCH bpf-next] bpf, doc: add description wrt native/bpf clang target and pointer size
@ 2018-03-19 23:21 Daniel Borkmann
  2018-03-20 22:49 ` Alexei Starovoitov
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Borkmann @ 2018-03-19 23:21 UTC (permalink / raw)
  To: alexei.starovoitov; +Cc: netdev, Daniel Borkmann
As this recently came up on netdev [0], lets add it to the BPF devel doc.
  [0] https://www.spinics.net/lists/netdev/msg489612.html
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
---
 Documentation/bpf/bpf_devel_QA.txt | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff --git a/Documentation/bpf/bpf_devel_QA.txt b/Documentation/bpf/bpf_devel_QA.txt
index 84cbb30..1a0b704 100644
--- a/Documentation/bpf/bpf_devel_QA.txt
+++ b/Documentation/bpf/bpf_devel_QA.txt
@@ -539,6 +539,18 @@ A: Although LLVM IR generation and optimization try to stay architecture
        The clang option "-fno-jump-tables" can be used to disable
        switch table generation.
 
+     - For clang -target bpf, it is guaranteed that pointer or long /
+       unsigned long types will always have a width of 64 bit, no matter
+       whether underlying clang binary or default target (or kernel) is
+       32 bit. However, when native clang target is used, then it will
+       compile these types based on the underlying architecture's conventions,
+       meaning in case of 32 bit architecture, pointer or long / unsigned
+       long types e.g. in BPF context structure will have width of 32 bit
+       while the BPF LLVM back end still operates in 64 bit. The native
+       target is mostly needed in tracing for the case of walking pt_regs
+       or other kernel structures where CPU's register width matters.
+       Otherwise, clang -target bpf is generally recommended.
+
    You should use default target when:
 
      - Your program includes a header file, e.g., ptrace.h, which eventually
-- 
2.9.5
^ permalink raw reply related	[flat|nested] 2+ messages in thread
* Re: [PATCH bpf-next] bpf, doc: add description wrt native/bpf clang target and pointer size
  2018-03-19 23:21 [PATCH bpf-next] bpf, doc: add description wrt native/bpf clang target and pointer size Daniel Borkmann
@ 2018-03-20 22:49 ` Alexei Starovoitov
  0 siblings, 0 replies; 2+ messages in thread
From: Alexei Starovoitov @ 2018-03-20 22:49 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: netdev
On Tue, Mar 20, 2018 at 12:21:15AM +0100, Daniel Borkmann wrote:
> As this recently came up on netdev [0], lets add it to the BPF devel doc.
> 
>   [0] https://www.spinics.net/lists/netdev/msg489612.html
> 
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Appled to bpf-next, thanks Daniel.
^ permalink raw reply	[flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-20 22:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-19 23:21 [PATCH bpf-next] bpf, doc: add description wrt native/bpf clang target and pointer size Daniel Borkmann
2018-03-20 22:49 ` Alexei Starovoitov
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).