Skip to contentSkip to conversation

selftests: bpf: fix use of undeclared RET_IF macro

PATCH In review Lorenz Bauer 3 participants 8 messages May 21, 2020 – Jun 10, 2020 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests: bpf: fix use of undeclared RET_IF macro

commit 634efb750435 ("selftests: bpf: Reset global state between reuseport test runs") uses a macro RET_IF which doesn't exist in the v4.19 tree. It is defined as follows:

        #define RET_IF(condition, tag, format...) ({
                if (CHECK_FAIL(condition)) {
                        printf(tag " " format);
                        return;
                }
        })

CHECK_FAIL in turn is defined as:

        #define CHECK_FAIL(condition) ({
                int __ret = !!(condition);
                int __save_errno = errno;
                if (__ret) {
                        test__fail();
                        fprintf(stdout, "%s:FAIL:%d\n", __func__, __LINE__);
                }
                errno = __save_errno;
                __ret;
        })

Replace occurences of RET_IF with CHECK. This will abort the test binary if clearing the intermediate state fails.

Fixes 634efb750435 ("selftests: bpf: Reset global state between reuseport test runs")
---
 tools/testing/selftests/bpf/test_select_reuseport.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/bpf/test_select_reuseport.c +4 -4
index cdbbdab2725f..b14d25bfa830 100644
@@ -616,13 +616,13 @@ static void cleanup_per_test(void)
 
 	for (i = 0; i < NR_RESULTS; i++) {
 		err = bpf_map_update_elem(result_map, &i, &zero, BPF_ANY);
-		RET_IF(err, "reset elem in result_map",
-		       "i:%u err:%d errno:%d\n", i, err, errno);
+		CHECK(err, "reset elem in result_map",
+		      "i:%u err:%d errno:%d\n", i, err, errno);
 	}
 
 	err = bpf_map_update_elem(linum_map, &zero, &zero, BPF_ANY);
-	RET_IF(err, "reset line number in linum_map", "err:%d errno:%d\n",
-	       err, errno);
+	CHECK(err, "reset line number in linum_map", "err:%d errno:%d\n",
+	      err, errno);
 
 	for (i = 0; i < REUSEPORT_ARRAY_SIZE; i++)
 		close(sk_fds[i]);
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 24 lines · Lorenz Bauer

commit 634efb750435 ("selftests: bpf: Reset global state between reuseport test runs") uses a macro RET_IF which doesn't exist in the v4.19 tree. It is defined as follows:

       #define RET_IF(condition, tag, format...) ({
               if (CHECK_FAIL(condition)) {
                       printf(tag " " format);
                       return;
               }
       })

CHECK_FAIL in turn is defined as:

       #define CHECK_FAIL(condition) ({
               int __ret = !!(condition);
               int __save_errno = errno;
               if (__ret) {
                       test__fail();
                       fprintf(stdout, "%s:FAIL:%d\n", __func__, __LINE__);
               }
               errno = __save_errno;
               __ret;
       })
Quoted 6 lines

Replace occurences of RET_IF with CHECK. This will abort the test binary if clearing the intermediate state fails.

Fixes 634efb750435 ("selftests: bpf: Reset global state between reuseport test runs")

Thanks for the backport Lorenz. We'll need to wait for it to make it into Linus's tree before queueing up for the stable trees.

Signature · 2 lines
Thanks,
Sasha
#2 lore raw
Quoted 29 lines · Sasha Levin
Quoted 27 lines · Lorenz Bauer

commit 634efb750435 ("selftests: bpf: Reset global state between reuseport test runs") uses a macro RET_IF which doesn't exist in the v4.19 tree. It is defined as follows:

       #define RET_IF(condition, tag, format...) ({
               if (CHECK_FAIL(condition)) {
                       printf(tag " " format);
                       return;
               }
       })

