Linux Modules
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	samitolvanen@google.com, petr.pavlu@suse.com,
	da.gomez@samsung.com, linux-modules@vger.kernel.org,
	patches@lists.linux.dev, linux-kernel@vger.kernel.org,
	mmaurer@google.com, arnd@arndb.de, deller@gmx.de,
	song@kernel.org
Subject: Re: [GIT PULL] Modules changes for v6.13-rc1
Date: Wed, 27 Nov 2024 19:10:07 -0800	[thread overview]
Message-ID: <Z0ffD62YLuVVrCGR@bombadil.infradead.org> (raw)
In-Reply-To: <Z0fdX6i3inNVJf-e@bombadil.infradead.org>

On Wed, Nov 27, 2024 at 07:02:55PM -0800, Luis Chamberlain wrote:
> I did. Multiple times.

I've split this up now in 2 parts, one with your fixes and then the
other boundary fixes which are not related.

From 8e4c903fa3079e1c05c9585f78c57e8067024d99 Mon Sep 17 00:00:00 2001
From: Luis Chamberlain <mcgrof@kernel.org>
Date: Wed, 27 Nov 2024 14:10:57 -0800
Subject: [PATCH 1/2] selftests: kallsyms: fix double build stupidity

The current arrangement will have the test modules rebuilt on
any make without having the script or code actually change.
Take Masahiro Yamada's suggested fix and cleanups on the Makefile
to fix this.

Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 lib/tests/module/Makefile | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/lib/tests/module/Makefile b/lib/tests/module/Makefile
index af5c27b996cb..2f3e1a772c2c 100644
--- a/lib/tests/module/Makefile
+++ b/lib/tests/module/Makefile
@@ -3,13 +3,12 @@ obj-$(CONFIG_TEST_KALLSYMS_B) += test_kallsyms_b.o
 obj-$(CONFIG_TEST_KALLSYMS_C) += test_kallsyms_c.o
 obj-$(CONFIG_TEST_KALLSYMS_D) += test_kallsyms_d.o
 
-$(obj)/%.c: FORCE
-	@$(kecho) "  GEN     $@"
-	$(Q)$(srctree)/lib/tests/module/gen_test_kallsyms.sh $@\
-		$(CONFIG_TEST_KALLSYMS_NUMSYMS) \
-		$(CONFIG_TEST_KALLSYMS_SCALE_FACTOR)
+quiet_cmd_gen_test_kallsyms = GEN     $@
+	cmd_gen_test_kallsyms = $< $@ \
+	$(CONFIG_TEST_KALLSYMS_NUMSYMS) \
+	$(CONFIG_TEST_KALLSYMS_SCALE_FACTOR)
 
-clean-files += test_kallsyms_a.c
-clean-files += test_kallsyms_b.c
-clean-files += test_kallsyms_c.c
-clean-files += test_kallsyms_d.c
+$(obj)/%.c: $(src)/gen_test_kallsyms.sh FORCE
+	$(call if_changed,gen_test_kallsyms)
+
+targets += $(foreach x, a b c d, test_kallsyms_$(x).c)
-- 
2.45.2


From e76c869f4f37eff4d91c749572104e2eb0953986 Mon Sep 17 00:00:00 2001
From: Luis Chamberlain <mcgrof@kernel.org>
Date: Wed, 27 Nov 2024 19:06:03 -0800
Subject: [PATCH 2/2] selftests: kallsyms: fix and clarify current test
 boundaries

Provide and clarify the existing ranges and what you should expect.
Fix the gen_test_kallsyms.sh script to accept different ranges.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 lib/Kconfig.debug                     | 32 ++++++++++++++++++++++++++-
 lib/tests/module/gen_test_kallsyms.sh |  9 ++++++--
 2 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index b5929721fc63..88fc93f4b142 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -2986,9 +2986,39 @@ config TEST_KALLSYMS_D
 	tristate
 	depends on m
 
