<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/lib/test_bpf.c, branch v6.8</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.8</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.8'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2023-12-10T05:27:54Z</updated>
<entry>
<title>test_bpf: Rename second ALU64_SMOD_X to ALU64_SMOD_K</title>
<updated>2023-12-10T05:27:54Z</updated>
<author>
<name>Tiezhu Yang</name>
<email>yangtiezhu@loongson.cn</email>
</author>
<published>2023-12-07T04:08:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5181dc08f79583c6dead80208137a97e68ff07b0'/>
<id>urn:sha1:5181dc08f79583c6dead80208137a97e68ff07b0</id>
<content type='text'>
Currently, there are two test cases with same name
"ALU64_SMOD_X: -7 % 2 = -1", the first one is right,
the second one should be ALU64_SMOD_K because its
code is BPF_ALU64 | BPF_MOD | BPF_K.

Before:
test_bpf: #170 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS
test_bpf: #171 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS

After:
test_bpf: #170 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS
test_bpf: #171 ALU64_SMOD_K: -7 % 2 = -1 jited:1 4 PASS

Fixes: daabb2b098e0 ("bpf/tests: add tests for cpuv4 instructions")
Signed-off-by: Tiezhu Yang &lt;yangtiezhu@loongson.cn&gt;
Acked-by: Yonghong Song &lt;yonghong.song@linux.dev&gt;
Link: https://lore.kernel.org/r/20231207040851.19730-1-yangtiezhu@loongson.cn
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>bpf/tests: Remove duplicate JSGT tests</title>
<updated>2023-11-30T11:17:33Z</updated>
<author>
<name>Yujie Liu</name>
<email>yujie.liu@intel.com</email>
</author>
<published>2023-11-30T03:40:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f690ff9122d2ca8e38769f3bcf217bd3df681a36'/>
<id>urn:sha1:f690ff9122d2ca8e38769f3bcf217bd3df681a36</id>
<content type='text'>
It seems unnecessary that JSGT is tested twice (one before JSGE and one
after JSGE) since others are tested only once. Remove the duplicate JSGT
tests.

Fixes: 0bbaa02b4816 ("bpf/tests: Add tests to check source register zero-extension")
Signed-off-by: Yujie Liu &lt;yujie.liu@intel.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Johan Almbladh &lt;johan.almbladh@anyfinetworks.com&gt;
Link: https://lore.kernel.org/bpf/20231130034018.2144963-1-yujie.liu@intel.com
</content>
</entry>
<entry>
<title>bpf: Remove test for MOVSX32 with offset=32</title>
<updated>2023-11-15T20:46:27Z</updated>
<author>
<name>Puranjay Mohan</name>
<email>puranjay12@gmail.com</email>
</author>
<published>2023-11-10T17:51:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5fa201f37c2ef58a0f821e656d794af89b3a1738'/>
<id>urn:sha1:5fa201f37c2ef58a0f821e656d794af89b3a1738</id>
<content type='text'>
MOVSX32 only supports sign extending 8-bit and 16-bit operands into 32
bit operands. The "ALU_MOVSX | BPF_W" test tries to sign extend a 32 bit
operand into a 32 bit operand which is equivalent to a normal BPF_MOV.

Remove this test as it tries to run an invalid instruction.

Fixes: daabb2b098e0 ("bpf/tests: add tests for cpuv4 instructions")
Signed-off-by: Puranjay Mohan &lt;puranjay12@gmail.com&gt;
Reported-by: kernel test robot &lt;oliver.sang@intel.com&gt;
Closes: https://lore.kernel.org/oe-lkp/202310111838.46ff5b6a-oliver.sang@intel.com
Acked-by: Stanislav Fomichev &lt;sdf@google.com&gt;
Acked-by: Yonghong Song &lt;yonghong.song@linux.dev&gt;
Link: https://lore.kernel.org/r/20231110175150.87803-1-puranjay12@gmail.com
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>bpf/tests: add tests for cpuv4 instructions</title>
<updated>2023-09-16T00:16:57Z</updated>
<author>
<name>Puranjay Mohan</name>
<email>puranjay12@gmail.com</email>
</author>
<published>2023-09-07T23:05:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=daabb2b098e04753fa3d1b1feed13e5a61bef61c'/>
<id>urn:sha1:daabb2b098e04753fa3d1b1feed13e5a61bef61c</id>
<content type='text'>
The BPF JITs now support cpuv4 instructions. Add tests for these new
instructions to the test suite:

1. Sign extended Load
2. Sign extended Mov
3. Unconditional byte swap
4. Unconditional jump with 32-bit offset
5. Signed division and modulo

Signed-off-by: Puranjay Mohan &lt;puranjay12@gmail.com&gt;
Link: https://lore.kernel.org/r/20230907230550.1417590-9-puranjay12@gmail.com
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>bpf/tests: Enhance output on error and fix typos</title>
<updated>2023-08-18T15:08:42Z</updated>
<author>
<name>Helge Deller</name>
<email>deller@gmx.de</email>
</author>
<published>2023-08-17T22:02:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b6594a17ecce03ca70a3f36783924635eea5499d'/>
<id>urn:sha1:b6594a17ecce03ca70a3f36783924635eea5499d</id>
<content type='text'>
If a testcase returns a wrong (unexpected) value, print the expected and
returned value in hex notation in addition to the decimal notation.

This is very useful in tests which bit-shift hex values left or right and
helped me a lot while developing the JIT compiler for the hppa architecture.

