Message ID | 20210916032641.1413293-3-fallentree@fb.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | BPF |
Headers | show |
Series | selftests/bpf: Add parallelism to test_progs | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for bpf-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | warning | 10 maintainers not CCed: kpsingh@kernel.org john.fastabend@gmail.com yhs@fb.com daniel@iogearbox.net linux-kselftest@vger.kernel.org shuah@kernel.org songliubraving@fb.com netdev@vger.kernel.org ast@kernel.org kafai@fb.com |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 1 this patch: 1 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 28 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
bpf/vmtest-bpf-next-PR | success | PR summary |
bpf/vmtest-bpf-next | success | VM_Test |
On Wed, Sep 15, 2021 at 8:26 PM Yucong Sun <fallentree@fb.com> wrote: > > From: Yucong Sun <sunyucong@gmail.com> > > This patch allows each worker to use a unique cgroup base directory, thus > allowing tests that uses cgroups to run concurrently. > > Signed-off-by: Yucong Sun <sunyucong@gmail.com> > --- What if we always set the prefix to be a PID of the process? BTW, Daniel mentioned that this might need some rebasing and conflict resolution due to his patch in bpf tree, which is now merged into bpf-next tree. > tools/testing/selftests/bpf/cgroup_helpers.c | 5 +++-- > tools/testing/selftests/bpf/cgroup_helpers.h | 1 + > tools/testing/selftests/bpf/test_progs.c | 5 +++++ > 3 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/bpf/cgroup_helpers.c b/tools/testing/selftests/bpf/cgroup_helpers.c > index 033051717ba5..a0429f0d6db2 100644 > --- a/tools/testing/selftests/bpf/cgroup_helpers.c > +++ b/tools/testing/selftests/bpf/cgroup_helpers.c > @@ -29,9 +29,10 @@ > #define WALK_FD_LIMIT 16 > #define CGROUP_MOUNT_PATH "/mnt" > #define CGROUP_WORK_DIR "/cgroup-test-work-dir" > +const char *CGROUP_WORK_DIR_SUFFIX = ""; > #define format_cgroup_path(buf, path) \ > - snprintf(buf, sizeof(buf), "%s%s%s", CGROUP_MOUNT_PATH, \ > - CGROUP_WORK_DIR, path) > + snprintf(buf, sizeof(buf), "%s%s%s%s", CGROUP_MOUNT_PATH, \ > + CGROUP_WORK_DIR, CGROUP_WORK_DIR_SUFFIX, path) > > /** > * enable_all_controllers() - Enable all available cgroup v2 controllers > diff --git a/tools/testing/selftests/bpf/cgroup_helpers.h b/tools/testing/selftests/bpf/cgroup_helpers.h > index 5fe3d88e4f0d..5657aba02161 100644 > --- a/tools/testing/selftests/bpf/cgroup_helpers.h > +++ b/tools/testing/selftests/bpf/cgroup_helpers.h > @@ -16,4 +16,5 @@ int setup_cgroup_environment(void); > void cleanup_cgroup_environment(void); > unsigned long long get_cgroup_id(const char *path); > > +extern const char *CGROUP_WORK_DIR_SUFFIX; > #endif > diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c > index 36f130455b2f..77ed9204cc4a 100644 > --- a/tools/testing/selftests/bpf/test_progs.c > +++ b/tools/testing/selftests/bpf/test_progs.c > @@ -1157,6 +1157,11 @@ static int server_main(void) > > static int worker_main(int sock) > { > + static char suffix[16]; > + > + sprintf(suffix, "%d", env.worker_id); > + CGROUP_WORK_DIR_SUFFIX = suffix; > + > save_netns(); > > while (true) { > -- > 2.30.2 >
diff --git a/tools/testing/selftests/bpf/cgroup_helpers.c b/tools/testing/selftests/bpf/cgroup_helpers.c index 033051717ba5..a0429f0d6db2 100644 --- a/tools/testing/selftests/bpf/cgroup_helpers.c +++ b/tools/testing/selftests/bpf/cgroup_helpers.c @@ -29,9 +29,10 @@ #define WALK_FD_LIMIT 16 #define CGROUP_MOUNT_PATH "/mnt" #define CGROUP_WORK_DIR "/cgroup-test-work-dir" +const char *CGROUP_WORK_DIR_SUFFIX = ""; #define format_cgroup_path(buf, path) \ - snprintf(buf, sizeof(buf), "%s%s%s", CGROUP_MOUNT_PATH, \ - CGROUP_WORK_DIR, path) + snprintf(buf, sizeof(buf), "%s%s%s%s", CGROUP_MOUNT_PATH, \ + CGROUP_WORK_DIR, CGROUP_WORK_DIR_SUFFIX, path) /** * enable_all_controllers() - Enable all available cgroup v2 controllers diff --git a/tools/testing/selftests/bpf/cgroup_helpers.h b/tools/testing/selftests/bpf/cgroup_helpers.h index 5fe3d88e4f0d..5657aba02161 100644 --- a/tools/testing/selftests/bpf/cgroup_helpers.h +++ b/tools/testing/selftests/bpf/cgroup_helpers.h @@ -16,4 +16,5 @@ int setup_cgroup_environment(void); void cleanup_cgroup_environment(void); unsigned long long get_cgroup_id(const char *path); +extern const char *CGROUP_WORK_DIR_SUFFIX; #endif diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c index 36f130455b2f..77ed9204cc4a 100644 --- a/tools/testing/selftests/bpf/test_progs.c +++ b/tools/testing/selftests/bpf/test_progs.c @@ -1157,6 +1157,11 @@ static int server_main(void) static int worker_main(int sock) { + static char suffix[16]; + + sprintf(suffix, "%d", env.worker_id); + CGROUP_WORK_DIR_SUFFIX = suffix; + save_netns(); while (true) {