+choice
+	prompt "Kallsym test range"
+	default TEST_KALLSYMS_LARGE
+	help
+	  Selecting something other than "Fast" will enable tests which slow
+	  down the build and may crash your build.
+
+config TEST_KALLSYMS_FAST
+	bool "Fast builds"
+	help
+	  You won't really be testing kallsysms, so this just helps fast builds
+	  when allmodconfig is used..
+
+config TEST_KALLSYMS_LARGE
+	bool "Enable testing kallsyms with large exports"
+	help
+	  This will enable larger number of symbols. This will slow down
+	  your build considerably.
+
+config TEST_KALLSYMS_MAX
+	bool "Known kallsysms limits"
+	help
+	  This will enable exports to the point we know we'll start crashing
+	  builds.
+
+endchoice
+
 config TEST_KALLSYMS_NUMSYMS
 	int "test kallsyms number of symbols"
-	default 100
+	range 2 10000
+	default 2 if TEST_KALLSYMS_FAST
+	default 100 if TEST_KALLSYMS_LARGE
+	default 10000 if TEST_KALLSYMS_MAX
 	help
 	  The number of symbols to create on TEST_KALLSYMS_A, only one of which
 	  module TEST_KALLSYMS_B will use. This also will be used
diff --git a/lib/tests/module/gen_test_kallsyms.sh b/lib/tests/module/gen_test_kallsyms.sh
index 3f2c626350ad..561dcac0f359 100755
--- a/lib/tests/module/gen_test_kallsyms.sh
+++ b/lib/tests/module/gen_test_kallsyms.sh
@@ -7,6 +7,11 @@ NUM_SYMS=$2
 SCALE_FACTOR=$3
 TEST_TYPE=$(echo $TARGET | sed -e 's|lib/tests/module/test_kallsyms_||g')
 TEST_TYPE=$(echo $TEST_TYPE | sed -e 's|.c||g')
+FIRST_B_LOOKUP=1
+
+if [[ $NUM_SYMS -gt 2 ]]; then
+	FIRST_B_LOOKUP=$((NUM_SYMS/2))
+fi
 
 gen_template_module_header()
 {
@@ -52,10 +57,10 @@ ____END_MODULE
 
 gen_template_module_data_b()
 {
-	printf "\nextern int auto_test_a_%010d;\n\n" 28
+	printf "\nextern int auto_test_a_%010d;\n\n" $FIRST_B_LOOKUP
 	echo "static int auto_runtime_test(void)"
 	echo "{"
-	printf "\nreturn auto_test_a_%010d;\n" 28
+	printf "\nreturn auto_test_a_%010d;\n" $FIRST_B_LOOKUP
 	echo "}"
 }
 
-- 
2.45.2


  reply	other threads:[~2024-11-28  3:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-27  1:10 [GIT PULL] Modules changes for v6.13-rc1 Luis Chamberlain
2024-11-27 18:33 ` pr-tracker-bot
2024-11-27 21:22 ` Linus Torvalds
2024-11-27 22:35   ` Luis Chamberlain
2024-11-27 23:26     ` Luis Chamberlain
2024-11-27 23:56       ` Linus Torvalds
2024-11-28  2:09         ` Masahiro Yamada
2024-11-28  2:38           ` Luis Chamberlain
2024-11-28  2:48             ` Masahiro Yamada
2024-11-28  2:22         ` Luis Chamberlain
2024-11-28  2:42           ` Luis Chamberlain
2024-11-28  2:56             ` Masahiro Yamada
2024-11-28  3:02               ` Luis Chamberlain
2024-11-28  3:10                 ` Luis Chamberlain [this message]
2024-11-28  3:14                   ` Masahiro Yamada
2024-11-28  3:12                 ` Masahiro Yamada
2024-11-28  2:44           ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z0ffD62YLuVVrCGR@bombadil.infradead.org \
    --to=mcgrof@kernel.org \
    --cc=arnd@arndb.de \
    --cc=da.gomez@samsung.com \
    --cc=deller@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=mmaurer@google.com \
    --cc=patches@lists.linux.dev \
    --cc=petr.pavlu@suse.com \
    --cc=samitolvanen@google.com \
    --cc=song@kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox