Skip to contentSkip to conversation

module: add modname being loaded to pr_debugs

PATCH New Jim Cromie 1 participant 4 messages May 6, 2021 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Jim Cromie

author
#1 lore raw

PATCH 1/4 module: add modname being loaded to pr_debugs

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

---
 kernel/module.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/module.c +3 -3
index 30479355ab85..af2641b28d73 100644
@@ -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];
Signature · 1 line
2.30.2
author
#2 lore raw

PATCH 2/4 module: add symbol-name to pr_debug Absolute symbol

In reply to a message not in the archive

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

---
 kernel/module.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/module.c +2 -2
index af2641b28d73..ab16b8da2555 100644
@@ -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:
Signature · 1 line
2.30.2
author
#3 lore raw

PATCH 3/4 module: add section-size to move_module pr_debug

In reply to a message not in the archive

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

---
 kernel/module.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/module.c +2 -2
index ab16b8da2555..c3333b45d812 100644
@@ -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;
Signature · 1 line
2.30.2
author
#4 lore raw

PATCH 4/4 module: reduce already_uses pr_debug verbosity

In reply to a message not in the archive

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.

---
 kernel/module.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/module.c +1 -3
index c3333b45d812..dc1eda39ba96 100644
@@ -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;
Signature · 1 line
2.30.2