<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/tools/testing/selftests/bpf/map_tests, branch master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/tools/testing/selftests/bpf/map_tests?h=master</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/tools/testing/selftests/bpf/map_tests?h=master'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2022-09-22T23:41:27Z</updated>
<entry>
<title>selftests/bpf: Free the allocated resources after test case succeeds</title>
<updated>2022-09-22T23:41:27Z</updated>
<author>
<name>Hou Tao</name>
<email>houtao1@huawei.com</email>
</author>
<published>2022-09-21T07:00:35Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=103d002fb7d548fb1187e350f2b73788558128b9'/>
<id>urn:sha1:103d002fb7d548fb1187e350f2b73788558128b9</id>
<content type='text'>
Free the created fd or allocated bpf_object after test case succeeds,
else there will be resource leaks.

Spotted by using address sanitizer and checking the content of
/proc/$pid/fd directory.

Signed-off-by: Hou Tao &lt;houtao1@huawei.com&gt;
Link: https://lore.kernel.org/r/20220921070035.2016413-3-houtao@huaweicloud.com
Signed-off-by: Martin KaFai Lau &lt;martin.lau@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests/bpf: Destroy the skeleton when CONFIG_PREEMPT is off</title>
<updated>2022-09-22T23:41:27Z</updated>
<author>
<name>Hou Tao</name>
<email>houtao1@huawei.com</email>
</author>
<published>2022-09-21T07:00:34Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=f5eb23b91c41a7ffc7ca7fe14f3c512360f02937'/>
<id>urn:sha1:f5eb23b91c41a7ffc7ca7fe14f3c512360f02937</id>
<content type='text'>
Destroy the created skeleton when CONFIG_PREEMPT is off, else will be
resource leak.

Fixes: 73b97bc78b32 ("selftests/bpf: Test concurrent updates on bpf_task_storage_busy")
Signed-off-by: Hou Tao &lt;houtao1@huawei.com&gt;
Link: https://lore.kernel.org/r/20220921070035.2016413-2-houtao@huaweicloud.com
Signed-off-by: Martin KaFai Lau &lt;martin.lau@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests/bpf: Add test result messages for test_task_storage_map_stress_lookup</title>
<updated>2022-09-19T18:17:38Z</updated>
<author>
<name>Hou Tao</name>
<email>houtao1@huawei.com</email>
</author>
<published>2022-09-19T03:57:14Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=a7e85406bdbd0c376f3997e571f7073b9527272e'/>
<id>urn:sha1:a7e85406bdbd0c376f3997e571f7073b9527272e</id>
<content type='text'>
Add test result message when test_task_storage_map_stress_lookup()
succeeds or is skipped. The test case can be skipped due to the choose
of preemption model in kernel config, so export skips in test_maps.c and
increase it when needed.

The following is the output of test_maps when the test case succeeds or
is skipped:

  test_task_storage_map_stress_lookup:PASS
  test_maps: OK, 0 SKIPPED

  test_task_storage_map_stress_lookup SKIP (no CONFIG_PREEMPT)
  test_maps: OK, 1 SKIPPED

Fixes: 73b97bc78b32 ("selftests/bpf: Test concurrent updates on bpf_task_storage_busy")
Signed-off-by: Hou Tao &lt;houtao1@huawei.com&gt;
Link: https://lore.kernel.org/r/20220919035714.2195144-1-houtao@huaweicloud.com
Signed-off-by: Martin KaFai Lau &lt;martin.lau@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests/bpf: Test concurrent updates on bpf_task_storage_busy</title>
<updated>2022-09-01T19:16:21Z</updated>
<author>
<name>Hou Tao</name>
<email>houtao1@huawei.com</email>
</author>
<published>2022-09-01T06:19:38Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=73b97bc78b32eb739a7dd3394fa3981e8021c0ef'/>
<id>urn:sha1:73b97bc78b32eb739a7dd3394fa3981e8021c0ef</id>
<content type='text'>
Under full preemptible kernel, task local storage lookup operations on
the same CPU may update per-cpu bpf_task_storage_busy concurrently. If
the update of bpf_task_storage_busy is not preemption safe, the final
value of bpf_task_storage_busy may become not-zero forever and
bpf_task_storage_trylock() will always fail. So add a test case to
ensure the update of bpf_task_storage_busy is preemption safe.

Will skip the test case when CONFIG_PREEMPT is disabled, and it can only
reproduce the problem probabilistically. By increasing
TASK_STORAGE_MAP_NR_LOOP and running it under ARM64 VM with 4-cpus, it
takes about four rounds to reproduce:

&gt; test_maps is modified to only run test_task_storage_map_stress_lookup()
$ export TASK_STORAGE_MAP_NR_THREAD=256
$ export TASK_STORAGE_MAP_NR_LOOP=81920
$ export TASK_STORAGE_MAP_PIN_CPU=1
$ time ./test_maps
test_task_storage_map_stress_lookup(135):FAIL:bad bpf_task_storage_busy got -2

real    0m24.743s
user    0m6.772s
sys     0m17.966s

