linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] module: add modname being loaded to pr_debugs
       [not found] <20210506040019.1322778-1-jim.cromie@gmail.com>
@ 2021-05-06  4:00 ` Jim Cromie
  2021-05-06  4:00 ` [PATCH 2/4] module: add symbol-name to pr_debug Absolute symbol Jim Cromie
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: Jim Cromie @ 2021-05-06  4:00 UTC (permalink / raw)
  To: Jessica Yu, linux-kernel; +Cc: Jim Cromie

When enabled, pr_debugs in layout_sections() and move_module() write
~50 messages for each module loaded.  Add module name into the header
lines in that output.

no functional changes

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
 kernel/module.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index 30479355ab85..af2641b28d73 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2421,7 +2421,7 @@ static void layout_sections(struct module *mod, struct load_info *info)
 	for (i = 0; i < info->hdr->e_shnum; i++)
 		info->sechdrs[i].sh_entsize = ~0UL;
 
-	pr_debug("Core section allocation order:\n");
+	pr_debug("Core section allocation order for %s:\n", mod->name);
 	for (m = 0; m < ARRAY_SIZE(masks); ++m) {
 		for (i = 0; i < info->hdr->e_shnum; ++i) {
 			Elf_Shdr *s = &info->sechdrs[i];
@@ -2454,7 +2454,7 @@ static void layout_sections(struct module *mod, struct load_info *info)
 		}
 	}
 
-	pr_debug("Init section allocation order:\n");
+	pr_debug("Init section allocation order for %s:\n", mod->name);
 	for (m = 0; m < ARRAY_SIZE(masks); ++m) {
 		for (i = 0; i < info->hdr->e_shnum; ++i) {
 			Elf_Shdr *s = &info->sechdrs[i];
@@ -3375,7 +3375,7 @@ static int move_module(struct module *mod, struct load_info *info)
 		mod->init_layout.base = NULL;
 
 	/* Transfer each section which specifies SHF_ALLOC */
-	pr_debug("final section addresses:\n");
+	pr_debug("Final section addresses for %s:\n", mod->name);
 	for (i = 0; i < info->hdr->e_shnum; i++) {
 		void *dest;
 		Elf_Shdr *shdr = &info->sechdrs[i];
-- 
2.30.2


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

* [PATCH 2/4] module: add symbol-name to pr_debug Absolute symbol
       [not found] <20210506040019.1322778-1-jim.cromie@gmail.com>
  2021-05-06  4:00 ` [PATCH 1/4] module: add modname being loaded to pr_debugs Jim Cromie
@ 2021-05-06  4:00 ` Jim Cromie
  2021-05-06  4:00 ` [PATCH 3/4] module: add section-size to move_module pr_debug Jim Cromie
  2021-05-06  4:00 ` [PATCH 4/4] module: reduce already_uses pr_debug verbosity Jim Cromie
  3 siblings, 0 replies; 4+ messages in thread
From: Jim Cromie @ 2021-05-06  4:00 UTC (permalink / raw)
  To: Jessica Yu, linux-kernel; +Cc: Jim Cromie

Symbol name is likely to be at least as useful as the value (which is
written, and is usually 0), if one is looking at these messages.

no functional changes

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
 kernel/module.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index af2641b28d73..ab16b8da2555 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2300,8 +2300,8 @@ static int simplify_symbols(struct module *mod, const struct load_info *info)
 
 		case SHN_ABS:
 			/* Don't need to do anything */
-			pr_debug("Absolute symbol: 0x%08lx\n",
-			       (long)sym[i].st_value);
+			pr_debug("Absolute symbol: 0x%08lx %s\n",
+				 (long)sym[i].st_value, name);
 			break;
 
 		case SHN_LIVEPATCH:
-- 
2.30.2


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

* [PATCH 3/4] module: add section-size to move_module pr_debug
       [not found] <20210506040019.1322778-1-jim.cromie@gmail.com>
  2021-05-06  4:00 ` [PATCH 1/4] module: add modname being loaded to pr_debugs Jim Cromie
  2021-05-06  4:00 ` [PATCH 2/4] module: add symbol-name to pr_debug Absolute symbol Jim Cromie
@ 2021-05-06  4:00 ` Jim Cromie
  2021-05-06  4:00 ` [PATCH 4/4] module: reduce already_uses pr_debug verbosity Jim Cromie
  3 siblings, 0 replies; 4+ messages in thread
From: Jim Cromie @ 2021-05-06  4:00 UTC (permalink / raw)
  To: Jessica Yu, linux-kernel; +Cc: Jim Cromie

move_module() prints "Final section addresses for $modname".
So lets add those section addresses to the pr_debug(section name)s.

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
 kernel/module.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index ab16b8da2555..c3333b45d812 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -3393,8 +3393,8 @@ static int move_module(struct module *mod, struct load_info *info)
 			memcpy(dest, (void *)shdr->sh_addr, shdr->sh_size);
 		/* Update sh_addr to point to copy in image. */
 		shdr->sh_addr = (unsigned long)dest;
-		pr_debug("\t0x%lx %s\n",
-			 (long)shdr->sh_addr, info->secstrings + shdr->sh_name);
+		pr_debug("\t0x%lx 0x%.8lx %s\n", (long)shdr->sh_addr,
+			 (long)shdr->sh_size, info->secstrings + shdr->sh_name);
 	}
 
 	return 0;
-- 
2.30.2


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

* [PATCH 4/4] module: reduce already_uses pr_debug verbosity
       [not found] <20210506040019.1322778-1-jim.cromie@gmail.com>
                   ` (2 preceding siblings ...)
  2021-05-06  4:00 ` [PATCH 3/4] module: add section-size to move_module pr_debug Jim Cromie
@ 2021-05-06  4:00 ` Jim Cromie
  3 siblings, 0 replies; 4+ messages in thread
From: Jim Cromie @ 2021-05-06  4:00 UTC (permalink / raw)
  To: Jessica Yu, linux-kernel; +Cc: Jim Cromie

already_uses() is unnecessarily chatty.  For example,
`modprobe i915` yields 491 messages like:

  [   64.108744] i915 uses drm!

This is a normal situation, and isn't worth all the log entries.  The
!found pr_debug is kept, its more of an exceptional condition, and
seems worth a pr_debug.  I haven't seen it happen.

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
 kernel/module.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index c3333b45d812..dc1eda39ba96 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -772,10 +772,8 @@ static int already_uses(struct module *a, struct module *b)
 	struct module_use *use;
 
 	list_for_each_entry(use, &b->source_list, source_list) {
-		if (use->source == a) {
-			pr_debug("%s uses %s!\n", a->name, b->name);
+		if (use->source == a)
 			return 1;
-		}
 	}
 	pr_debug("%s does not use %s!\n", a->name, b->name);
 	return 0;
-- 
2.30.2


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

end of thread, other threads:[~2021-05-06  4:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210506040019.1322778-1-jim.cromie@gmail.com>
2021-05-06  4:00 ` [PATCH 1/4] module: add modname being loaded to pr_debugs Jim Cromie
2021-05-06  4:00 ` [PATCH 2/4] module: add symbol-name to pr_debug Absolute symbol Jim Cromie
2021-05-06  4:00 ` [PATCH 3/4] module: add section-size to move_module pr_debug Jim Cromie
2021-05-06  4:00 ` [PATCH 4/4] module: reduce already_uses pr_debug verbosity Jim Cromie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).