All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 0/2] hugemmap15 pre-release testing
@ 2023-01-25 22:27 Petr Vorel
  2023-01-25 22:27 ` [LTP] [PATCH 1/2] hugemmap15: Compile with -O Petr Vorel
  2023-01-25 22:27 ` [LTP] [PATCH 2/2] hugemmap15.c: Use TST_TEST_TCONF() for unsupported archs Petr Vorel
  0 siblings, 2 replies; 17+ messages in thread
From: Petr Vorel @ 2023-01-25 22:27 UTC (permalink / raw)
  To: ltp; +Cc: Richard Palethorpe

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(-)

-- 
2.39.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [LTP] [PATCH 1/2] hugemmap15: Compile with -O
  2023-01-25 22:27 [LTP] [PATCH 0/2] hugemmap15 pre-release testing Petr Vorel
@ 2023-01-25 22:27 ` Petr Vorel
  2023-01-26 21:05   ` Tarun Sahu
                     ` (2 more replies)
  2023-01-25 22:27 ` [LTP] [PATCH 2/2] hugemmap15.c: Use TST_TEST_TCONF() for unsupported archs Petr Vorel
  1 sibling, 3 replies; 17+ messages in thread
From: Petr Vorel @ 2023-01-25 22:27 UTC (permalink / raw)
  To: ltp; +Cc: Richard Palethorpe

-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)

Fixes: 15625f6185 ("Hugetlb: Migrating libhugetlbfs icache-hygiene")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/mem/hugetlb/hugemmap/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/mem/hugetlb/hugemmap/Makefile b/testcases/kernel/mem/hugetlb/hugemmap/Makefile
index 6f10807cde..503a35f7f1 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/Makefile
+++ b/testcases/kernel/mem/hugetlb/hugemmap/Makefile
@@ -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
-- 
2.39.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [LTP] [PATCH 2/2] hugemmap15.c: Use TST_TEST_TCONF() for unsupported archs
  2023-01-25 22:27 [LTP] [PATCH 0/2] hugemmap15 pre-release testing Petr Vorel
  2023-01-25 22:27 ` [LTP] [PATCH 1/2] hugemmap15: Compile with -O Petr Vorel
@ 2023-01-25 22:27 ` Petr Vorel
  2023-01-26 10:35   ` Cyril Hrubis
  1 sibling, 1 reply; 17+ messages in thread
From: Petr Vorel @ 2023-01-25 22:27 UTC (permalink / raw)
  To: ltp; +Cc: Richard Palethorpe

15625f6185 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.

Fixes: 15625f6185 ("Hugetlb: Migrating libhugetlbfs icache-hygiene")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
index 4730d8d184..836225acd8 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
@@ -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
-- 
2.39.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [LTP] [PATCH 2/2] hugemmap15.c: Use TST_TEST_TCONF() for unsupported archs
  2023-01-25 22:27 ` [LTP] [PATCH 2/2] hugemmap15.c: Use TST_TEST_TCONF() for unsupported archs Petr Vorel
@ 2023-01-26 10:35   ` Cyril Hrubis
  2023-01-26 10:36     ` Petr Vorel
  0 siblings, 1 reply; 17+ messages in thread
From: Cyril Hrubis @ 2023-01-26 10:35 UTC (permalink / raw)
  To: Petr Vorel; +Cc: Richard Palethorpe, ltp

Hi!
> 15625f6185 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.
> 
> Fixes: 15625f6185 ("Hugetlb: Migrating libhugetlbfs icache-hygiene")
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
> index 4730d8d184..836225acd8 100644
> --- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
> +++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
> @@ -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");
                          ^
			  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:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [LTP] [PATCH 2/2] hugemmap15.c: Use TST_TEST_TCONF() for unsupported archs
  2023-01-26 10:35   ` Cyril Hrubis
@ 2023-01-26 10:36     ` Petr Vorel
  2023-01-26 17:55       ` Petr Vorel
  0 siblings, 1 reply; 17+ messages in thread
From: Petr Vorel @ 2023-01-26 10:36 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: Richard Palethorpe, ltp

Hi Cyril,

...
> > +#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");

Very good idea, thanks!
I wait little longer for more input and merge later today.

Kind regards,
Petr

> Other than this it looks fine, with a better message:

> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [LTP] [PATCH 2/2] hugemmap15.c: Use TST_TEST_TCONF() for unsupported archs
  2023-01-26 10:36     ` Petr Vorel
@ 2023-01-26 17:55       ` Petr Vorel
  0 siblings, 0 replies; 17+ messages in thread
From: Petr Vorel @ 2023-01-26 17:55 UTC (permalink / raw)
  To: Cyril Hrubis, Richard Palethorpe, ltp

Hi all,

FYI merged.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [LTP] [PATCH 1/2] hugemmap15: Compile with -O
  2023-01-25 22:27 ` [LTP] [PATCH 1/2] hugemmap15: Compile with -O Petr Vorel
@ 2023-01-26 21:05   ` Tarun Sahu
  2023-01-26 23:00     ` Petr Vorel
  2023-02-10 22:33   ` [LTP] [PATCH] hugepage15: Resolve compile time warning generating with -O0 Tarun Sahu
  2023-02-13 15:26   ` [LTP] [PATCH v2] " Tarun Sahu
  2 siblings, 1 reply; 17+ messages in thread
From: Tarun Sahu @ 2023-01-26 21:05 UTC (permalink / raw)
  To: Petr Vorel, ltp; +Cc: Richard Palethorpe

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.

Petr Vorel <pvorel@suse.cz> writes:

> -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)
>
> Fixes: 15625f6185 ("Hugetlb: Migrating libhugetlbfs icache-hygiene")
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/kernel/mem/hugetlb/hugemmap/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/mem/hugetlb/hugemmap/Makefile b/testcases/kernel/mem/hugetlb/hugemmap/Makefile
> index 6f10807cde..503a35f7f1 100644
> --- a/testcases/kernel/mem/hugetlb/hugemmap/Makefile
> +++ b/testcases/kernel/mem/hugetlb/hugemmap/Makefile
> @@ -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
> -- 
> 2.39.1
>
>
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [LTP] [PATCH 1/2] hugemmap15: Compile with -O
  2023-01-26 21:05   ` Tarun Sahu
@ 2023-01-26 23:00     ` Petr Vorel
  2023-01-26 23:38       ` Tarun Sahu
  0 siblings, 1 reply; 17+ messages in thread
From: Petr Vorel @ 2023-01-26 23:00 UTC (permalink / raw)
  To: Tarun Sahu; +Cc: Richard Palethorpe, ltp

Hi Tarun,

> 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).

> 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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [LTP] [PATCH 1/2] hugemmap15: Compile with -O
  2023-01-26 23:00     ` Petr Vorel
@ 2023-01-26 23:38       ` Tarun Sahu
  2023-01-27  8:28         ` Petr Vorel
  2023-01-27  9:20         ` Cyril Hrubis
  0 siblings, 2 replies; 17+ messages in thread
From: Tarun Sahu @ 2023-01-26 23:38 UTC (permalink / raw)
  To: Petr Vorel; +Cc: Richard Palethorpe, ltp

Petr Vorel <pvorel@suse.cz> writes:

> Hi Tarun,
>
>> 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.
>
>> 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.

>
> Kind regards,
> Petr
>
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [LTP] [PATCH 1/2] hugemmap15: Compile with -O
  2023-01-26 23:38       ` Tarun Sahu
@ 2023-01-27  8:28         ` Petr Vorel
  2023-01-27  9:20         ` Cyril Hrubis
  1 sibling, 0 replies; 17+ messages in thread
From: Petr Vorel @ 2023-01-27  8:28 UTC (permalink / raw)
  To: Tarun Sahu, Cyril Hrubis; +Cc: Richard Palethorpe, ltp

Hi 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.
And don't worry, this will not be merged before release,
which is going to happen hopefully today (or on Monday).

> >> 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].

> 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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [LTP] [PATCH 1/2] hugemmap15: Compile with -O
  2023-01-26 23:38       ` Tarun Sahu
  2023-01-27  8:28         ` Petr Vorel
@ 2023-01-27  9:20         ` Cyril Hrubis
  2023-02-10 22:04           ` Tarun Sahu
  1 sibling, 1 reply; 17+ messages in thread
From: Cyril Hrubis @ 2023-01-27  9:20 UTC (permalink / raw)
  To: Tarun Sahu; +Cc: Richard Palethorpe, ltp

Hi!
> 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?

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [LTP] [PATCH 1/2] hugemmap15: Compile with -O
  2023-01-27  9:20         ` Cyril Hrubis
@ 2023-02-10 22:04           ` Tarun Sahu
  0 siblings, 0 replies; 17+ messages in thread
From: Tarun Sahu @ 2023-02-10 22:04 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: Richard Palethorpe, ltp

Cyril Hrubis <chrubis@suse.cz> writes:

Hi Cyril,

I tested with pragma, This works well.
Will send a patch.

Thanks
Tarun
> Hi!
>> 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?
>
> -- 
> Cyril Hrubis
> chrubis@suse.cz
>
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [LTP] [PATCH] hugepage15: Resolve compile time warning generating with -O0
  2023-01-25 22:27 ` [LTP] [PATCH 1/2] hugemmap15: Compile with -O Petr Vorel
  2023-01-26 21:05   ` Tarun Sahu
@ 2023-02-10 22:33   ` Tarun Sahu
  2023-02-12 21:34     ` Petr Vorel
  2023-02-13 15:29     ` Tarun Sahu
  2023-02-13 15:26   ` [LTP] [PATCH v2] " Tarun Sahu
  2 siblings, 2 replies; 17+ messages in thread
From: Tarun Sahu @ 2023-02-10 22:33 UTC (permalink / raw)
  To: ltp

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_SOURCE requires compiling with optimization (-O)".

Also, removed redundant header-includes.

Reported-by: Petr Vorel <pvorel@suse.cz>
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Tarun Sahu <tsahu@linux.ibm.com>
---
 testcases/kernel/mem/hugetlb/hugemmap/Makefile     |  1 -
 testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c | 12 ++++--------
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/testcases/kernel/mem/hugetlb/hugemmap/Makefile b/testcases/kernel/mem/hugetlb/hugemmap/Makefile
index 6f10807cd..2d651b4aa 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/Makefile
+++ b/testcases/kernel/mem/hugetlb/hugemmap/Makefile
@@ -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
diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
index 4730d8d18..aae234135 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
@@ -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"
 
-- 
2.31.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [LTP] [PATCH] hugepage15: Resolve compile time warning generating with -O0
  2023-02-10 22:33   ` [LTP] [PATCH] hugepage15: Resolve compile time warning generating with -O0 Tarun Sahu
@ 2023-02-12 21:34     ` Petr Vorel
  2023-02-13 15:29     ` Tarun Sahu
  1 sibling, 0 replies; 17+ messages in thread
From: Petr Vorel @ 2023-02-12 21:34 UTC (permalink / raw)
  To: Tarun Sahu; +Cc: ltp

Hi Tarun,

> 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_SOURCE requires compiling with optimization (-O)".

Thanks!

Reviewed-by: Petr Vorel <petr.vorel@gmail.com>

> 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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [LTP] [PATCH v2] hugepage15: Resolve compile time warning generating with -O0
  2023-01-25 22:27 ` [LTP] [PATCH 1/2] hugemmap15: Compile with -O Petr Vorel
  2023-01-26 21:05   ` Tarun Sahu
  2023-02-10 22:33   ` [LTP] [PATCH] hugepage15: Resolve compile time warning generating with -O0 Tarun Sahu
@ 2023-02-13 15:26   ` Tarun Sahu
  2023-02-13 17:26     ` Petr Vorel
  2 siblings, 1 reply; 17+ messages in thread
From: Tarun Sahu @ 2023-02-13 15:26 UTC (permalink / raw)
  To: ltp

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_SOURCE requires compiling with optimization (-O)".

Also, removed redundant header-includes.

Reported-by: Petr Vorel <pvorel@suse.cz>
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Tarun Sahu <tsahu@linux.ibm.com>
---
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(-)

diff --git a/testcases/kernel/mem/hugetlb/hugemmap/Makefile b/testcases/kernel/mem/hugetlb/hugemmap/Makefile
index 6f10807cd..2d651b4aa 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/Makefile
+++ b/testcases/kernel/mem/hugetlb/hugemmap/Makefile
@@ -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
diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
index 07e65a160..4d1984070 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
@@ -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
-- 
2.31.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [LTP] [PATCH] hugepage15: Resolve compile time warning generating with -O0
  2023-02-10 22:33   ` [LTP] [PATCH] hugepage15: Resolve compile time warning generating with -O0 Tarun Sahu
  2023-02-12 21:34     ` Petr Vorel
@ 2023-02-13 15:29     ` Tarun Sahu
  1 sibling, 0 replies; 17+ messages in thread
From: Tarun Sahu @ 2023-02-13 15:29 UTC (permalink / raw)
  To: ltp


Thanks for reviewing it, Petr.
Sent the re-based version.

Tarun Sahu <tsahu@linux.ibm.com> writes:

> 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_SOURCE requires compiling with optimization (-O)".
>
> Also, removed redundant header-includes.
>
> Reported-by: Petr Vorel <pvorel@suse.cz>
> Suggested-by: Cyril Hrubis <chrubis@suse.cz>
> Signed-off-by: Tarun Sahu <tsahu@linux.ibm.com>
> ---
>  testcases/kernel/mem/hugetlb/hugemmap/Makefile     |  1 -
>  testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c | 12 ++++--------
>  2 files changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/testcases/kernel/mem/hugetlb/hugemmap/Makefile b/testcases/kernel/mem/hugetlb/hugemmap/Makefile
> index 6f10807cd..2d651b4aa 100644
> --- a/testcases/kernel/mem/hugetlb/hugemmap/Makefile
> +++ b/testcases/kernel/mem/hugetlb/hugemmap/Makefile
> @@ -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
> diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
> index 4730d8d18..aae234135 100644
> --- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
> +++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
> @@ -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"
>  
> -- 
> 2.31.1
>
>
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [LTP] [PATCH v2] hugepage15: Resolve compile time warning generating with -O0
  2023-02-13 15:26   ` [LTP] [PATCH v2] " Tarun Sahu
@ 2023-02-13 17:26     ` Petr Vorel
  0 siblings, 0 replies; 17+ messages in thread
From: Petr Vorel @ 2023-02-13 17:26 UTC (permalink / raw)
  To: Tarun Sahu; +Cc: ltp

Hi Tarun,

thanks for rebasing. I dared to separate include change into it's own commit
(merged as 2 commits).

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2023-02-13 17:26 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-25 22:27 [LTP] [PATCH 0/2] hugemmap15 pre-release testing Petr Vorel
2023-01-25 22:27 ` [LTP] [PATCH 1/2] hugemmap15: Compile with -O Petr Vorel
2023-01-26 21:05   ` Tarun Sahu
2023-01-26 23:00     ` Petr Vorel
2023-01-26 23:38       ` Tarun Sahu
2023-01-27  8:28         ` Petr Vorel
2023-01-27  9:20         ` Cyril Hrubis
2023-02-10 22:04           ` Tarun Sahu
2023-02-10 22:33   ` [LTP] [PATCH] hugepage15: Resolve compile time warning generating with -O0 Tarun Sahu
2023-02-12 21:34     ` Petr Vorel
2023-02-13 15:29     ` Tarun Sahu
2023-02-13 15:26   ` [LTP] [PATCH v2] " Tarun Sahu
2023-02-13 17:26     ` Petr Vorel
2023-01-25 22:27 ` [LTP] [PATCH 2/2] hugemmap15.c: Use TST_TEST_TCONF() for unsupported archs Petr Vorel
2023-01-26 10:35   ` Cyril Hrubis
2023-01-26 10:36     ` Petr Vorel
2023-01-26 17:55       ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.