<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/samples/bpf, branch linus/master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/samples/bpf?h=linus%2Fmaster</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/samples/bpf?h=linus%2Fmaster'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2022-05-10T00:40:43Z</updated>
<entry>
<title>samples: bpf: Don't fail for a missing VMLINUX_BTF when VMLINUX_H is provided</title>
<updated>2022-05-10T00:40:43Z</updated>
<author>
<name>Jerome Marchand</name>
<email>jmarchan@redhat.com</email>
</author>
<published>2022-05-07T16:16:35Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=ec24704492d8791a52a75a39e3ad762b6e017bc6'/>
<id>urn:sha1:ec24704492d8791a52a75a39e3ad762b6e017bc6</id>
<content type='text'>
samples/bpf build currently always fails if it can't generate
vmlinux.h from vmlinux, even when vmlinux.h is directly provided by
VMLINUX_H variable, which makes VMLINUX_H pointless.
Only fails when neither method works.

Fixes: 384b6b3bbf0d ("samples: bpf: Add vmlinux.h generation support")
Reported-by: CKI Project &lt;cki-project@redhat.com&gt;
Reported-by: Veronika Kabatova &lt;vkabatov@redhat.com&gt;
Signed-off-by: Jerome Marchand &lt;jmarchan@redhat.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220507161635.2219052-1-jmarchan@redhat.com
</content>
</entry>
<entry>
<title>samples/bpf: Detach xdp prog when program exits unexpectedly in xdp_rxq_info_user</title>
<updated>2022-04-28T02:07:42Z</updated>
<author>
<name>Zhengchao Shao</name>
<email>shaozhengchao@huawei.com</email>
</author>
<published>2022-04-27T06:23:38Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=d1c57439e4f3db0a12259b9978905e92847505b8'/>
<id>urn:sha1:d1c57439e4f3db0a12259b9978905e92847505b8</id>
<content type='text'>
When xdp_rxq_info_user program exits unexpectedly, it doesn't detach xdp
prog of device, and other xdp prog can't be attached to the device. So
call init_exit() to detach xdp prog when program exits unexpectedly.

Signed-off-by: Zhengchao Shao &lt;shaozhengchao@huawei.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220427062338.80173-1-shaozhengchao@huawei.com
</content>
</entry>
<entry>
<title>samples/bpf: Reduce the sampling interval in xdp1_user</title>
<updated>2022-04-20T21:58:29Z</updated>
<author>
<name>Zhengchao Shao</name>
<email>shaozhengchao@huawei.com</email>
</author>
<published>2022-04-19T11:47:46Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=db69264f983a5890fe8ba20ed4c20dfd4b687615'/>
<id>urn:sha1:db69264f983a5890fe8ba20ed4c20dfd4b687615</id>
<content type='text'>
If interval is 2, and sum - prev[key] = 1, the result = 0. This will
mislead the tester that the port has no traffic right now. So reduce the
sampling interval to 1.

Signed-off-by: Zhengchao Shao &lt;shaozhengchao@huawei.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220419114746.291613-1-shaozhengchao@huawei.com
</content>
</entry>
<entry>
<title>samples/bpf: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK</title>
<updated>2022-04-11T03:17:15Z</updated>
<author>
<name>Yafang Shao</name>
<email>laoar.shao@gmail.com</email>
</author>
<published>2022-04-09T12:59:55Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=b25acdafd3730110254f8452b113a6311ab5cf2d'/>
<id>urn:sha1:b25acdafd3730110254f8452b113a6311ab5cf2d</id>
<content type='text'>
We have switched to memcg-based memory accouting and thus the rlimit is
not needed any more. LIBBPF_STRICT_AUTO_RLIMIT_MEMLOCK was introduced in
libbpf for backward compatibility, so we can use it instead now.

This patch also removes the useless header sys/resource.h from many files
in samples/bpf.

Signed-off-by: Yafang Shao &lt;laoar.shao@gmail.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220409125958.92629-2-laoar.shao@gmail.com
</content>
</entry>
<entry>
<title>samples, bpf: Move routes monitor in xdp_router_ipv4 in a dedicated thread</title>
<updated>2022-04-08T20:10:57Z</updated>
<author>
<name>Lorenzo Bianconi</name>
<email>lorenzo@kernel.org</email>
</author>
<published>2022-04-05T14:15:14Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=587323cf6a6a6da074f0518444ee7da10f517f45'/>
<id>urn:sha1:587323cf6a6a6da074f0518444ee7da10f517f45</id>
<content type='text'>
In order to not miss any netlink message from the kernel, move routes
monitor to a dedicated thread.

Fixes: 85bf1f51691c ("samples: bpf: Convert xdp_router_ipv4 to XDP samples helper")
Signed-off-by: Lorenzo Bianconi &lt;lorenzo@kernel.org&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Link: https://lore.kernel.org/bpf/e364b817c69ded73be24b677ab47a157f7c21b64.1649167911.git.lorenzo@kernel.org
</content>
</entry>
<entry>
<title>samples: bpf: Fix linking xdp_router_ipv4 after migration</title>
<updated>2022-04-04T21:45:06Z</updated>
<author>
<name>Alexander Lobakin</name>
<email>alexandr.lobakin@intel.com</email>
</author>
<published>2022-04-04T11:54:51Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=fc843ccd8e4c084fa5d605a876db2d3a3c38be88'/>
<id>urn:sha1:fc843ccd8e4c084fa5d605a876db2d3a3c38be88</id>
<content type='text'>
Users of the xdp_sample_user infra should be explicitly linked
with the standard math library (`-lm`). Otherwise, the following
happens:

