162306a36Sopenharmony_ci=================================
262306a36Sopenharmony_ciHOWTO interact with BPF subsystem
362306a36Sopenharmony_ci=================================
462306a36Sopenharmony_ci
562306a36Sopenharmony_ciThis document provides information for the BPF subsystem about various
662306a36Sopenharmony_ciworkflows related to reporting bugs, submitting patches, and queueing
762306a36Sopenharmony_cipatches for stable kernels.
862306a36Sopenharmony_ci
962306a36Sopenharmony_ciFor general information about submitting patches, please refer to
1062306a36Sopenharmony_ciDocumentation/process/submitting-patches.rst. This document only describes
1162306a36Sopenharmony_ciadditional specifics related to BPF.
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci.. contents::
1462306a36Sopenharmony_ci    :local:
1562306a36Sopenharmony_ci    :depth: 2
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ciReporting bugs
1862306a36Sopenharmony_ci==============
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ciQ: How do I report bugs for BPF kernel code?
2162306a36Sopenharmony_ci--------------------------------------------
2262306a36Sopenharmony_ciA: Since all BPF kernel development as well as bpftool and iproute2 BPF
2362306a36Sopenharmony_ciloader development happens through the bpf kernel mailing list,
2462306a36Sopenharmony_ciplease report any found issues around BPF to the following mailing
2562306a36Sopenharmony_cilist:
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci bpf@vger.kernel.org
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ciThis may also include issues related to XDP, BPF tracing, etc.
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ciGiven netdev has a high volume of traffic, please also add the BPF
3262306a36Sopenharmony_cimaintainers to Cc (from kernel ``MAINTAINERS`` file):
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci* Alexei Starovoitov <ast@kernel.org>
3562306a36Sopenharmony_ci* Daniel Borkmann <daniel@iogearbox.net>
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ciIn case a buggy commit has already been identified, make sure to keep
3862306a36Sopenharmony_cithe actual commit authors in Cc as well for the report. They can
3962306a36Sopenharmony_citypically be identified through the kernel's git tree.
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci**Please do NOT report BPF issues to bugzilla.kernel.org since it
4262306a36Sopenharmony_ciis a guarantee that the reported issue will be overlooked.**
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ciSubmitting patches
4562306a36Sopenharmony_ci==================
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ciQ: How do I run BPF CI on my changes before sending them out for review?
4862306a36Sopenharmony_ci------------------------------------------------------------------------
4962306a36Sopenharmony_ciA: BPF CI is GitHub based and hosted at https://github.com/kernel-patches/bpf.
5062306a36Sopenharmony_ciWhile GitHub also provides a CLI that can be used to accomplish the same
5162306a36Sopenharmony_ciresults, here we focus on the UI based workflow.
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ciThe following steps lay out how to start a CI run for your patches:
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci- Create a fork of the aforementioned repository in your own account (one time
5662306a36Sopenharmony_ci  action)
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci- Clone the fork locally, check out a new branch tracking either the bpf-next
5962306a36Sopenharmony_ci  or bpf branch, and apply your to-be-tested patches on top of it
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci- Push the local branch to your fork and create a pull request against
6262306a36Sopenharmony_ci  kernel-patches/bpf's bpf-next_base or bpf_base branch, respectively
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ciShortly after the pull request has been created, the CI workflow will run. Note
6562306a36Sopenharmony_cithat capacity is shared with patches submitted upstream being checked and so
6662306a36Sopenharmony_cidepending on utilization the run can take a while to finish.
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ciNote furthermore that both base branches (bpf-next_base and bpf_base) will be
6962306a36Sopenharmony_ciupdated as patches are pushed to the respective upstream branches they track. As
7062306a36Sopenharmony_cisuch, your patch set will automatically (be attempted to) be rebased as well.
7162306a36Sopenharmony_ciThis behavior can result in a CI run being aborted and restarted with the new
7262306a36Sopenharmony_cibase line.
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ciQ: To which mailing list do I need to submit my BPF patches?
7562306a36Sopenharmony_ci------------------------------------------------------------
7662306a36Sopenharmony_ciA: Please submit your BPF patches to the bpf kernel mailing list:
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci bpf@vger.kernel.org
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ciIn case your patch has changes in various different subsystems (e.g.
8162306a36Sopenharmony_cinetworking, tracing, security, etc), make sure to Cc the related kernel mailing
8262306a36Sopenharmony_cilists and maintainers from there as well, so they are able to review
8362306a36Sopenharmony_cithe changes and provide their Acked-by's to the patches.
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ciQ: Where can I find patches currently under discussion for BPF subsystem?
8662306a36Sopenharmony_ci-------------------------------------------------------------------------
8762306a36Sopenharmony_ciA: All patches that are Cc'ed to netdev are queued for review under netdev
8862306a36Sopenharmony_cipatchwork project:
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ci  https://patchwork.kernel.org/project/netdevbpf/list/
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ciThose patches which target BPF, are assigned to a 'bpf' delegate for
9362306a36Sopenharmony_cifurther processing from BPF maintainers. The current queue with
9462306a36Sopenharmony_cipatches under review can be found at:
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci  https://patchwork.kernel.org/project/netdevbpf/list/?delegate=121173
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ciOnce the patches have been reviewed by the BPF community as a whole
9962306a36Sopenharmony_ciand approved by the BPF maintainers, their status in patchwork will be
10062306a36Sopenharmony_cichanged to 'Accepted' and the submitter will be notified by mail. This
10162306a36Sopenharmony_cimeans that the patches look good from a BPF perspective and have been
10262306a36Sopenharmony_ciapplied to one of the two BPF kernel trees.
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ciIn case feedback from the community requires a respin of the patches,
10562306a36Sopenharmony_citheir status in patchwork will be set to 'Changes Requested', and purged
10662306a36Sopenharmony_cifrom the current review queue. Likewise for cases where patches would
10762306a36Sopenharmony_ciget rejected or are not applicable to the BPF trees (but assigned to
10862306a36Sopenharmony_cithe 'bpf' delegate).
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ciQ: How do the changes make their way into Linux?
11162306a36Sopenharmony_ci------------------------------------------------
11262306a36Sopenharmony_ciA: There are two BPF kernel trees (git repositories). Once patches have
11362306a36Sopenharmony_cibeen accepted by the BPF maintainers, they will be applied to one
11462306a36Sopenharmony_ciof the two BPF trees:
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci * https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git/
11762306a36Sopenharmony_ci * https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ciThe bpf tree itself is for fixes only, whereas bpf-next for features,
12062306a36Sopenharmony_cicleanups or other kind of improvements ("next-like" content). This is
12162306a36Sopenharmony_cianalogous to net and net-next trees for networking. Both bpf and
12262306a36Sopenharmony_cibpf-next will only have a master branch in order to simplify against
12362306a36Sopenharmony_ciwhich branch patches should get rebased to.
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ciAccumulated BPF patches in the bpf tree will regularly get pulled
12662306a36Sopenharmony_ciinto the net kernel tree. Likewise, accumulated BPF patches accepted
12762306a36Sopenharmony_ciinto the bpf-next tree will make their way into net-next tree. net and
12862306a36Sopenharmony_cinet-next are both run by David S. Miller. From there, they will go
12962306a36Sopenharmony_ciinto the kernel mainline tree run by Linus Torvalds. To read up on the
13062306a36Sopenharmony_ciprocess of net and net-next being merged into the mainline tree, see
13162306a36Sopenharmony_cithe documentation on netdev subsystem at
13262306a36Sopenharmony_ciDocumentation/process/maintainer-netdev.rst.
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ciOccasionally, to prevent merge conflicts, we might send pull requests
13762306a36Sopenharmony_cito other trees (e.g. tracing) with a small subset of the patches, but
13862306a36Sopenharmony_cinet and net-next are always the main trees targeted for integration.
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ciThe pull requests will contain a high-level summary of the accumulated
14162306a36Sopenharmony_cipatches and can be searched on netdev kernel mailing list through the
14262306a36Sopenharmony_cifollowing subject lines (``yyyy-mm-dd`` is the date of the pull
14362306a36Sopenharmony_cirequest)::
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ci  pull-request: bpf yyyy-mm-dd
14662306a36Sopenharmony_ci  pull-request: bpf-next yyyy-mm-dd
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ciQ: How do I indicate which tree (bpf vs. bpf-next) my patch should be applied to?
14962306a36Sopenharmony_ci---------------------------------------------------------------------------------
15062306a36Sopenharmony_ci
15162306a36Sopenharmony_ciA: The process is the very same as described in the netdev subsystem
15262306a36Sopenharmony_cidocumentation at Documentation/process/maintainer-netdev.rst,
15362306a36Sopenharmony_ciso please read up on it. The subject line must indicate whether the
15462306a36Sopenharmony_cipatch is a fix or rather "next-like" content in order to let the
15562306a36Sopenharmony_cimaintainers know whether it is targeted at bpf or bpf-next.
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ciFor fixes eventually landing in bpf -> net tree, the subject must
15862306a36Sopenharmony_cilook like::
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci  git format-patch --subject-prefix='PATCH bpf' start..finish
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_ciFor features/improvements/etc that should eventually land in
16362306a36Sopenharmony_cibpf-next -> net-next, the subject must look like::
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_ci  git format-patch --subject-prefix='PATCH bpf-next' start..finish
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ciIf unsure whether the patch or patch series should go into bpf
16862306a36Sopenharmony_cior net directly, or bpf-next or net-next directly, it is not a
16962306a36Sopenharmony_ciproblem either if the subject line says net or net-next as target.
17062306a36Sopenharmony_ciIt is eventually up to the maintainers to do the delegation of
17162306a36Sopenharmony_cithe patches.
17262306a36Sopenharmony_ci
17362306a36Sopenharmony_ciIf it is clear that patches should go into bpf or bpf-next tree,
17462306a36Sopenharmony_ciplease make sure to rebase the patches against those trees in
17562306a36Sopenharmony_ciorder to reduce potential conflicts.
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ciIn case the patch or patch series has to be reworked and sent out
17862306a36Sopenharmony_ciagain in a second or later revision, it is also required to add a
17962306a36Sopenharmony_civersion number (``v2``, ``v3``, ...) into the subject prefix::
18062306a36Sopenharmony_ci
18162306a36Sopenharmony_ci  git format-patch --subject-prefix='PATCH bpf-next v2' start..finish
18262306a36Sopenharmony_ci
18362306a36Sopenharmony_ciWhen changes have been requested to the patch series, always send the
18462306a36Sopenharmony_ciwhole patch series again with the feedback incorporated (never send
18562306a36Sopenharmony_ciindividual diffs on top of the old series).
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ciQ: What does it mean when a patch gets applied to bpf or bpf-next tree?
18862306a36Sopenharmony_ci-----------------------------------------------------------------------
18962306a36Sopenharmony_ciA: It means that the patch looks good for mainline inclusion from
19062306a36Sopenharmony_cia BPF point of view.
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_ciBe aware that this is not a final verdict that the patch will
19362306a36Sopenharmony_ciautomatically get accepted into net or net-next trees eventually:
19462306a36Sopenharmony_ci
19562306a36Sopenharmony_ciOn the bpf kernel mailing list reviews can come in at any point
19662306a36Sopenharmony_ciin time. If discussions around a patch conclude that they cannot
19762306a36Sopenharmony_ciget included as-is, we will either apply a follow-up fix or drop
19862306a36Sopenharmony_cithem from the trees entirely. Therefore, we also reserve to rebase
19962306a36Sopenharmony_cithe trees when deemed necessary. After all, the purpose of the tree
20062306a36Sopenharmony_ciis to:
20162306a36Sopenharmony_ci
20262306a36Sopenharmony_cii) accumulate and stage BPF patches for integration into trees
20362306a36Sopenharmony_ci   like net and net-next, and
20462306a36Sopenharmony_ci
20562306a36Sopenharmony_ciii) run extensive BPF test suite and
20662306a36Sopenharmony_ci    workloads on the patches before they make their way any further.
20762306a36Sopenharmony_ci
20862306a36Sopenharmony_ciOnce the BPF pull request was accepted by David S. Miller, then
20962306a36Sopenharmony_cithe patches end up in net or net-next tree, respectively, and
21062306a36Sopenharmony_cimake their way from there further into mainline. Again, see the
21162306a36Sopenharmony_cidocumentation for netdev subsystem at
21262306a36Sopenharmony_ciDocumentation/process/maintainer-netdev.rst for additional information
21362306a36Sopenharmony_cie.g. on how often they are merged to mainline.
21462306a36Sopenharmony_ci
21562306a36Sopenharmony_ciQ: How long do I need to wait for feedback on my BPF patches?
21662306a36Sopenharmony_ci-------------------------------------------------------------
21762306a36Sopenharmony_ciA: We try to keep the latency low. The usual time to feedback will
21862306a36Sopenharmony_cibe around 2 or 3 business days. It may vary depending on the
21962306a36Sopenharmony_cicomplexity of changes and current patch load.
22062306a36Sopenharmony_ci
22162306a36Sopenharmony_ciQ: How often do you send pull requests to major kernel trees like net or net-next?
22262306a36Sopenharmony_ci----------------------------------------------------------------------------------
22362306a36Sopenharmony_ci
22462306a36Sopenharmony_ciA: Pull requests will be sent out rather often in order to not
22562306a36Sopenharmony_ciaccumulate too many patches in bpf or bpf-next.
22662306a36Sopenharmony_ci
22762306a36Sopenharmony_ciAs a rule of thumb, expect pull requests for each tree regularly
22862306a36Sopenharmony_ciat the end of the week. In some cases pull requests could additionally
22962306a36Sopenharmony_cicome also in the middle of the week depending on the current patch
23062306a36Sopenharmony_ciload or urgency.
23162306a36Sopenharmony_ci
23262306a36Sopenharmony_ciQ: Are patches applied to bpf-next when the merge window is open?
23362306a36Sopenharmony_ci-----------------------------------------------------------------
23462306a36Sopenharmony_ciA: For the time when the merge window is open, bpf-next will not be
23562306a36Sopenharmony_ciprocessed. This is roughly analogous to net-next patch processing,
23662306a36Sopenharmony_ciso feel free to read up on the netdev docs at
23762306a36Sopenharmony_ciDocumentation/process/maintainer-netdev.rst about further details.
23862306a36Sopenharmony_ci
23962306a36Sopenharmony_ciDuring those two weeks of merge window, we might ask you to resend
24062306a36Sopenharmony_ciyour patch series once bpf-next is open again. Once Linus released
24162306a36Sopenharmony_cia ``v*-rc1`` after the merge window, we continue processing of bpf-next.
24262306a36Sopenharmony_ci
24362306a36Sopenharmony_ciFor non-subscribers to kernel mailing lists, there is also a status
24462306a36Sopenharmony_cipage run by David S. Miller on net-next that provides guidance:
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_ci  http://vger.kernel.org/~davem/net-next.html
24762306a36Sopenharmony_ci
24862306a36Sopenharmony_ciQ: Verifier changes and test cases
24962306a36Sopenharmony_ci----------------------------------
25062306a36Sopenharmony_ciQ: I made a BPF verifier change, do I need to add test cases for
25162306a36Sopenharmony_ciBPF kernel selftests_?
25262306a36Sopenharmony_ci
25362306a36Sopenharmony_ciA: If the patch has changes to the behavior of the verifier, then yes,
25462306a36Sopenharmony_ciit is absolutely necessary to add test cases to the BPF kernel
25562306a36Sopenharmony_ciselftests_ suite. If they are not present and we think they are
25662306a36Sopenharmony_cineeded, then we might ask for them before accepting any changes.
25762306a36Sopenharmony_ci
25862306a36Sopenharmony_ciIn particular, test_verifier.c is tracking a high number of BPF test
25962306a36Sopenharmony_cicases, including a lot of corner cases that LLVM BPF back end may
26062306a36Sopenharmony_cigenerate out of the restricted C code. Thus, adding test cases is
26162306a36Sopenharmony_ciabsolutely crucial to make sure future changes do not accidentally
26262306a36Sopenharmony_ciaffect prior use-cases. Thus, treat those test cases as: verifier
26362306a36Sopenharmony_cibehavior that is not tracked in test_verifier.c could potentially
26462306a36Sopenharmony_cibe subject to change.
26562306a36Sopenharmony_ci
26662306a36Sopenharmony_ciQ: samples/bpf preference vs selftests?
26762306a36Sopenharmony_ci---------------------------------------
26862306a36Sopenharmony_ciQ: When should I add code to ``samples/bpf/`` and when to BPF kernel
26962306a36Sopenharmony_ciselftests_?
27062306a36Sopenharmony_ci
27162306a36Sopenharmony_ciA: In general, we prefer additions to BPF kernel selftests_ rather than
27262306a36Sopenharmony_ci``samples/bpf/``. The rationale is very simple: kernel selftests are
27362306a36Sopenharmony_ciregularly run by various bots to test for kernel regressions.
27462306a36Sopenharmony_ci
27562306a36Sopenharmony_ciThe more test cases we add to BPF selftests, the better the coverage
27662306a36Sopenharmony_ciand the less likely it is that those could accidentally break. It is
27762306a36Sopenharmony_cinot that BPF kernel selftests cannot demo how a specific feature can
27862306a36Sopenharmony_cibe used.
27962306a36Sopenharmony_ci
28062306a36Sopenharmony_ciThat said, ``samples/bpf/`` may be a good place for people to get started,
28162306a36Sopenharmony_ciso it might be advisable that simple demos of features could go into
28262306a36Sopenharmony_ci``samples/bpf/``, but advanced functional and corner-case testing rather
28362306a36Sopenharmony_ciinto kernel selftests.
28462306a36Sopenharmony_ci
28562306a36Sopenharmony_ciIf your sample looks like a test case, then go for BPF kernel selftests
28662306a36Sopenharmony_ciinstead!
28762306a36Sopenharmony_ci
28862306a36Sopenharmony_ciQ: When should I add code to the bpftool?
28962306a36Sopenharmony_ci-----------------------------------------
29062306a36Sopenharmony_ciA: The main purpose of bpftool (under tools/bpf/bpftool/) is to provide
29162306a36Sopenharmony_cia central user space tool for debugging and introspection of BPF programs
29262306a36Sopenharmony_ciand maps that are active in the kernel. If UAPI changes related to BPF
29362306a36Sopenharmony_cienable for dumping additional information of programs or maps, then
29462306a36Sopenharmony_cibpftool should be extended as well to support dumping them.
29562306a36Sopenharmony_ci
29662306a36Sopenharmony_ciQ: When should I add code to iproute2's BPF loader?
29762306a36Sopenharmony_ci---------------------------------------------------
29862306a36Sopenharmony_ciA: For UAPI changes related to the XDP or tc layer (e.g. ``cls_bpf``),
29962306a36Sopenharmony_cithe convention is that those control-path related changes are added to
30062306a36Sopenharmony_ciiproute2's BPF loader as well from user space side. This is not only
30162306a36Sopenharmony_ciuseful to have UAPI changes properly designed to be usable, but also
30262306a36Sopenharmony_cito make those changes available to a wider user base of major
30362306a36Sopenharmony_cidownstream distributions.
30462306a36Sopenharmony_ci
30562306a36Sopenharmony_ciQ: Do you accept patches as well for iproute2's BPF loader?
30662306a36Sopenharmony_ci-----------------------------------------------------------
30762306a36Sopenharmony_ciA: Patches for the iproute2's BPF loader have to be sent to:
30862306a36Sopenharmony_ci
30962306a36Sopenharmony_ci  netdev@vger.kernel.org
31062306a36Sopenharmony_ci
31162306a36Sopenharmony_ciWhile those patches are not processed by the BPF kernel maintainers,
31262306a36Sopenharmony_ciplease keep them in Cc as well, so they can be reviewed.
31362306a36Sopenharmony_ci
31462306a36Sopenharmony_ciThe official git repository for iproute2 is run by Stephen Hemminger
31562306a36Sopenharmony_ciand can be found at:
31662306a36Sopenharmony_ci
31762306a36Sopenharmony_ci  https://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git/
31862306a36Sopenharmony_ci
31962306a36Sopenharmony_ciThe patches need to have a subject prefix of '``[PATCH iproute2
32062306a36Sopenharmony_cimaster]``' or '``[PATCH iproute2 net-next]``'. '``master``' or
32162306a36Sopenharmony_ci'``net-next``' describes the target branch where the patch should be
32262306a36Sopenharmony_ciapplied to. Meaning, if kernel changes went into the net-next kernel
32362306a36Sopenharmony_citree, then the related iproute2 changes need to go into the iproute2
32462306a36Sopenharmony_cinet-next branch, otherwise they can be targeted at master branch. The
32562306a36Sopenharmony_ciiproute2 net-next branch will get merged into the master branch after
32662306a36Sopenharmony_cithe current iproute2 version from master has been released.
32762306a36Sopenharmony_ci
32862306a36Sopenharmony_ciLike BPF, the patches end up in patchwork under the netdev project and
32962306a36Sopenharmony_ciare delegated to 'shemminger' for further processing:
33062306a36Sopenharmony_ci
33162306a36Sopenharmony_ci  http://patchwork.ozlabs.org/project/netdev/list/?delegate=389
33262306a36Sopenharmony_ci
33362306a36Sopenharmony_ciQ: What is the minimum requirement before I submit my BPF patches?
33462306a36Sopenharmony_ci------------------------------------------------------------------
33562306a36Sopenharmony_ciA: When submitting patches, always take the time and properly test your
33662306a36Sopenharmony_cipatches *prior* to submission. Never rush them! If maintainers find
33762306a36Sopenharmony_cithat your patches have not been properly tested, it is a good way to
33862306a36Sopenharmony_ciget them grumpy. Testing patch submissions is a hard requirement!
33962306a36Sopenharmony_ci
34062306a36Sopenharmony_ciNote, fixes that go to bpf tree *must* have a ``Fixes:`` tag included.
34162306a36Sopenharmony_ciThe same applies to fixes that target bpf-next, where the affected
34262306a36Sopenharmony_cicommit is in net-next (or in some cases bpf-next). The ``Fixes:`` tag is
34362306a36Sopenharmony_cicrucial in order to identify follow-up commits and tremendously helps
34462306a36Sopenharmony_cifor people having to do backporting, so it is a must have!
34562306a36Sopenharmony_ci
34662306a36Sopenharmony_ciWe also don't accept patches with an empty commit message. Take your
34762306a36Sopenharmony_citime and properly write up a high quality commit message, it is
34862306a36Sopenharmony_ciessential!
34962306a36Sopenharmony_ci
35062306a36Sopenharmony_ciThink about it this way: other developers looking at your code a month
35162306a36Sopenharmony_cifrom now need to understand *why* a certain change has been done that
35262306a36Sopenharmony_ciway, and whether there have been flaws in the analysis or assumptions
35362306a36Sopenharmony_cithat the original author did. Thus providing a proper rationale and
35462306a36Sopenharmony_cidescribing the use-case for the changes is a must.
35562306a36Sopenharmony_ci
35662306a36Sopenharmony_ciPatch submissions with >1 patch must have a cover letter which includes
35762306a36Sopenharmony_cia high level description of the series. This high level summary will
35862306a36Sopenharmony_cithen be placed into the merge commit by the BPF maintainers such that
35962306a36Sopenharmony_ciit is also accessible from the git log for future reference.
36062306a36Sopenharmony_ci
36162306a36Sopenharmony_ciQ: Features changing BPF JIT and/or LLVM
36262306a36Sopenharmony_ci----------------------------------------
36362306a36Sopenharmony_ciQ: What do I need to consider when adding a new instruction or feature
36462306a36Sopenharmony_cithat would require BPF JIT and/or LLVM integration as well?
36562306a36Sopenharmony_ci
36662306a36Sopenharmony_ciA: We try hard to keep all BPF JITs up to date such that the same user
36762306a36Sopenharmony_ciexperience can be guaranteed when running BPF programs on different
36862306a36Sopenharmony_ciarchitectures without having the program punt to the less efficient
36962306a36Sopenharmony_ciinterpreter in case the in-kernel BPF JIT is enabled.
37062306a36Sopenharmony_ci
37162306a36Sopenharmony_ciIf you are unable to implement or test the required JIT changes for
37262306a36Sopenharmony_cicertain architectures, please work together with the related BPF JIT
37362306a36Sopenharmony_cidevelopers in order to get the feature implemented in a timely manner.
37462306a36Sopenharmony_ciPlease refer to the git log (``arch/*/net/``) to locate the necessary
37562306a36Sopenharmony_cipeople for helping out.
37662306a36Sopenharmony_ci
37762306a36Sopenharmony_ciAlso always make sure to add BPF test cases (e.g. test_bpf.c and
37862306a36Sopenharmony_citest_verifier.c) for new instructions, so that they can receive
37962306a36Sopenharmony_cibroad test coverage and help run-time testing the various BPF JITs.
38062306a36Sopenharmony_ci
38162306a36Sopenharmony_ciIn case of new BPF instructions, once the changes have been accepted
38262306a36Sopenharmony_ciinto the Linux kernel, please implement support into LLVM's BPF back
38362306a36Sopenharmony_ciend. See LLVM_ section below for further information.
38462306a36Sopenharmony_ci
38562306a36Sopenharmony_ciStable submission
38662306a36Sopenharmony_ci=================
38762306a36Sopenharmony_ci
38862306a36Sopenharmony_ciQ: I need a specific BPF commit in stable kernels. What should I do?
38962306a36Sopenharmony_ci--------------------------------------------------------------------
39062306a36Sopenharmony_ciA: In case you need a specific fix in stable kernels, first check whether
39162306a36Sopenharmony_cithe commit has already been applied in the related ``linux-*.y`` branches:
39262306a36Sopenharmony_ci
39362306a36Sopenharmony_ci  https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/
39462306a36Sopenharmony_ci
39562306a36Sopenharmony_ciIf not the case, then drop an email to the BPF maintainers with the
39662306a36Sopenharmony_cinetdev kernel mailing list in Cc and ask for the fix to be queued up:
39762306a36Sopenharmony_ci
39862306a36Sopenharmony_ci  netdev@vger.kernel.org
39962306a36Sopenharmony_ci
40062306a36Sopenharmony_ciThe process in general is the same as on netdev itself, see also the
40162306a36Sopenharmony_cithe documentation on networking subsystem at
40262306a36Sopenharmony_ciDocumentation/process/maintainer-netdev.rst.
40362306a36Sopenharmony_ci
40462306a36Sopenharmony_ciQ: Do you also backport to kernels not currently maintained as stable?
40562306a36Sopenharmony_ci----------------------------------------------------------------------
40662306a36Sopenharmony_ciA: No. If you need a specific BPF commit in kernels that are currently not
40762306a36Sopenharmony_cimaintained by the stable maintainers, then you are on your own.
40862306a36Sopenharmony_ci
40962306a36Sopenharmony_ciThe current stable and longterm stable kernels are all listed here:
41062306a36Sopenharmony_ci
41162306a36Sopenharmony_ci  https://www.kernel.org/
41262306a36Sopenharmony_ci
41362306a36Sopenharmony_ciQ: The BPF patch I am about to submit needs to go to stable as well
41462306a36Sopenharmony_ci-------------------------------------------------------------------
41562306a36Sopenharmony_ciWhat should I do?
41662306a36Sopenharmony_ci
41762306a36Sopenharmony_ciA: The same rules apply as with netdev patch submissions in general, see
41862306a36Sopenharmony_cithe netdev docs at Documentation/process/maintainer-netdev.rst.
41962306a36Sopenharmony_ci
42062306a36Sopenharmony_ciNever add "``Cc: stable@vger.kernel.org``" to the patch description, but
42162306a36Sopenharmony_ciask the BPF maintainers to queue the patches instead. This can be done
42262306a36Sopenharmony_ciwith a note, for example, under the ``---`` part of the patch which does
42362306a36Sopenharmony_cinot go into the git log. Alternatively, this can be done as a simple
42462306a36Sopenharmony_cirequest by mail instead.
42562306a36Sopenharmony_ci
42662306a36Sopenharmony_ciQ: Queue stable patches
42762306a36Sopenharmony_ci-----------------------
42862306a36Sopenharmony_ciQ: Where do I find currently queued BPF patches that will be submitted
42962306a36Sopenharmony_cito stable?
43062306a36Sopenharmony_ci
43162306a36Sopenharmony_ciA: Once patches that fix critical bugs got applied into the bpf tree, they
43262306a36Sopenharmony_ciare queued up for stable submission under:
43362306a36Sopenharmony_ci
43462306a36Sopenharmony_ci  http://patchwork.ozlabs.org/bundle/bpf/stable/?state=*
43562306a36Sopenharmony_ci
43662306a36Sopenharmony_ciThey will be on hold there at minimum until the related commit made its
43762306a36Sopenharmony_ciway into the mainline kernel tree.
43862306a36Sopenharmony_ci
43962306a36Sopenharmony_ciAfter having been under broader exposure, the queued patches will be
44062306a36Sopenharmony_cisubmitted by the BPF maintainers to the stable maintainers.
44162306a36Sopenharmony_ci
44262306a36Sopenharmony_ciTesting patches
44362306a36Sopenharmony_ci===============
44462306a36Sopenharmony_ci
44562306a36Sopenharmony_ciQ: How to run BPF selftests
44662306a36Sopenharmony_ci---------------------------
44762306a36Sopenharmony_ciA: After you have booted into the newly compiled kernel, navigate to
44862306a36Sopenharmony_cithe BPF selftests_ suite in order to test BPF functionality (current
44962306a36Sopenharmony_ciworking directory points to the root of the cloned git tree)::
45062306a36Sopenharmony_ci
45162306a36Sopenharmony_ci  $ cd tools/testing/selftests/bpf/
45262306a36Sopenharmony_ci  $ make
45362306a36Sopenharmony_ci
45462306a36Sopenharmony_ciTo run the verifier tests::
45562306a36Sopenharmony_ci
45662306a36Sopenharmony_ci  $ sudo ./test_verifier
45762306a36Sopenharmony_ci
45862306a36Sopenharmony_ciThe verifier tests print out all the current checks being
45962306a36Sopenharmony_ciperformed. The summary at the end of running all tests will dump
46062306a36Sopenharmony_ciinformation of test successes and failures::
46162306a36Sopenharmony_ci
46262306a36Sopenharmony_ci  Summary: 418 PASSED, 0 FAILED
46362306a36Sopenharmony_ci
46462306a36Sopenharmony_ciIn order to run through all BPF selftests, the following command is
46562306a36Sopenharmony_cineeded::
46662306a36Sopenharmony_ci
46762306a36Sopenharmony_ci  $ sudo make run_tests
46862306a36Sopenharmony_ci
46962306a36Sopenharmony_ciSee :doc:`kernel selftest documentation </dev-tools/kselftest>`
47062306a36Sopenharmony_cifor details.
47162306a36Sopenharmony_ci
47262306a36Sopenharmony_ciTo maximize the number of tests passing, the .config of the kernel
47362306a36Sopenharmony_ciunder test should match the config file fragment in
47462306a36Sopenharmony_citools/testing/selftests/bpf as closely as possible.
47562306a36Sopenharmony_ci
47662306a36Sopenharmony_ciFinally to ensure support for latest BPF Type Format features -
47762306a36Sopenharmony_cidiscussed in Documentation/bpf/btf.rst - pahole version 1.16
47862306a36Sopenharmony_ciis required for kernels built with CONFIG_DEBUG_INFO_BTF=y.
47962306a36Sopenharmony_cipahole is delivered in the dwarves package or can be built
48062306a36Sopenharmony_cifrom source at
48162306a36Sopenharmony_ci
48262306a36Sopenharmony_cihttps://github.com/acmel/dwarves
48362306a36Sopenharmony_ci
48462306a36Sopenharmony_cipahole starts to use libbpf definitions and APIs since v1.13 after the
48562306a36Sopenharmony_cicommit 21507cd3e97b ("pahole: add libbpf as submodule under lib/bpf").
48662306a36Sopenharmony_ciIt works well with the git repository because the libbpf submodule will
48762306a36Sopenharmony_ciuse "git submodule update --init --recursive" to update.
48862306a36Sopenharmony_ci
48962306a36Sopenharmony_ciUnfortunately, the default github release source code does not contain
49062306a36Sopenharmony_cilibbpf submodule source code and this will cause build issues, the tarball
49162306a36Sopenharmony_cifrom https://git.kernel.org/pub/scm/devel/pahole/pahole.git/ is same with
49262306a36Sopenharmony_cigithub, you can get the source tarball with corresponding libbpf submodule
49362306a36Sopenharmony_cicodes from
49462306a36Sopenharmony_ci
49562306a36Sopenharmony_cihttps://fedorapeople.org/~acme/dwarves
49662306a36Sopenharmony_ci
49762306a36Sopenharmony_ciSome distros have pahole version 1.16 packaged already, e.g.
49862306a36Sopenharmony_ciFedora, Gentoo.
49962306a36Sopenharmony_ci
50062306a36Sopenharmony_ciQ: Which BPF kernel selftests version should I run my kernel against?
50162306a36Sopenharmony_ci---------------------------------------------------------------------
50262306a36Sopenharmony_ciA: If you run a kernel ``xyz``, then always run the BPF kernel selftests
50362306a36Sopenharmony_cifrom that kernel ``xyz`` as well. Do not expect that the BPF selftest
50462306a36Sopenharmony_cifrom the latest mainline tree will pass all the time.
50562306a36Sopenharmony_ci
50662306a36Sopenharmony_ciIn particular, test_bpf.c and test_verifier.c have a large number of
50762306a36Sopenharmony_citest cases and are constantly updated with new BPF test sequences, or
50862306a36Sopenharmony_ciexisting ones are adapted to verifier changes e.g. due to verifier
50962306a36Sopenharmony_cibecoming smarter and being able to better track certain things.
51062306a36Sopenharmony_ci
51162306a36Sopenharmony_ciLLVM
51262306a36Sopenharmony_ci====
51362306a36Sopenharmony_ci
51462306a36Sopenharmony_ciQ: Where do I find LLVM with BPF support?
51562306a36Sopenharmony_ci-----------------------------------------
51662306a36Sopenharmony_ciA: The BPF back end for LLVM is upstream in LLVM since version 3.7.1.
51762306a36Sopenharmony_ci
51862306a36Sopenharmony_ciAll major distributions these days ship LLVM with BPF back end enabled,
51962306a36Sopenharmony_ciso for the majority of use-cases it is not required to compile LLVM by
52062306a36Sopenharmony_cihand anymore, just install the distribution provided package.
52162306a36Sopenharmony_ci
52262306a36Sopenharmony_ciLLVM's static compiler lists the supported targets through
52362306a36Sopenharmony_ci``llc --version``, make sure BPF targets are listed. Example::
52462306a36Sopenharmony_ci
52562306a36Sopenharmony_ci     $ llc --version
52662306a36Sopenharmony_ci     LLVM (http://llvm.org/):
52762306a36Sopenharmony_ci       LLVM version 10.0.0
52862306a36Sopenharmony_ci       Optimized build.
52962306a36Sopenharmony_ci       Default target: x86_64-unknown-linux-gnu
53062306a36Sopenharmony_ci       Host CPU: skylake
53162306a36Sopenharmony_ci
53262306a36Sopenharmony_ci       Registered Targets:
53362306a36Sopenharmony_ci         aarch64    - AArch64 (little endian)
53462306a36Sopenharmony_ci         bpf        - BPF (host endian)
53562306a36Sopenharmony_ci         bpfeb      - BPF (big endian)
53662306a36Sopenharmony_ci         bpfel      - BPF (little endian)
53762306a36Sopenharmony_ci         x86        - 32-bit X86: Pentium-Pro and above
53862306a36Sopenharmony_ci         x86-64     - 64-bit X86: EM64T and AMD64
53962306a36Sopenharmony_ci
54062306a36Sopenharmony_ciFor developers in order to utilize the latest features added to LLVM's
54162306a36Sopenharmony_ciBPF back end, it is advisable to run the latest LLVM releases. Support
54262306a36Sopenharmony_cifor new BPF kernel features such as additions to the BPF instruction
54362306a36Sopenharmony_ciset are often developed together.
54462306a36Sopenharmony_ci
54562306a36Sopenharmony_ciAll LLVM releases can be found at: http://releases.llvm.org/
54662306a36Sopenharmony_ci
54762306a36Sopenharmony_ciQ: Got it, so how do I build LLVM manually anyway?
54862306a36Sopenharmony_ci--------------------------------------------------
54962306a36Sopenharmony_ciA: We recommend that developers who want the fastest incremental builds
55062306a36Sopenharmony_ciuse the Ninja build system, you can find it in your system's package
55162306a36Sopenharmony_cimanager, usually the package is ninja or ninja-build.
55262306a36Sopenharmony_ci
55362306a36Sopenharmony_ciYou need ninja, cmake and gcc-c++ as build requisites for LLVM. Once you
55462306a36Sopenharmony_cihave that set up, proceed with building the latest LLVM and clang version
55562306a36Sopenharmony_cifrom the git repositories::
55662306a36Sopenharmony_ci
55762306a36Sopenharmony_ci     $ git clone https://github.com/llvm/llvm-project.git
55862306a36Sopenharmony_ci     $ mkdir -p llvm-project/llvm/build
55962306a36Sopenharmony_ci     $ cd llvm-project/llvm/build
56062306a36Sopenharmony_ci     $ cmake .. -G "Ninja" -DLLVM_TARGETS_TO_BUILD="BPF;X86" \
56162306a36Sopenharmony_ci                -DLLVM_ENABLE_PROJECTS="clang"    \
56262306a36Sopenharmony_ci                -DCMAKE_BUILD_TYPE=Release        \
56362306a36Sopenharmony_ci                -DLLVM_BUILD_RUNTIME=OFF
56462306a36Sopenharmony_ci     $ ninja
56562306a36Sopenharmony_ci
56662306a36Sopenharmony_ciThe built binaries can then be found in the build/bin/ directory, where
56762306a36Sopenharmony_ciyou can point the PATH variable to.
56862306a36Sopenharmony_ci
56962306a36Sopenharmony_ciSet ``-DLLVM_TARGETS_TO_BUILD`` equal to the target you wish to build, you
57062306a36Sopenharmony_ciwill find a full list of targets within the llvm-project/llvm/lib/Target
57162306a36Sopenharmony_cidirectory.
57262306a36Sopenharmony_ci
57362306a36Sopenharmony_ciQ: Reporting LLVM BPF issues
57462306a36Sopenharmony_ci----------------------------
57562306a36Sopenharmony_ciQ: Should I notify BPF kernel maintainers about issues in LLVM's BPF code
57662306a36Sopenharmony_cigeneration back end or about LLVM generated code that the verifier
57762306a36Sopenharmony_cirefuses to accept?
57862306a36Sopenharmony_ci
57962306a36Sopenharmony_ciA: Yes, please do!
58062306a36Sopenharmony_ci
58162306a36Sopenharmony_ciLLVM's BPF back end is a key piece of the whole BPF
58262306a36Sopenharmony_ciinfrastructure and it ties deeply into verification of programs from the
58362306a36Sopenharmony_cikernel side. Therefore, any issues on either side need to be investigated
58462306a36Sopenharmony_ciand fixed whenever necessary.
58562306a36Sopenharmony_ci
58662306a36Sopenharmony_ciTherefore, please make sure to bring them up at netdev kernel mailing
58762306a36Sopenharmony_cilist and Cc BPF maintainers for LLVM and kernel bits:
58862306a36Sopenharmony_ci
58962306a36Sopenharmony_ci* Yonghong Song <yhs@fb.com>
59062306a36Sopenharmony_ci* Alexei Starovoitov <ast@kernel.org>
59162306a36Sopenharmony_ci* Daniel Borkmann <daniel@iogearbox.net>
59262306a36Sopenharmony_ci
59362306a36Sopenharmony_ciLLVM also has an issue tracker where BPF related bugs can be found:
59462306a36Sopenharmony_ci
59562306a36Sopenharmony_ci  https://bugs.llvm.org/buglist.cgi?quicksearch=bpf
59662306a36Sopenharmony_ci
59762306a36Sopenharmony_ciHowever, it is better to reach out through mailing lists with having
59862306a36Sopenharmony_cimaintainers in Cc.
59962306a36Sopenharmony_ci
60062306a36Sopenharmony_ciQ: New BPF instruction for kernel and LLVM
60162306a36Sopenharmony_ci------------------------------------------
60262306a36Sopenharmony_ciQ: I have added a new BPF instruction to the kernel, how can I integrate
60362306a36Sopenharmony_ciit into LLVM?
60462306a36Sopenharmony_ci
60562306a36Sopenharmony_ciA: LLVM has a ``-mcpu`` selector for the BPF back end in order to allow
60662306a36Sopenharmony_cithe selection of BPF instruction set extensions. By default the
60762306a36Sopenharmony_ci``generic`` processor target is used, which is the base instruction set
60862306a36Sopenharmony_ci(v1) of BPF.
60962306a36Sopenharmony_ci
61062306a36Sopenharmony_ciLLVM has an option to select ``-mcpu=probe`` where it will probe the host
61162306a36Sopenharmony_cikernel for supported BPF instruction set extensions and selects the
61262306a36Sopenharmony_cioptimal set automatically.
61362306a36Sopenharmony_ci
61462306a36Sopenharmony_ciFor cross-compilation, a specific version can be select manually as well ::
61562306a36Sopenharmony_ci
61662306a36Sopenharmony_ci     $ llc -march bpf -mcpu=help
61762306a36Sopenharmony_ci     Available CPUs for this target:
61862306a36Sopenharmony_ci
61962306a36Sopenharmony_ci       generic - Select the generic processor.
62062306a36Sopenharmony_ci       probe   - Select the probe processor.
62162306a36Sopenharmony_ci       v1      - Select the v1 processor.
62262306a36Sopenharmony_ci       v2      - Select the v2 processor.
62362306a36Sopenharmony_ci     [...]
62462306a36Sopenharmony_ci
62562306a36Sopenharmony_ciNewly added BPF instructions to the Linux kernel need to follow the same
62662306a36Sopenharmony_cischeme, bump the instruction set version and implement probing for the
62762306a36Sopenharmony_ciextensions such that ``-mcpu=probe`` users can benefit from the
62862306a36Sopenharmony_cioptimization transparently when upgrading their kernels.
62962306a36Sopenharmony_ci
63062306a36Sopenharmony_ciIf you are unable to implement support for the newly added BPF instruction
63162306a36Sopenharmony_ciplease reach out to BPF developers for help.
63262306a36Sopenharmony_ci
63362306a36Sopenharmony_ciBy the way, the BPF kernel selftests run with ``-mcpu=probe`` for better
63462306a36Sopenharmony_citest coverage.
63562306a36Sopenharmony_ci
63662306a36Sopenharmony_ciQ: clang flag for target bpf?
63762306a36Sopenharmony_ci-----------------------------
63862306a36Sopenharmony_ciQ: In some cases clang flag ``--target=bpf`` is used but in other cases the
63962306a36Sopenharmony_cidefault clang target, which matches the underlying architecture, is used.
64062306a36Sopenharmony_ciWhat is the difference and when I should use which?
64162306a36Sopenharmony_ci
64262306a36Sopenharmony_ciA: Although LLVM IR generation and optimization try to stay architecture
64362306a36Sopenharmony_ciindependent, ``--target=<arch>`` still has some impact on generated code:
64462306a36Sopenharmony_ci
64562306a36Sopenharmony_ci- BPF program may recursively include header file(s) with file scope
64662306a36Sopenharmony_ci  inline assembly codes. The default target can handle this well,
64762306a36Sopenharmony_ci  while ``bpf`` target may fail if bpf backend assembler does not
64862306a36Sopenharmony_ci  understand these assembly codes, which is true in most cases.
64962306a36Sopenharmony_ci
65062306a36Sopenharmony_ci- When compiled without ``-g``, additional elf sections, e.g.,
65162306a36Sopenharmony_ci  .eh_frame and .rela.eh_frame, may be present in the object file
65262306a36Sopenharmony_ci  with default target, but not with ``bpf`` target.
65362306a36Sopenharmony_ci
65462306a36Sopenharmony_ci- The default target may turn a C switch statement into a switch table
65562306a36Sopenharmony_ci  lookup and jump operation. Since the switch table is placed
65662306a36Sopenharmony_ci  in the global readonly section, the bpf program will fail to load.
65762306a36Sopenharmony_ci  The bpf target does not support switch table optimization.
65862306a36Sopenharmony_ci  The clang option ``-fno-jump-tables`` can be used to disable
65962306a36Sopenharmony_ci  switch table generation.
66062306a36Sopenharmony_ci
66162306a36Sopenharmony_ci- For clang ``--target=bpf``, it is guaranteed that pointer or long /
66262306a36Sopenharmony_ci  unsigned long types will always have a width of 64 bit, no matter
66362306a36Sopenharmony_ci  whether underlying clang binary or default target (or kernel) is
66462306a36Sopenharmony_ci  32 bit. However, when native clang target is used, then it will
66562306a36Sopenharmony_ci  compile these types based on the underlying architecture's conventions,
66662306a36Sopenharmony_ci  meaning in case of 32 bit architecture, pointer or long / unsigned
66762306a36Sopenharmony_ci  long types e.g. in BPF context structure will have width of 32 bit
66862306a36Sopenharmony_ci  while the BPF LLVM back end still operates in 64 bit. The native
66962306a36Sopenharmony_ci  target is mostly needed in tracing for the case of walking ``pt_regs``
67062306a36Sopenharmony_ci  or other kernel structures where CPU's register width matters.
67162306a36Sopenharmony_ci  Otherwise, ``clang --target=bpf`` is generally recommended.
67262306a36Sopenharmony_ci
67362306a36Sopenharmony_ciYou should use default target when:
67462306a36Sopenharmony_ci
67562306a36Sopenharmony_ci- Your program includes a header file, e.g., ptrace.h, which eventually
67662306a36Sopenharmony_ci  pulls in some header files containing file scope host assembly codes.
67762306a36Sopenharmony_ci
67862306a36Sopenharmony_ci- You can add ``-fno-jump-tables`` to work around the switch table issue.
67962306a36Sopenharmony_ci
68062306a36Sopenharmony_ciOtherwise, you can use ``bpf`` target. Additionally, you *must* use bpf target
68162306a36Sopenharmony_ciwhen:
68262306a36Sopenharmony_ci
68362306a36Sopenharmony_ci- Your program uses data structures with pointer or long / unsigned long
68462306a36Sopenharmony_ci  types that interface with BPF helpers or context data structures. Access
68562306a36Sopenharmony_ci  into these structures is verified by the BPF verifier and may result
68662306a36Sopenharmony_ci  in verification failures if the native architecture is not aligned with
68762306a36Sopenharmony_ci  the BPF architecture, e.g. 64-bit. An example of this is
68862306a36Sopenharmony_ci  BPF_PROG_TYPE_SK_MSG require ``--target=bpf``
68962306a36Sopenharmony_ci
69062306a36Sopenharmony_ci
69162306a36Sopenharmony_ci.. Links
69262306a36Sopenharmony_ci.. _selftests:
69362306a36Sopenharmony_ci   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/selftests/bpf/
69462306a36Sopenharmony_ci
69562306a36Sopenharmony_ciHappy BPF hacking!
696