CHECK_FAIL in turn is defined as:

       #define CHECK_FAIL(condition) ({
               int __ret = !!(condition);
               int __save_errno = errno;
               if (__ret) {
                       test__fail();
                       fprintf(stdout, "%s:FAIL:%d\n", __func__, __LINE__);
               }
               errno = __save_errno;
               __ret;
       })

Replace occurences of RET_IF with CHECK. This will abort the test binary if clearing the intermediate state fails.

Quoted 6 lines
Quoted 3 lines
Fixes 634efb750435 ("selftests: bpf: Reset global state between reuseport test runs")

Thanks for the backport Lorenz. We'll need to wait for it to make it into Linus's tree before queueing up for the stable trees.

Apologies for sending the patch too early (?), I'm still new to this process. I've just hit this on 4.19.127. Do you want me to re-submit the patch somewhere?

Lorenz

Signature · 4 lines
Lorenz Bauer  |  Systems Engineer
6th Floor, County Hall/The Riverside Building, SE1 7PB, UK

www.cloudflare.com
maintainer
#3 lore raw
Quoted 34 lines · Lorenz Bauer
Quoted 33 lines · Sasha Levin
Quoted 30 lines · Lorenz Bauer

commit 634efb750435 ("selftests: bpf: Reset global state between reuseport test runs") uses a macro RET_IF which doesn't exist in the v4.19 tree. It is defined as follows:

       #define RET_IF(condition, tag, format...) ({
               if (CHECK_FAIL(condition)) {
                       printf(tag " " format);
                       return;
               }
       })

CHECK_FAIL in turn is defined as:

       #define CHECK_FAIL(condition) ({
               int __ret = !!(condition);
               int __save_errno = errno;
               if (__ret) {
                       test__fail();
                       fprintf(stdout, "%s:FAIL:%d\n", __func__, __LINE__);
               }
               errno = __save_errno;
               __ret;
       })

Replace occurences of RET_IF with CHECK. This will abort the test binary if clearing the intermediate state fails.

Fixes 634efb750435 ("selftests: bpf: Reset global state between reuseport test runs")
Quoted 5 lines
Quoted 2 lines

Thanks for the backport Lorenz. We'll need to wait for it to make it into Linus's tree before queueing up for the stable trees.

Apologies for sending the patch too early (?), I'm still new to this process. I've just hit this on 4.19.127. Do you want me to re-submit the patch somewhere?

Is this patch in Linus's tree yet? If so, just tell us the git commit id. If not, it needs to go there first before we can take it to any stable tree.

thanks,

greg k-h

#4 lore raw
Quoted 39 lines · Greg KH
Quoted 37 lines · Lorenz Bauer
Quoted 35 lines · Sasha Levin
Quoted 24 lines · Lorenz Bauer

commit 634efb750435 ("selftests: bpf: Reset global state between reuseport test runs") uses a macro RET_IF which doesn't exist in the v4.19 tree. It is defined as follows:

       #define RET_IF(condition, tag, format...) ({
               if (CHECK_FAIL(condition)) {
                       printf(tag " " format);
                       return;
               }
       })

CHECK_FAIL in turn is defined as:

       #define CHECK_FAIL(condition) ({
               int __ret = !!(condition);
               int __save_errno = errno;
               if (__ret) {
                       test__fail();
                       fprintf(stdout, "%s:FAIL:%d\n", __func__, __LINE__);
               }
               errno = __save_errno;
               __ret;
       })
Quoted 6 lines

Replace occurences of RET_IF with CHECK. This will abort the test binary if clearing the intermediate state fails.

Fixes 634efb750435 ("selftests: bpf: Reset global state between reuseport test runs")

Thanks for the backport Lorenz. We'll need to wait for it to make it into Linus's tree before queueing up for the stable trees.

Quoted 6 lines
Quoted 2 lines

Apologies for sending the patch too early (?), I'm still new to this process. I've just hit this on 4.19.127. Do you want me to re-submit the patch somewhere?

Is this patch in Linus's tree yet? If so, just tell us the git commit id. If not, it needs to go there first before we can take it to any stable tree.