Signed-off-by: Hou Tao &lt;houtao1@huawei.com&gt;
Acked-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Link: https://lore.kernel.org/r/20220901061938.3789460-5-houtao@huaweicloud.com
Signed-off-by: Martin KaFai Lau &lt;martin.lau@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests/bpf: Handle batch operations for map-in-map bpf-maps</title>
<updated>2022-05-10T17:34:57Z</updated>
<author>
<name>Takshak Chahande</name>
<email>ctakshak@fb.com</email>
</author>
<published>2022-05-10T08:22:21Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=a82ebb093fc7bdd88f8df17b2fa303d7535fa43b'/>
<id>urn:sha1:a82ebb093fc7bdd88f8df17b2fa303d7535fa43b</id>
<content type='text'>
This patch adds up test cases that handles 4 combinations:
 a) outer map: BPF_MAP_TYPE_ARRAY_OF_MAPS
    inner maps: BPF_MAP_TYPE_ARRAY and BPF_MAP_TYPE_HASH
 b) outer map: BPF_MAP_TYPE_HASH_OF_MAPS
    inner maps: BPF_MAP_TYPE_ARRAY and BPF_MAP_TYPE_HASH

Signed-off-by: Takshak Chahande &lt;ctakshak@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Link: https://lore.kernel.org/bpf/20220510082221.2390540-2-ctakshak@fb.com
</content>
</entry>
<entry>
<title>selftests/bpf: Replace all uses of bpf_load_btf() with bpf_btf_load()</title>
<updated>2021-12-10T23:29:18Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2021-12-09T19:38:37Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=dc94121b5ca17adaaabb7959c10d9c6ea504f7b1'/>
<id>urn:sha1:dc94121b5ca17adaaabb7959c10d9c6ea504f7b1</id>
<content type='text'>
Switch all selftests uses of to-be-deprecated bpf_load_btf() with
equivalent bpf_btf_load() calls.

Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20211209193840.1248570-10-andrii@kernel.org
</content>
</entry>
<entry>
<title>selftests/bpf: Migrate selftests to bpf_map_create()</title>
<updated>2021-11-25T22:37:38Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2021-11-24T19:32:33Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=2fe256a429cb6c0b0064563af4158470143a363c'/>
<id>urn:sha1:2fe256a429cb6c0b0064563af4158470143a363c</id>
<content type='text'>
Conversion is straightforward for most cases. In few cases tests are
using mutable map_flags and attribute structs, but bpf_map_create_opts
can be used in the similar fashion, so there were no problems. Just lots
of repetitive conversions.

Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Link: https://lore.kernel.org/bpf/20211124193233.3115996-5-andrii@kernel.org
</content>
</entry>
<entry>
<title>bpf, selftests: Update array map tests for per-cpu batched ops</title>
<updated>2021-04-27T23:18:12Z</updated>
<author>
<name>Pedro Tammela</name>
<email>pctammela@gmail.com</email>
</author>
<published>2021-04-24T21:45:10Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=3733bfbbdd28f7a65340d0058d15d15190a4944a'/>
<id>urn:sha1:3733bfbbdd28f7a65340d0058d15d15190a4944a</id>
<content type='text'>
Follows the same logic as the hashtable tests.

Signed-off-by: Pedro Tammela &lt;pctammela@mojatatu.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Link: https://lore.kernel.org/bpf/20210424214510.806627-3-pctammela@mojatatu.com
</content>
</entry>
<entry>
<title>bpf: selftests: Add tests for batched ops in LPM trie maps</title>
<updated>2021-03-26T01:51:08Z</updated>
<author>
<name>Pedro Tammela</name>
<email>pctammela@mojatatu.com</email>
</author>
<published>2021-03-23T02:50:54Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=e9bd8cbd970bedd3cca8ee334c76ab90feb78760'/>
<id>urn:sha1:e9bd8cbd970bedd3cca8ee334c76ab90feb78760</id>
<content type='text'>
Uses the already existing infrastructure for testing batched ops.
The testing code is essentially the same, with minor tweaks for this use
case.

Suggested-by: Jamal Hadi Salim &lt;jhs@mojatatu.com&gt;
Signed-off-by: Pedro Tammela &lt;pctammela@mojatatu.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20210323025058.315763-3-pctammela@gmail.com
</content>
</entry>
<entry>
<title>bpf: selftests: Remove unused 'nospace_err' in tests for batched ops in array maps</title>
<updated>2021-03-16T05:19:33Z</updated>
<author>
<name>Pedro Tammela</name>
<email>pctammela@gmail.com</email>
</author>
<published>2021-03-15T13:29:51Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=23f50b5ac331c8c27c421a7116618355508e8427'/>
<id>urn:sha1:23f50b5ac331c8c27c421a7116618355508e8427</id>
<content type='text'>
This seems to be a reminiscent from the hashmap tests.

Signed-off-by: Pedro Tammela &lt;pctammela@gmail.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Link: https://lore.kernel.org/bpf/20210315132954.603108-1-pctammela@gmail.com
</content>
</entry>
</feed>