/usr/bin/ld: xdp_sample_user.c:(.text+0x59fc): undefined reference to `ceil'
/usr/bin/ld: xdp_sample_user.c:(.text+0x5a0d): undefined reference to `ceil'
/usr/bin/ld: xdp_sample_user.c:(.text+0x5adc): undefined reference to `floor'
/usr/bin/ld: xdp_sample_user.c:(.text+0x5b01): undefined reference to `ceil'
/usr/bin/ld: xdp_sample_user.c:(.text+0x5c1e): undefined reference to `floor'
/usr/bin/ld: xdp_sample_user.c:(.text+0x5c43): undefined reference to `ceil
[...]

That happened previously, so there's a block of linkage flags in the
Makefile. xdp_router_ipv4 has been transferred to this infra quite
recently, but hasn't been added to it. Fix.

Fixes: 85bf1f51691c ("samples: bpf: Convert xdp_router_ipv4 to XDP samples helper")
Signed-off-by: Alexander Lobakin &lt;alexandr.lobakin@intel.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220404115451.1116478-1-alexandr.lobakin@intel.com
</content>
</entry>
<entry>
<title>sample: bpf: syscall_tp_user: Print result of verify_map</title>
<updated>2022-04-04T21:43:57Z</updated>
<author>
<name>Song Chen</name>
<email>chensong_2000@189.cn</email>
</author>
<published>2022-04-02T08:57:08Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=35f91d1fe106cd474ac0463157d012c675385e18'/>
<id>urn:sha1:35f91d1fe106cd474ac0463157d012c675385e18</id>
<content type='text'>
At the end of the test, we already print out
    prog &lt;prog number&gt;: map ids &lt;...&gt; &lt;...&gt;
Value is the number read from kernel through bpf map, further print out
    verify map:&lt;map id&gt; val:&lt;...&gt;
will help users to understand the program runs successfully.

Signed-off-by: Song Chen &lt;chensong_2000@189.cn&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/1648889828-12417-1-git-send-email-chensong_2000@189.cn
</content>
</entry>
<entry>
<title>samples: bpf: Convert xdp_router_ipv4 to XDP samples helper</title>
<updated>2022-04-04T00:12:09Z</updated>
<author>
<name>Lorenzo Bianconi</name>
<email>lorenzo@kernel.org</email>
</author>
<published>2022-03-16T07:13:23Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=85bf1f51691c078e77f524a7addf37faa6635a6e'/>
<id>urn:sha1:85bf1f51691c078e77f524a7addf37faa6635a6e</id>
<content type='text'>
Rely on the libbpf skeleton facility and other utilities provided by XDP
sample helpers in xdp_router_ipv4 sample.

Signed-off-by: Lorenzo Bianconi &lt;lorenzo@kernel.org&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/7f4d98ee2c13c04d5eb924eebf79ced32fee8418.1647414711.git.lorenzo@kernel.org
</content>
</entry>
<entry>
<title>samples/bpf, xdpsock: Fix race when running for fix duration of time</title>
<updated>2022-03-15T15:53:37Z</updated>
<author>
<name>Niklas Söderlund</name>
<email>niklas.soderlund@corigine.com</email>
</author>
<published>2022-03-15T10:29:48Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=8fa42d78f6354bb96ad3a079dcbef528ca9fa9e0'/>
<id>urn:sha1:8fa42d78f6354bb96ad3a079dcbef528ca9fa9e0</id>
<content type='text'>
When running xdpsock for a fix duration of time before terminating
using --duration=&lt;n&gt;, there is a race condition that may cause xdpsock
to terminate immediately.

When running for a fixed duration of time the check to determine when to
terminate execution is in is_benchmark_done() and is being executed in
the context of the poller thread,

    if (opt_duration &gt; 0) {
            unsigned long dt = (get_nsecs() - start_time);

            if (dt &gt;= opt_duration)
                    benchmark_done = true;
    }

However start_time is only set after the poller thread have been
created. This leaves a small window when the poller thread is starting
and calls is_benchmark_done() for the first time that start_time is not
yet set. In that case start_time have its initial value of 0 and the
duration check fails as it do not correlate correctly for the
applications start time and immediately sets benchmark_done which in
turn terminates the xdpsock application.

Fix this by setting start_time before creating the poller thread.

Fixes: d3f11b018f6c ("samples/bpf: xdpsock: Add duration option to specify how long to run")
Signed-off-by: Niklas Söderlund &lt;niklas.soderlund@corigine.com&gt;
Signed-off-by: Simon Horman &lt;simon.horman@corigine.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Link: https://lore.kernel.org/bpf/20220315102948.466436-1-niklas.soderlund@corigine.com
</content>
</entry>
<entry>
<title>samples/bpf: Get rid of bpf_prog_load_xattr() use</title>
<updated>2022-02-03T15:32:25Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2022-02-02T22:59:16Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=1e4edb6d8c4f045823291862e7e28591cb6f2067'/>
<id>urn:sha1:1e4edb6d8c4f045823291862e7e28591cb6f2067</id>
<content type='text'>
Remove all the remaining uses of deprecated bpf_prog_load_xattr() API.

Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Reviewed-by: Quentin Monnet &lt;quentin@isovalent.com&gt;
Link: https://lore.kernel.org/bpf/20220202225916.3313522-7-andrii@kernel.org
</content>
</entry>
</feed>