The patch isn't in Linus' tree because the problem doesn't exist there. It fixes a build problem on
v4.19 which was introduced by the backport of an earlier fix of mine, commit 634efb750435
("selftests: bpf: Reset global state between reuseport test runs").

There is a similar fix from Andrii Nakryiko that went into 5.4 as commit aee43146cc10
("selftest/bpf: fix backported test_select_reuseport selftest changes"), which I hadn't seen
at the time.

Lorenz

Signature · 4 lines
Lorenz Bauer  |  Systems Engineer
6th Floor, County Hall/The Riverside Building, SE1 7PB, UK

www.cloudflare.com
maintainer
#5 lore raw
Quoted 53 lines · Lorenz Bauer
Quoted 39 lines · Greg KH
Quoted 37 lines · Lorenz Bauer
Quoted 35 lines · Sasha Levin
Quoted 24 lines · Lorenz Bauer

commit 634efb750435 ("selftests: bpf: Reset global state between reuseport test runs") uses a macro RET_IF which doesn't exist in the v4.19 tree. It is defined as follows:

       #define RET_IF(condition, tag, format...) ({
               if (CHECK_FAIL(condition)) {
                       printf(tag " " format);
                       return;
               }
       })

CHECK_FAIL in turn is defined as:

       #define CHECK_FAIL(condition) ({
               int __ret = !!(condition);
               int __save_errno = errno;
               if (__ret) {
                       test__fail();
                       fprintf(stdout, "%s:FAIL:%d\n", __func__, __LINE__);
               }
               errno = __save_errno;
               __ret;
       })
Quoted 6 lines

Replace occurences of RET_IF with CHECK. This will abort the test binary if clearing the intermediate state fails.

Fixes 634efb750435 ("selftests: bpf: Reset global state between reuseport test runs")

Thanks for the backport Lorenz. We'll need to wait for it to make it into Linus's tree before queueing up for the stable trees.

Quoted 6 lines
Quoted 2 lines

Apologies for sending the patch too early (?), I'm still new to this process. I've just hit this on 4.19.127. Do you want me to re-submit the patch somewhere?

Is this patch in Linus's tree yet? If so, just tell us the git commit id. If not, it needs to go there first before we can take it to any stable tree.

The patch isn't in Linus' tree because the problem doesn't exist there. It fixes a build problem on
v4.19 which was introduced by the backport of an earlier fix of mine, commit 634efb750435
("selftests: bpf: Reset global state between reuseport test runs").

Quoted 5 lines

There is a similar fix from Andrii Nakryiko that went into 5.4 as commit aee43146cc10
("selftest/bpf: fix backported test_select_reuseport selftest changes"), which I hadn't seen
at the time.

Ah, ok, that wasn't very obvious, sorry. I'll queue this up after the next round of kernels are released in a day or so...

thanks,

greg k-h

#6 lore raw
Quoted 55 lines · Greg KH
Quoted 53 lines · Lorenz Bauer
Quoted 39 lines · Greg KH
Quoted 37 lines · Lorenz Bauer
Quoted 35 lines · Sasha Levin
Quoted 24 lines · Lorenz Bauer

commit 634efb750435 ("selftests: bpf: Reset global state between reuseport test runs") uses a macro RET_IF which doesn't exist in the v4.19 tree. It is defined as follows:

       #define RET_IF(condition, tag, format...) ({
               if (CHECK_FAIL(condition)) {
                       printf(tag " " format);
                       return;
               }
       })

CHECK_FAIL in turn is defined as:

       #define CHECK_FAIL(condition) ({
               int __ret = !!(condition);
               int __save_errno = errno;
               if (__ret) {
                       test__fail();
                       fprintf(stdout, "%s:FAIL:%d\n", __func__, __LINE__);
               }
               errno = __save_errno;
               __ret;
       })
Quoted 6 lines

Replace occurences of RET_IF with CHECK. This will abort the test binary if clearing the intermediate state fails.

Fixes 634efb750435 ("selftests: bpf: Reset global state between reuseport test runs")