Additionally fix two typos: dowrd -&gt; dword, tall calls -&gt; tail calls.

Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Link: https://lore.kernel.org/bpf/ZN6ZAAVoWZpsD1Jf@p100
</content>
</entry>
<entry>
<title>lib/test_bpf: Call page_address() on page acquired with GFP_KERNEL flag</title>
<updated>2023-06-29T13:32:25Z</updated>
<author>
<name>Sumitra Sharma</name>
<email>sumitraartsy@gmail.com</email>
</author>
<published>2023-06-23T15:16:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=da1a055d01ed0c18402dd1f1934096ac4bb36ada'/>
<id>urn:sha1:da1a055d01ed0c18402dd1f1934096ac4bb36ada</id>
<content type='text'>
generate_test_data() acquires a page with alloc_page(GFP_KERNEL).
The GFP_KERNEL is typical for kernel-internal allocations. The
caller requires ZONE_NORMAL or a lower zone for direct access.

Therefore the page cannot come from ZONE_HIGHMEM. Thus there's no
need to map it with kmap().

Also, the kmap() is being deprecated in favor of kmap_local_page() [1].

Hence, use a plain page_address() directly.

Since the page passed to the page_address() is not from the highmem
zone, the page_address() function will always return a valid kernel
virtual address and will not return NULL. Hence, remove the check
'if (!ptr)'.

Remove the unused variable 'ptr' and label 'err_free_page'.

  [1] https://lore.kernel.org/all/20220813220034.806698-1-ira.weiny@intel.com/

Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Suggested-by: Fabio M. De Francesco &lt;fmdefrancesco@gmail.com&gt;
Signed-off-by: Sumitra Sharma &lt;sumitraartsy@gmail.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Reviewed-by: Fabio M. De Francesco &lt;fmdefrancesco@gmail.com&gt;
Reviewed-by: Ira Weiny &lt;ira.weiny@intel.com&gt;
Link: https://lore.kernel.org/bpf/20230623151644.GA434468@sumitra.com
</content>
</entry>
<entry>
<title>bpf/tests: Use struct_size()</title>
<updated>2023-05-31T10:58:38Z</updated>
<author>
<name>Su Hui</name>
<email>suhui@nfschina.com</email>
</author>
<published>2023-05-31T04:32:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0d2da4b595d03009db7dfb5ebf01c547b89b0ad8'/>
<id>urn:sha1:0d2da4b595d03009db7dfb5ebf01c547b89b0ad8</id>
<content type='text'>
Use struct_size() instead of hand writing it. This is less verbose and
more informative.

Signed-off-by: Su Hui &lt;suhui@nfschina.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Link: https://lore.kernel.org/bpf/20230531043251.989312-1-suhui@nfschina.com
</content>
</entry>
<entry>
<title>net: remove skb-&gt;vlan_present</title>
<updated>2022-11-12T02:18:05Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2022-11-09T09:57:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=354259fa73e2aac92ae5e19522adb69a92c15b49'/>
<id>urn:sha1:354259fa73e2aac92ae5e19522adb69a92c15b49</id>
<content type='text'>
skb-&gt;vlan_present seems redundant.

We can instead derive it from this boolean expression:

vlan_present = skb-&gt;vlan_proto != 0 || skb-&gt;vlan_tci != 0

Add a new union, to access both fields in a single load/store
when possible.

	union {
		u32	vlan_all;
		struct {
		__be16	vlan_proto;
		__u16	vlan_tci;
		};
	};

This allows following patch to remove a conditional test in GRO stack.

Note:
  We move remcsum_offload to keep TC_AT_INGRESS_MASK
  and SKB_MONO_DELIVERY_TIME_MASK unchanged.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Acked-by: Martin KaFai Lau &lt;martin.lau@kernel.org&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>test_bpf: fix incorrect netdev features</title>
<updated>2022-06-23T02:20:20Z</updated>
<author>
<name>Jian Shen</name>
<email>shenjian15@huawei.com</email>
</author>
<published>2022-06-22T13:50:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9676feccacdb0571791c88b23e3b7ac4e7c9c457'/>
<id>urn:sha1:9676feccacdb0571791c88b23e3b7ac4e7c9c457</id>
<content type='text'>
The prototype of .features is netdev_features_t, it should use
NETIF_F_LLTX and NETIF_F_HW_VLAN_STAG_TX, not NETIF_F_LLTX_BIT
and NETIF_F_HW_VLAN_STAG_TX_BIT.

Fixes: cf204a718357 ("bpf, testing: Introduce 'gso_linear_no_head_frag' skb_segment test")
Signed-off-by: Jian Shen &lt;shenjian15@huawei.com&gt;
Acked-by: John Fastabend &lt;john.fastabend@gmail.com&gt;
Link: https://lore.kernel.org/r/20220622135002.8263-1-shenjian15@huawei.com
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>bpf, tests: Add load store test case for tail call</title>
<updated>2022-03-31T22:27:52Z</updated>
<author>
<name>Xu Kuohai</name>
<email>xukuohai@huawei.com</email>
</author>
<published>2022-03-21T15:28:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=38608ee7b6907830f157818d81f7b2393d49c808'/>
<id>urn:sha1:38608ee7b6907830f157818d81f7b2393d49c808</id>
<content type='text'>
Add test case to enusre that the caller and callee's fp offsets are
correct during tail call (mainly asserting for arm64 JIT).

Tested on both big-endian and little-endian arm64 qemu, result:

 test_bpf: Summary: 1026 PASSED, 0 FAILED, [1014/1014 JIT'ed]
 test_bpf: test_tail_calls: Summary: 10 PASSED, 0 FAILED, [10/10 JIT'ed]
 test_bpf: test_skb_segment: Summary: 2 PASSED, 0 FAILED

Signed-off-by: Xu Kuohai &lt;xukuohai@huawei.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Link: https://lore.kernel.org/bpf/20220321152852.2334294-6-xukuohai@huawei.com
</content>
</entry>
</feed>
