lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d28dec16-9029-42f5-b979-a0f11656a991@kernel.org>
Date: Tue, 7 May 2024 18:02:31 +0200
From: Matthieu Baerts <matttbe@...nel.org>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: MPTCP Upstream <mptcp@...ts.linux.dev>,
 Mat Martineau <martineau@...nel.org>, Geliang Tang <geliang@...nel.org>,
 Andrii Nakryiko <andrii@...nel.org>, Eduard Zingerman <eddyz87@...il.com>,
 Mykola Lysenko <mykolal@...com>, Alexei Starovoitov <ast@...nel.org>,
 Daniel Borkmann <daniel@...earbox.net>,
 Martin KaFai Lau <martin.lau@...ux.dev>, Song Liu <song@...nel.org>,
 Yonghong Song <yonghong.song@...ux.dev>,
 John Fastabend <john.fastabend@...il.com>, KP Singh <kpsingh@...nel.org>,
 Stanislav Fomichev <sdf@...gle.com>, Hao Luo <haoluo@...gle.com>,
 Jiri Olsa <jolsa@...nel.org>, Shuah Khan <shuah@...nel.org>,
 LKML <linux-kernel@...r.kernel.org>,
 Network Development <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
 "open list:KERNEL SELFTEST FRAMEWORK" <linux-kselftest@...r.kernel.org>,
 Geliang Tang <tanggeliang@...inos.cn>
Subject: Re: [PATCH bpf-next 2/4] selftests/bpf: Add RUN_MPTCP_TEST macro

Hi Alexei,

Thank you for the review!

On 07/05/2024 16:44, Alexei Starovoitov wrote:
> On Tue, May 7, 2024 at 3:53 AM Matthieu Baerts (NGI0)
> <matttbe@...nel.org> wrote:
>>
>> From: Geliang Tang <tanggeliang@...inos.cn>
>>
>> Each MPTCP subtest tests test__start_subtest(suffix), then invokes
>> test_suffix(). It makes sense to add a new macro RUN_MPTCP_TEST to
>> simpolify the code.
>>
>> Signed-off-by: Geliang Tang <tanggeliang@...inos.cn>
>> Reviewed-by: Mat Martineau <martineau@...nel.org>
>> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@...nel.org>
>> ---
>>  tools/testing/selftests/bpf/prog_tests/mptcp.c | 12 ++++++++----
>>  1 file changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
>> index baf976a7a1dd..9d1b255bb654 100644
>> --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
>> +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
>> @@ -347,10 +347,14 @@ static void test_mptcpify(void)
>>         close(cgroup_fd);
>>  }
>>
>> +#define RUN_MPTCP_TEST(suffix)                                 \
>> +do {                                                           \
>> +       if (test__start_subtest(#suffix))                       \
>> +               test_##suffix();                                \
>> +} while (0)
> 
> Please no.
> Don't hide it behind macros.

I understand, I'm personally not a big fan of hiding code being a macro
too. This one saves only one line. Geliang added a few more tests in our
tree [1], for a total of 9, so that's only saving 9 lines.

Related to that, if you don't mind, Geliang also added another macro --
MPTCP_SCHED_TEST -- for tests that are currently only in our tree [2]
(not ready yet). We asked him to reduce the size of this macro to the
minimum. We accepted it because it removed quite a lot of similar code
with very small differences [3]. Do you think we should revert this
modification too?

[1]
https://github.com/multipath-tcp/mptcp_net-next/blob/4369d9cbd752e166961ac0db7f85886111606301/tools/testing/selftests/bpf/prog_tests/mptcp.c#L578-L595

[2]
https://github.com/multipath-tcp/mptcp_net-next/blob/4369d9cbd752e166961ac0db7f85886111606301/tools/testing/selftests/bpf/prog_tests/mptcp.c#L559-L576

[3]
https://lore.kernel.org/mptcp/cover.1713321357.git.tanggeliang@kylinos.cn/T/#m0b9c14f1cbae8653c6fd119f6b71d1797961d6ba

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