hugemmap15 pre-release testing
cover hugemmap15 pre-release testing
Hi all,
it'd be good to merge tomorrow, to have it in upcoming release.
Kind regards,
Petr
Petr Vorel (2):
hugemmap15: Compile with -O
hugemmap15.c: Use TST_TEST_TCONF() for unsupported archs
testcases/kernel/mem/hugetlb/hugemmap/Makefile | 2 +- testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-)
Signature · 5 lines
2.39.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 1/2 hugemmap15: Compile with -O
-O0 originally used causes warning on gcc 12:
In file included from /usr/include/bits/libc-header-start.h:33,
from /usr/include/stdio.h:27,
from hugemmap15.c:22:/usr/include/features.h:412:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
412 | # warning _FORTIFY_SOURCE requires compiling with optimization (-O)
--- testcases/kernel/mem/hugetlb/hugemmap/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/mem/hugetlb/hugemmap/Makefile +1 -1
@@ -8,5 +8,5 @@ include $(top_srcdir)/include/mk/testcases.mk include $(abs_srcdir)/../Makefile.inc include $(top_srcdir)/include/mk/generic_leaf_target.mk -hugemmap15: CFLAGS+=-O0 +hugemmap15: CFLAGS+=-O hugemmap06: CFLAGS+=-pthread
Signature · 5 lines
2.39.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 1/2] hugemmap15: Compile with -O
Hi Petr, Cyril, all
Though It already got merged, please note this,
IIRC, I specifically turned off optimization for hugemmap15 because of clang compiler issue, it behaves weirdly with clang without -O0 and test fails on the system.
Quoted 31 lines · Petr Vorel
-O0 originally used causes warning on gcc 12:
In file included from
/usr/include/bits/libc-header-start.h:33,from /usr/include/stdio.h:27, from hugemmap15.c:22:
/usr/include/features.h:412:4: warning: #warning_FORTIFY_SOURCErequires compiling with optimization (-O) [-Wcpp]
412 | # warning_FORTIFY_SOURCErequires compiling with optimization (-O)Fixes 15625f6185 ("Hugetlb: Migrating libhugetlbfs icache-hygiene")Signed-off-by Petr Vorel <[email protected]>--- testcases/kernel/mem/hugetlb/hugemmap/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)testcases/kernel/mem/hugetlb/hugemmap/Makefile +1
-1@@ -8,5 +8,5 @@ include $(top_srcdir)/include/mk/testcases.mk include $(abs_srcdir)/../Makefile.inc include $(top_srcdir)/include/mk/generic_leaf_target.mk -hugemmap15: CFLAGS+=-O0 +hugemmap15: CFLAGS+=-O hugemmap06: CFLAGS+=-pthreadSignature · 5 lines
2.39.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 1/2] hugemmap15: Compile with -O
Hi Tarun,
Quoted 3 lines
Hi Petr, Cyril, all
Though It already got merged, please note this,
FYI this has not been merged (only the second patch "hugemmap15: Use TST_TEST_TCONF() for unsupported archs", which was needed to fix compilations).
Quoted 3 lines
IIRC, I specifically turned off optimization for hugemmap15 because of clang compiler issue, it behaves weirdly with clang without -O0 and test fails on the system.
Isn't -O the same as -O0 ?
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 1/2] hugemmap15: Compile with -O
Quoted 7 lines · Petr Vorel
Hi Tarun,
Quoted 3 lines
Hi Petr, Cyril, all
Though It already got merged, please note this,
FYI this has not been merged (only the second patch "hugemmap15: Use
TST_TEST_TCONF()for unsupported archs", which was needed to fix compilations).
Ok.
Quoted 6 lines
Quoted 4 lines
IIRC, I specifically turned off optimization for hugemmap15 because of clang compiler issue, it behaves weirdly with clang without -O0 and test fails on the system.
Isn't -O the same as -O0 ?
I think -O is -O1.
I tested with clang with -O, it fails. So yeah it is not turning off relevant optimization.
Quoted 6 lines
Kind regards,
PetrSignature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 1/2] hugemmap15: Compile with -O
Hi all,
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Though It already got merged, please note this,
FYI this has not been merged (only the second patch "hugemmap15: Use
TST_TEST_TCONF()for unsupported archs", which was needed to fix compilations).Ok.
And don't worry, this will not be merged before release, which is going to happen hopefully today (or on Monday).
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
IIRC, I specifically turned off optimization for hugemmap15 because of clang compiler issue, it behaves weirdly with clang without -O0 and test fails on the system.
Isn't -O the same as -O0 ?
I think -O is -O1.
Yes, -O Equivalent to -O1 [1].
Quoted 2 lines
I tested with clang with -O, it fails. So yeah it is not turning off relevant optimization.
Yes, you're right. It worked for me, but after full cleanup it really failed with -O or -O1 (at least on x86_64 on clang 15.0.7).
@Cyril: I wonder why we need
1) -D_FORTIFY_SOURCE=2 for all (in CPPFLAGS), defined in m4/ltp-fortify_source.m4, this will warn, when we need to disable optimisation for some test? -D_FORTIFY_SOURCE=0 obviously warn for redefinition.
It was added in 2013 (4b3007a8e1), not sure which glibc version required it, but maybe time to drop it? (after release of course)
2) to use CPPFLAGS and CFLAGS together?
Kind regards,
Petr
[1] https://clang.llvm.org/docs/CommandGuide/clang.html
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 1/2] hugemmap15: Compile with -O
In reply to Tarun SahuHi!
Quoted 2 lines
I tested with clang with -O, it fails. So yeah it is not turning off relevant optimization.
There seems to be pragma to turn off optimizations only for clang, can you try if adding:
#pragma clang optimize off
to the source and removeing the -O0 from the Makefile works?
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 1/2] hugemmap15: Compile with -O
Cyril Hrubis <[email protected]> writes:
Hi Cyril,
I tested with pragma, This works well.
Will send a patch.
Thanks
Tarun
Quoted 17 lines
Hi!
Quoted 2 lines
I tested with clang with -O, it fails. So yeah it is not turning off relevant optimization.
There seems to be pragma to turn off optimizations only for clang, can you try if adding:
#pragma clang optimize off
to the source and removeing the -O0 from the
Makefileworks?Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 1/1 hugepage15: Resolve compile time warning generating with -O0
In reply to Petr VorelInstead of turning off the optimizaton with -O0 to resolve unwanted behaviour of clang with goto statements, this will make use of clang pragma to turn off the optimization for just clang compiler. This way, gcc won't throw unwanted warning on turning off optimization:
"warning: _FORTIFY_SOURCE requires compiling with optimization (-O)".
Also, removed redundant header-includes.
--- testcases/kernel/mem/hugetlb/hugemmap/Makefile | 1 - testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c | 12 ++++-------- 2 files changed, 4 insertions(+), 9 deletions(-)
testcases/kernel/mem/hugetlb/hugemmap/Makefile +0 -1
@@ -8,5 +8,4 @@ include $(top_srcdir)/include/mk/testcases.mk include $(abs_srcdir)/../Makefile.inc include $(top_srcdir)/include/mk/generic_leaf_target.mk -hugemmap15: CFLAGS+=-O0 hugemmap06: CFLAGS+=-pthread
testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c +4 -8
@@ -18,17 +18,13 @@* remap, or because the icache happens to get flushed in the interim. */ +#if defined(__clang__) +#pragma clang optimize off +#endif +#define _GNU_SOURCE -#include <stdio.h> -#include <stdlib.h> #include <setjmp.h> -#include <unistd.h> #include <signal.h> -#include <sys/mman.h> -#include <ucontext.h> -#include <limits.h> -#include <sys/param.h> -#include <sys/types.h> #include "hugetlb.h"
Signature · 5 lines
2.31.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH] hugepage15: Resolve compile time warning generating with -O0
Hi Tarun,
Quoted 5 lines
Instead of turning off the optimizaton with -O0 to resolve unwanted behaviour of clang with goto statements, this will make use of clang pragma to turn off the optimization for just clang compiler. This way, gcc won't throw unwanted warning on turning off optimization:
"warning:_FORTIFY_SOURCErequires compiling with optimization (-O)".
Thanks!
Quoted 1 line
Also, removed redundant header-includes.
BTW this does not apply because there was change which is not in your fork:
1106777cd ("hugemmap15: Use TST_TEST_TCONF() for unsupported archs")
No need to repost, but please always rebase to current master before posting
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH] hugepage15: Resolve compile time warning generating with -O0
In reply to Tarun SahuThanks for reviewing it, Petr.
Sent the re-based version.
Quoted 58 lines · Tarun Sahu
Instead of turning off the optimizaton with -O0 to resolve unwanted behaviour of clang with goto statements, this will make use of clang pragma to turn off the optimization for just clang compiler. This way, gcc won't throw unwanted warning on turning off optimization:
"warning:_FORTIFY_SOURCErequires compiling with optimization (-O)".Also, removed redundant header-includes.
Reported-by Petr Vorel <[email protected]>Suggested-by Cyril Hrubis <[email protected]>Signed-off-by Tarun Sahu <[email protected]>--- testcases/kernel/mem/hugetlb/hugemmap/Makefile | 1 - testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c | 12 ++++-------- 2 files changed, 4 insertions(+), 9 deletions(-)testcases/kernel/mem/hugetlb/hugemmap/Makefile +0
-1@@ -8,5 +8,4 @@ include $(top_srcdir)/include/mk/testcases.mk include $(abs_srcdir)/../Makefile.inc include $(top_srcdir)/include/mk/generic_leaf_target.mk -hugemmap15: CFLAGS+=-O0 hugemmap06: CFLAGS+=-pthreadtestcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c +4
-8@@ -18,17 +18,13 @@* remap, or because the icache happens to get flushed in the interim. */ +#if defined(__clang__) +#pragma clang optimize off +#endif +#define _GNU_SOURCE -#include <stdio.h> -#include <stdlib.h> #include <setjmp.h> -#include <unistd.h> #include <signal.h> -#include <sys/mman.h> -#include <ucontext.h> -#include <limits.h> -#include <sys/param.h> -#include <sys/types.h> #include "hugetlb.h" Signature · 5 lines
2.31.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 1/1 hugepage15: Resolve compile time warning generating with -O0
In reply to Petr VorelInstead of turning off the optimizaton with -O0 to resolve unwanted behaviour of clang with goto statements, this will make use of clang pragma to turn off the optimization for just clang compiler. This way, gcc won't throw unwanted warning on turning off optimization:
"warning: _FORTIFY_SOURCE requires compiling with optimization (-O)".
Also, removed redundant header-includes.
---
v2:
- rebase and added Reviewed-by
testcases/kernel/mem/hugetlb/hugemmap/Makefile | 1 - testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c | 13 ++++--------- 2 files changed, 4 insertions(+), 10 deletions(-)
testcases/kernel/mem/hugetlb/hugemmap/Makefile +0 -1
@@ -8,5 +8,4 @@ include $(top_srcdir)/include/mk/testcases.mk include $(abs_srcdir)/../Makefile.inc include $(top_srcdir)/include/mk/generic_leaf_target.mk -hugemmap15: CFLAGS+=-O0 hugemmap06: CFLAGS+=-pthread
testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c +4 -9
@@ -19,6 +19,10 @@* remap, or because the icache happens to get flushed in the interim. */ +#if defined(__clang__) +#pragma clang optimize off +#endif +#define _GNU_SOURCE#include "hugetlb.h"
@@ -27,16 +31,7 @@defined (__aarch64__) || (defined (__riscv) && __riscv_xlen ==64 ) || \ defined(__i386__) || defined(__x86_64__) || defined(__arm__) -#include <stdio.h> -#include <stdlib.h> #include <setjmp.h> -#include <unistd.h> -#include <signal.h> -#include <sys/mman.h> -#include <ucontext.h> -#include <limits.h> -#include <sys/param.h> -#include <sys/types.h> #define SUCC_JMP 1#define FAIL_JMP 2
Signature · 5 lines
2.31.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2] hugepage15: Resolve compile time warning generating with -O0
Hi Tarun,
thanks for rebasing. I dared to separate include change into it's own commit (merged as 2 commits).
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 2/2 hugemmap15.c: Use TST_TEST_TCONF() for unsupported archs
In reply to Petr Vorel15625f6185 broke LTP build at least on riscv32 and mipsel32 (and for any new arch in the future). Replace #error directive with TST_TEST_TCONF() fixes that.
--- testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c +10 -4
@@ -19,6 +19,13 @@*/ #define _GNU_SOURCE + +#include "hugetlb.h" +#if defined(__powerpc__) || defined(__powerpc64__) || defined(__ia64__) || \ + defined(__s390__) || defined(__s390x__) || defined(__sparc__) || \ + defined(__aarch64__) || (defined(__riscv) && __riscv_xlen ==64 ) || \ + defined(__i386__) || defined(__x86_64__) || defined(__arm__) +#include <stdio.h> #include <stdlib.h> #include <setjmp.h>
@@ -30,8 +37,6 @@#include <sys/param.h> #include <sys/types.h> -#include "hugetlb.h" -#define SUCC_JMP 1#define FAIL_JMP 2#define COPY_SIZE 128
@@ -142,8 +147,6 @@ static void sig_handler(int signum, siginfo_t *si, void *uc)siglongjmp (sig_escape,FAIL_JMP +SIGSEGV ); }#endif -#else -#error "Need to setup signal conditions for this arch"#endif }
@@ -241,3 +244,6 @@ static struct tst_test test = { .test_all = run_test, .hugepages = {3, TST_NEEDS}, }; +#else + TST_TEST_TCONF("Architecture not supported"); +#endif
Signature · 5 lines
2.39.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 2/2] hugemmap15.c: Use TST_TEST_TCONF() for unsupported archs
Hi!
Quoted 47 lines
15625f6185broke LTP build at least on riscv32 and mipsel32 (and for any new arch in the future). Replace #error directive withTST_TEST_TCONF()fixes that.Fixes 15625f6185 ("Hugetlb: Migrating libhugetlbfs icache-hygiene")Signed-off-by Petr Vorel <[email protected]>--- testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c +7
-4@@ -19,6 +19,13 @@*/ #define _GNU_SOURCE + +#include "hugetlb.h" +#if defined(__powerpc__) || defined(__powerpc64__) || defined(__ia64__) || \ + defined(__s390__) || defined(__s390x__) || defined(__sparc__) || \ + defined(__aarch64__) || (defined(__riscv) && __riscv_xlen ==64 ) || \ + defined(__i386__) || defined(__x86_64__) || defined(__arm__) +#include <stdio.h> #include <stdlib.h> #include <setjmp.h> @@ -30,8 +37,6 @@#include <sys/param.h> #include <sys/types.h> -#include "hugetlb.h" -#define SUCC_JMP 1#define FAIL_JMP 2#define COPY_SIZE 128@@ -142,8 +147,6 @@ static void sig_handler(int signum, siginfo_t *si, void *uc)siglongjmp (sig_escape,FAIL_JMP +SIGSEGV ); }#endif -#else -#error "Need to setup signal conditions for this arch"#endif }
testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c static struct tst_test test = { · line 248
Quoted 5 lines
testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c +2
-0@@ -241,3 +244,6 @@ static struct tst_test test = { .test_all = run_test, .hugepages = {3, TST_NEEDS}, }; +#else + TST_TEST_TCONF("Architecture not supported");
^
Maybe I would change this to be closer to the original, so that it's clear that a piece of code needs to be written for the test to be enabled and that this is not inherently not supported
Something as:
TST_TEST_TCONF("Signal handler for this architecture hasn't been written");Other than this it looks fine, with a better message:
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 2/2] hugemmap15.c: Use TST_TEST_TCONF() for unsupported archs
Hi Cyril,
...
Quoted 9 lines
testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c static struct tst_test test = { · line 248
Quoted 2 lines
testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c +2
-0+#else +TST_TEST_TCONF ("Architecture not supported" );^
Maybe I would change this to be closer to the original, so that it's clear that a piece of code needs to be written for the test to be enabled and that this is not inherently not supported
Quoted 3 lines
Something as:
TST_TEST_TCONF("Signal handler for this architecture hasn't been written");
Very good idea, thanks!
I wait little longer for more input and merge later today.
Kind regards,
Petr
Quoted 3 lines
Other than this it looks fine, with a better message:
Reviewed-by Cyril Hrubis <[email protected]>
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 2/2] hugemmap15.c: Use TST_TEST_TCONF() for unsupported archs
Hi all,
FYI merged.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp