From: Kevin Brodsky kevin.brodsky@arm.com
[ Upstream commit 46036188ea1f5266df23a6149dea0df1c77cd1c7 ]
The mm kselftests are currently built with no optimisation (-O0). It's unclear why, and besides being obviously suboptimal, this also prevents the pkeys tests from working as intended. Let's build all the tests with -O2.
[kevin.brodsky@arm.com: silence unused-result warnings] Link: https://lkml.kernel.org/r/20250107170110.2819685-1-kevin.brodsky@arm.com Link: https://lkml.kernel.org/r/20241209095019.1732120-6-kevin.brodsky@arm.com Signed-off-by: Kevin Brodsky kevin.brodsky@arm.com Cc: Aruna Ramakrishna aruna.ramakrishna@oracle.com Cc: Catalin Marinas catalin.marinas@arm.com Cc: Dave Hansen dave.hansen@linux.intel.com Cc: Joey Gouly joey.gouly@arm.com Cc: Keith Lucas keith.lucas@oracle.com Cc: Ryan Roberts ryan.roberts@arm.com Cc: Shuah Khan shuah@kernel.org Signed-off-by: Andrew Morton akpm@linux-foundation.org (cherry picked from commit 46036188ea1f5266df23a6149dea0df1c77cd1c7) [Yifei: This commit also fix the failure of pkey_sighandler_tests_64, which is also in linux-6.12.y, thus backport this commit] Signed-off-by: Yifei Liu yifei.l.liu@oracle.com --- tools/testing/selftests/mm/Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile index 02e1204971b0..c0138cb19705 100644 --- a/tools/testing/selftests/mm/Makefile +++ b/tools/testing/selftests/mm/Makefile @@ -33,9 +33,16 @@ endif # LDLIBS. MAKEFLAGS += --no-builtin-rules
-CFLAGS = -Wall -I $(top_srcdir) $(EXTRA_CFLAGS) $(KHDR_INCLUDES) $(TOOLS_INCLUDES) +CFLAGS = -Wall -O2 -I $(top_srcdir) $(EXTRA_CFLAGS) $(KHDR_INCLUDES) $(TOOLS_INCLUDES) LDLIBS = -lrt -lpthread -lm
+# Some distributions (such as Ubuntu) configure GCC so that _FORTIFY_SOURCE is +# automatically enabled at -O1 or above. This triggers various unused-result +# warnings where functions such as read() or write() are called and their +# return value is not checked. Disable _FORTIFY_SOURCE to silence those +# warnings. +CFLAGS += -U_FORTIFY_SOURCE + TEST_GEN_FILES = cow TEST_GEN_FILES += compaction_test TEST_GEN_FILES += gup_longterm
On Mon, Feb 03, 2025 at 03:33:42PM -0800, Yifei Liu wrote:
From: Kevin Brodsky kevin.brodsky@arm.com
[ Upstream commit 46036188ea1f5266df23a6149dea0df1c77cd1c7 ]
The mm kselftests are currently built with no optimisation (-O0). It's unclear why, and besides being obviously suboptimal, this also prevents the pkeys tests from working as intended. Let's build all the tests with -O2.
[kevin.brodsky@arm.com: silence unused-result warnings] Link: https://lkml.kernel.org/r/20250107170110.2819685-1-kevin.brodsky@arm.com Link: https://lkml.kernel.org/r/20241209095019.1732120-6-kevin.brodsky@arm.com Signed-off-by: Kevin Brodsky kevin.brodsky@arm.com Cc: Aruna Ramakrishna aruna.ramakrishna@oracle.com Cc: Catalin Marinas catalin.marinas@arm.com Cc: Dave Hansen dave.hansen@linux.intel.com Cc: Joey Gouly joey.gouly@arm.com Cc: Keith Lucas keith.lucas@oracle.com Cc: Ryan Roberts ryan.roberts@arm.com Cc: Shuah Khan shuah@kernel.org Signed-off-by: Andrew Morton akpm@linux-foundation.org (cherry picked from commit 46036188ea1f5266df23a6149dea0df1c77cd1c7) [Yifei: This commit also fix the failure of pkey_sighandler_tests_64, which is also in linux-6.12.y, thus backport this commit]
You also need to provide a 6.13.y version, right?
Please resend both and we will be glad to queue them up.
thanks,
greg k-h
[ Sasha's backport helper bot ]
Hi,
The upstream commit SHA1 provided is correct: 46036188ea1f5266df23a6149dea0df1c77cd1c7
WARNING: Author mismatch between patch and upstream commit: Backport author: Yifei Liuyifei.l.liu@oracle.com Commit author: Kevin Brodskykevin.brodsky@arm.com
Status in newer kernel trees: 6.13.y | Not found 6.12.y | Not found
Note: The patch differs from the upstream commit: --- 1: 46036188ea1f5 ! 1: e96302cf58b1e selftests/mm: build with -O2 @@ Metadata ## Commit message ## selftests/mm: build with -O2
+ [ Upstream commit 46036188ea1f5266df23a6149dea0df1c77cd1c7 ] + The mm kselftests are currently built with no optimisation (-O0). It's unclear why, and besides being obviously suboptimal, this also prevents the pkeys tests from working as intended. Let's build all the tests with @@ Commit message Cc: Ryan Roberts ryan.roberts@arm.com Cc: Shuah Khan shuah@kernel.org Signed-off-by: Andrew Morton akpm@linux-foundation.org + (cherry picked from commit 46036188ea1f5266df23a6149dea0df1c77cd1c7) + [Yifei: This commit also fix the failure of pkey_sighandler_tests_64, + which is also in linux-6.12.y, thus backport this commit] + Signed-off-by: Yifei Liu yifei.l.liu@oracle.com
## tools/testing/selftests/mm/Makefile ## @@ tools/testing/selftests/mm/Makefile: endif @@ tools/testing/selftests/mm/Makefile: endif +# warnings. +CFLAGS += -U_FORTIFY_SOURCE + - KDIR ?= /lib/modules/$(shell uname -r)/build - ifneq (,$(wildcard $(KDIR)/Module.symvers)) - ifneq (,$(wildcard $(KDIR)/include/linux/page_frag_cache.h)) + TEST_GEN_FILES = cow + TEST_GEN_FILES += compaction_test + TEST_GEN_FILES += gup_longterm ---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-6.12.y | Success | Success |
linux-stable-mirror@lists.linaro.org