Thanks for the backport Lorenz. We'll need to wait for it to make it into Linus's tree before queueing up for the stable trees.

Quoted 6 lines
Quoted 2 lines

Apologies for sending the patch too early (?), I'm still new to this process. I've just hit this on 4.19.127. Do you want me to re-submit the patch somewhere?

Is this patch in Linus's tree yet? If so, just tell us the git commit id. If not, it needs to go there first before we can take it to any stable tree.

The patch isn't in Linus' tree because the problem doesn't exist there. It fixes a build problem on
v4.19 which was introduced by the backport of an earlier fix of mine, commit 634efb750435
("selftests: bpf: Reset global state between reuseport test runs").

Quoted 8 lines
Quoted 5 lines

There is a similar fix from Andrii Nakryiko that went into 5.4 as commit aee43146cc10
("selftest/bpf: fix backported test_select_reuseport selftest changes"), which I hadn't seen
at the time.

Ah, ok, that wasn't very obvious, sorry. I'll queue this up after the next round of kernels are released in a day or so...

No, it was my bad. What can I do to avoid this next time? I've tried to follow the -stable FAQ, but that didn't work as you can see ;)

Lorenz

Signature · 4 lines
Lorenz Bauer  |  Systems Engineer
6th Floor, County Hall/The Riverside Building, SE1 7PB, UK

www.cloudflare.com
maintainer
#7 lore raw
Quoted 62 lines · Lorenz Bauer
Quoted 61 lines · Greg KH
Quoted 58 lines · Lorenz Bauer
Quoted 39 lines · Greg KH
Quoted 37 lines · Lorenz Bauer
Quoted 35 lines · Sasha Levin
Quoted 24 lines · Lorenz Bauer

commit 634efb750435 ("selftests: bpf: Reset global state between reuseport test runs") uses a macro RET_IF which doesn't exist in the v4.19 tree. It is defined as follows:

       #define RET_IF(condition, tag, format...) ({
               if (CHECK_FAIL(condition)) {
                       printf(tag " " format);
                       return;
               }
       })

CHECK_FAIL in turn is defined as:

       #define CHECK_FAIL(condition) ({
               int __ret = !!(condition);
               int __save_errno = errno;
               if (__ret) {
                       test__fail();
                       fprintf(stdout, "%s:FAIL:%d\n", __func__, __LINE__);
               }
               errno = __save_errno;
               __ret;
       })
Quoted 6 lines

Replace occurences of RET_IF with CHECK. This will abort the test binary if clearing the intermediate state fails.

Fixes 634efb750435 ("selftests: bpf: Reset global state between reuseport test runs")

Thanks for the backport Lorenz. We'll need to wait for it to make it into Linus's tree before queueing up for the stable trees.

Quoted 6 lines
Quoted 2 lines

Apologies for sending the patch too early (?), I'm still new to this process. I've just hit this on 4.19.127. Do you want me to re-submit the patch somewhere?

Is this patch in Linus's tree yet? If so, just tell us the git commit id. If not, it needs to go there first before we can take it to any stable tree.

The patch isn't in Linus' tree because the problem doesn't exist there. It fixes a build problem on
v4.19 which was introduced by the backport of an earlier fix of mine, commit 634efb750435
("selftests: bpf: Reset global state between reuseport test runs").

There is a similar fix from Andrii Nakryiko that went into 5.4 as commit aee43146cc10
("selftest/bpf: fix backported test_select_reuseport selftest changes"), which I hadn't seen
at the time.

Quoted 4 lines
Quoted 2 lines

Ah, ok, that wasn't very obvious, sorry. I'll queue this up after the next round of kernels are released in a day or so...

No, it was my bad. What can I do to avoid this next time?

Be _VERY_ explicit as to why this is only a 4.19 patch, and what this means, and why it is so. We see hundreds of patches a day, and almost none of them are this type of "special" case, so it must have to stand-out as you are doing something not very usual.

thanks,

greg k-h