linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/13] replace print_symbol() with printk()-s
@ 2017-12-11 12:50 Sergey Senozhatsky
  2017-12-11 12:50 ` [PATCH 01/13] arm: do not use print_symbol() Sergey Senozhatsky
                   ` (15 more replies)
  0 siblings, 16 replies; 37+ messages in thread
From: Sergey Senozhatsky @ 2017-12-11 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

	Hello,

	A rather automatic replacement of print_symbol()
with direct printk() calls. print_symbol() uses extra stack
buffer (KSYM_SYMBOL_LEN 128 bytes) and, basically, should
be identical to printk(%pS).

	I can't test all of the patches, because I don't
own any of those exotic arch-s. Sorry for the inconvenience.

Sergey Senozhatsky (13):
  arm: do not use print_symbol()
  arm64: do not use print_symbol()
  c6x: do not use print_symbol()
  ia64: do not use print_symbol()
  mn10300: do not use print_symbol()
  sh: do not use print_symbol()
  unicore32: do not use print_symbol()
  x86: do not use print_symbol()
  drivers: do not use print_symbol()
  sysfs: do not use print_symbol()
  irq debug: do not use print_symbol()
  lib: do not use print_symbol()
  arc: do not use __print_symbol()

 arch/arc/kernel/stacktrace.c     |  2 +-
 arch/arm/kernel/process.c        |  5 ++---
 arch/arm64/kernel/process.c      |  5 ++---
 arch/c6x/kernel/traps.c          |  4 +---
 arch/ia64/kernel/process.c       | 10 +++-------
 arch/mn10300/kernel/traps.c      |  4 +---
 arch/sh/kernel/process_32.c      |  5 ++---
 arch/unicore32/kernel/process.c  |  5 ++---
 arch/x86/kernel/cpu/mcheck/mce.c |  3 +--
 arch/x86/mm/mmio-mod.c           |  5 ++---
 drivers/base/core.c              |  5 ++---
 fs/sysfs/file.c                  |  5 ++---
 kernel/irq/debug.h               |  8 +++-----
 lib/smp_processor_id.c           |  3 +--
 14 files changed, 25 insertions(+), 44 deletions(-)

-- 
2.15.1

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

* [PATCH 01/13] arm: do not use print_symbol()
  2017-12-11 12:50 [PATCH 00/13] replace print_symbol() with printk()-s Sergey Senozhatsky
@ 2017-12-11 12:50 ` Sergey Senozhatsky
  2017-12-11 12:50 ` [PATCH 02/13] arm64: " Sergey Senozhatsky
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 37+ messages in thread
From: Sergey Senozhatsky @ 2017-12-11 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

print_symbol() uses extra stack space to sprintf() symbol
information and then to feed that buffer to printk()

  char buffer[KSYM_SYMBOL_LEN];

  sprint_symbol(buffer, address);
  printk(fmt, buffer);

Replace print_symbol() with a direct printk("%pS") call.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Russell King <linux@armlinux.org.uk>
---
 arch/arm/kernel/process.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index d96714e1858c..db004f6f547a 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -21,7 +21,6 @@
 #include <linux/unistd.h>
 #include <linux/user.h>
 #include <linux/interrupt.h>
-#include <linux/kallsyms.h>
 #include <linux/init.h>
 #include <linux/elfcore.h>
 #include <linux/pm.h>
@@ -121,8 +120,8 @@ void __show_regs(struct pt_regs *regs)
 
 	show_regs_print_info(KERN_DEFAULT);
 
-	print_symbol("PC is at %s\n", instruction_pointer(regs));
-	print_symbol("LR is at %s\n", regs->ARM_lr);
+	printk("PC is at %pS\n", instruction_pointer(regs));
+	printk("LR is at %pS\n", (void *)regs->ARM_lr);
 	printk("pc : [<%08lx>]    lr : [<%08lx>]    psr: %08lx\n",
 	       regs->ARM_pc, regs->ARM_lr, regs->ARM_cpsr);
 	printk("sp : %08lx  ip : %08lx  fp : %08lx\n",
-- 
2.15.1

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

* [PATCH 02/13] arm64: do not use print_symbol()
  2017-12-11 12:50 [PATCH 00/13] replace print_symbol() with printk()-s Sergey Senozhatsky
  2017-12-11 12:50 ` [PATCH 01/13] arm: do not use print_symbol() Sergey Senozhatsky
@ 2017-12-11 12:50 ` Sergey Senozhatsky
  2017-12-11 12:50 ` [PATCH 03/13] c6x: " Sergey Senozhatsky
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 37+ messages in thread
From: Sergey Senozhatsky @ 2017-12-11 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

print_symbol() uses extra stack space to sprintf() symbol
information and then to feed that buffer to printk()

  char buffer[KSYM_SYMBOL_LEN];

  sprint_symbol(buffer, address);
  printk(fmt, buffer);

Replace print_symbol() with a direct printk("%pS") call.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
---
 arch/arm64/kernel/process.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index 6b7dcf4310ac..44bed43814e2 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -35,7 +35,6 @@
 #include <linux/delay.h>
 #include <linux/reboot.h>
 #include <linux/interrupt.h>
-#include <linux/kallsyms.h>
 #include <linux/init.h>
 #include <linux/cpu.h>
 #include <linux/elfcore.h>
@@ -221,8 +220,8 @@ void __show_regs(struct pt_regs *regs)
 
 	show_regs_print_info(KERN_DEFAULT);
 	print_pstate(regs);
-	print_symbol("pc : %s\n", regs->pc);
-	print_symbol("lr : %s\n", lr);
+	printk("pc : %pS\n", (void *)regs->pc);
+	printk("lr : %pS\n", (void *)lr);
 	printk("sp : %016llx\n", sp);
 
 	i = top_reg;
-- 
2.15.1

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

* [PATCH 03/13] c6x: do not use print_symbol()
  2017-12-11 12:50 [PATCH 00/13] replace print_symbol() with printk()-s Sergey Senozhatsky
  2017-12-11 12:50 ` [PATCH 01/13] arm: do not use print_symbol() Sergey Senozhatsky
  2017-12-11 12:50 ` [PATCH 02/13] arm64: " Sergey Senozhatsky
@ 2017-12-11 12:50 ` Sergey Senozhatsky
  2017-12-11 12:50 ` [PATCH 04/13] ia64: " Sergey Senozhatsky
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 37+ messages in thread
From: Sergey Senozhatsky @ 2017-12-11 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

print_symbol() uses extra stack space to sprintf() symbol
information and then to feed that buffer to printk()

  char buffer[KSYM_SYMBOL_LEN];

  sprint_symbol(buffer, address);
  printk(fmt, buffer);

Replace print_symbol() with a direct printk("%pS") call.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Mark Salter <msalter@redhat.com>
Cc: Aurelien Jacquiot <jacquiot.aurelien@gmail.com>
---
 arch/c6x/kernel/traps.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/c6x/kernel/traps.c b/arch/c6x/kernel/traps.c
index 09b8a40d5680..4c1d4b84dd2b 100644
--- a/arch/c6x/kernel/traps.c
+++ b/arch/c6x/kernel/traps.c
@@ -11,7 +11,6 @@
 #include <linux/module.h>
 #include <linux/ptrace.h>
 #include <linux/sched/debug.h>
-#include <linux/kallsyms.h>
 #include <linux/bug.h>
 
 #include <asm/soc.h>
@@ -375,8 +374,7 @@ static void show_trace(unsigned long *stack, unsigned long *endstack)
 			if (i % 5 == 0)
 				pr_debug("\n	    ");
 #endif
-			pr_debug(" [<%08lx>]", addr);
-			print_symbol(" %s\n", addr);
+			pr_debug(" [<%08lx>] %pS\n", addr, (void *)addr);
 			i++;
 		}
 	}
-- 
2.15.1

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

* [PATCH 04/13] ia64: do not use print_symbol()
  2017-12-11 12:50 [PATCH 00/13] replace print_symbol() with printk()-s Sergey Senozhatsky
                   ` (2 preceding siblings ...)
  2017-12-11 12:50 ` [PATCH 03/13] c6x: " Sergey Senozhatsky
@ 2017-12-11 12:50 ` Sergey Senozhatsky
  2017-12-11 12:50 ` [PATCH 05/13] mn10300: " Sergey Senozhatsky
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 37+ messages in thread
From: Sergey Senozhatsky @ 2017-12-11 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

print_symbol() uses extra stack space to sprintf() symbol
information and then to feed that buffer to printk()

  char buffer[KSYM_SYMBOL_LEN];

  sprint_symbol(buffer, address);
  printk(fmt, buffer);

Replace print_symbol() with a direct printk("%pS") call.

Additionally ia64_do_show_stack() had extra buffer [128
bytes on stack], which we also can drop now.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
---
 arch/ia64/kernel/process.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index dda0082056b3..968b5f33e725 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -13,7 +13,6 @@
 #include <linux/pm.h>
 #include <linux/elf.h>
 #include <linux/errno.h>
-#include <linux/kallsyms.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/slab.h>
@@ -69,7 +68,6 @@ void
 ia64_do_show_stack (struct unw_frame_info *info, void *arg)
 {
 	unsigned long ip, sp, bsp;
-	char buf[128];			/* don't make it so big that it overflows the stack! */
 
 	printk("\nCall Trace:\n");
 	do {
@@ -79,11 +77,9 @@ ia64_do_show_stack (struct unw_frame_info *info, void *arg)
 
 		unw_get_sp(info, &sp);
 		unw_get_bsp(info, &bsp);
-		snprintf(buf, sizeof(buf),
-			 " [<%016lx>] %%s\n"
+		printk(" [<%016lx>] %pS\n"
 			 "                                sp=%016lx bsp=%016lx\n",
-			 ip, sp, bsp);
-		print_symbol(buf, ip);
+			 ip, (void *)ip, sp, bsp);
 	} while (unw_unwind(info) >= 0);
 }
 
@@ -111,7 +107,7 @@ show_regs (struct pt_regs *regs)
 	printk("psr : %016lx ifs : %016lx ip  : [<%016lx>]    %s (%s)\n",
 	       regs->cr_ipsr, regs->cr_ifs, ip, print_tainted(),
 	       init_utsname()->release);
-	print_symbol("ip is at %s\n", ip);
+	printk("ip is at %pS\n", (void *)ip);
 	printk("unat: %016lx pfs : %016lx rsc : %016lx\n",
 	       regs->ar_unat, regs->ar_pfs, regs->ar_rsc);
 	printk("rnat: %016lx bsps: %016lx pr  : %016lx\n",
-- 
2.15.1

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

* [PATCH 05/13] mn10300: do not use print_symbol()
  2017-12-11 12:50 [PATCH 00/13] replace print_symbol() with printk()-s Sergey Senozhatsky
                   ` (3 preceding siblings ...)
  2017-12-11 12:50 ` [PATCH 04/13] ia64: " Sergey Senozhatsky
@ 2017-12-11 12:50 ` Sergey Senozhatsky
  2017-12-11 12:50 ` [PATCH 06/13] sh: " Sergey Senozhatsky
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 37+ messages in thread
From: Sergey Senozhatsky @ 2017-12-11 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

print_symbol() uses extra stack space to sprintf() symbol
information and then to feed that buffer to printk()

  char buffer[KSYM_SYMBOL_LEN];

  sprint_symbol(buffer, address);
  printk(fmt, buffer);

Replace print_symbol() with a direct printk("%pS") call.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: David Howells <dhowells@redhat.com>
---
 arch/mn10300/kernel/traps.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/mn10300/kernel/traps.c b/arch/mn10300/kernel/traps.c
index 800fd0801969..72d1015b2ae7 100644
--- a/arch/mn10300/kernel/traps.c
+++ b/arch/mn10300/kernel/traps.c
@@ -22,7 +22,6 @@
 #include <linux/delay.h>
 #include <linux/spinlock.h>
 #include <linux/interrupt.h>
-#include <linux/kallsyms.h>
 #include <linux/pci.h>
 #include <linux/kdebug.h>
 #include <linux/bug.h>
@@ -262,8 +261,7 @@ void show_trace(unsigned long *sp)
 				raslot = ULONG_MAX;
 			else
 				printk(" ?");
-			print_symbol(" %s", addr);
-			printk("\n");
+			printk(" %pS\n", (void *)addr);
 		}
 	}
 
-- 
2.15.1

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

* [PATCH 06/13] sh: do not use print_symbol()
  2017-12-11 12:50 [PATCH 00/13] replace print_symbol() with printk()-s Sergey Senozhatsky
                   ` (4 preceding siblings ...)
  2017-12-11 12:50 ` [PATCH 05/13] mn10300: " Sergey Senozhatsky
@ 2017-12-11 12:50 ` Sergey Senozhatsky
  2017-12-11 12:50 ` [PATCH 07/13] unicore32: " Sergey Senozhatsky
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 37+ messages in thread
From: Sergey Senozhatsky @ 2017-12-11 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

print_symbol() uses extra stack space to sprintf() symbol
information and then to feed that buffer to printk()

  char buffer[KSYM_SYMBOL_LEN];

  sprint_symbol(buffer, address);
  printk(fmt, buffer);

Replace print_symbol() with a direct printk("%pS") call.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
---
 arch/sh/kernel/process_32.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c
index 2c7bdf8cb934..5c88e7cb9c18 100644
--- a/arch/sh/kernel/process_32.c
+++ b/arch/sh/kernel/process_32.c
@@ -20,7 +20,6 @@
 #include <linux/sched/task_stack.h>
 #include <linux/slab.h>
 #include <linux/elfcore.h>
-#include <linux/kallsyms.h>
 #include <linux/fs.h>
 #include <linux/ftrace.h>
 #include <linux/hw_breakpoint.h>
@@ -37,8 +36,8 @@ void show_regs(struct pt_regs * regs)
 	printk("\n");
 	show_regs_print_info(KERN_DEFAULT);
 
-	print_symbol("PC is at %s\n", instruction_pointer(regs));
-	print_symbol("PR is at %s\n", regs->pr);
+	printk("PC is at %pS\n", instruction_pointer(regs));
+	printk("PR is at %pS\n", (void *)regs->pr);
 
 	printk("PC  : %08lx SP  : %08lx SR  : %08lx ",
 	       regs->pc, regs->regs[15], regs->sr);
-- 
2.15.1

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

* [PATCH 07/13] unicore32: do not use print_symbol()
  2017-12-11 12:50 [PATCH 00/13] replace print_symbol() with printk()-s Sergey Senozhatsky
                   ` (5 preceding siblings ...)
  2017-12-11 12:50 ` [PATCH 06/13] sh: " Sergey Senozhatsky
@ 2017-12-11 12:50 ` Sergey Senozhatsky
  2017-12-11 12:50 ` [PATCH 08/13] x86: " Sergey Senozhatsky
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 37+ messages in thread
From: Sergey Senozhatsky @ 2017-12-11 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

print_symbol() uses extra stack space to sprintf() symbol
information and then to feed that buffer to printk()

  char buffer[KSYM_SYMBOL_LEN];

  sprint_symbol(buffer, address);
  printk(fmt, buffer);

Replace print_symbol() with a direct printk("%pS") call.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
---
 arch/unicore32/kernel/process.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/unicore32/kernel/process.c b/arch/unicore32/kernel/process.c
index ddaf78ae6854..9a9d49bccc02 100644
--- a/arch/unicore32/kernel/process.c
+++ b/arch/unicore32/kernel/process.c
@@ -23,7 +23,6 @@
 #include <linux/delay.h>
 #include <linux/reboot.h>
 #include <linux/interrupt.h>
-#include <linux/kallsyms.h>
 #include <linux/init.h>
 #include <linux/cpu.h>
 #include <linux/elfcore.h>
@@ -139,8 +138,8 @@ void __show_regs(struct pt_regs *regs)
 	char buf[64];
 
 	show_regs_print_info(KERN_DEFAULT);
-	print_symbol("PC is at %s\n", instruction_pointer(regs));
-	print_symbol("LR is at %s\n", regs->UCreg_lr);
+	printk("PC is at %pS\n", instruction_pointer(regs));
+	printk("LR is at %pS\n", (void *)regs->UCreg_lr);
 	printk(KERN_DEFAULT "pc : [<%08lx>]    lr : [<%08lx>]    psr: %08lx\n"
 	       "sp : %08lx  ip : %08lx  fp : %08lx\n",
 		regs->UCreg_pc, regs->UCreg_lr, regs->UCreg_asr,
-- 
2.15.1

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

* [PATCH 08/13] x86: do not use print_symbol()
  2017-12-11 12:50 [PATCH 00/13] replace print_symbol() with printk()-s Sergey Senozhatsky
                   ` (6 preceding siblings ...)
  2017-12-11 12:50 ` [PATCH 07/13] unicore32: " Sergey Senozhatsky
@ 2017-12-11 12:50 ` Sergey Senozhatsky
  2017-12-11 17:45   ` Borislav Petkov
  2017-12-11 12:50 ` [PATCH 09/13] drivers: " Sergey Senozhatsky
                   ` (7 subsequent siblings)
  15 siblings, 1 reply; 37+ messages in thread
From: Sergey Senozhatsky @ 2017-12-11 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

print_symbol() uses extra stack space to sprintf() symbol
information and then to feed that buffer to printk()

  char buffer[KSYM_SYMBOL_LEN];

  sprint_symbol(buffer, address);
  printk(fmt, buffer);

Replace print_symbol() with a direct printk("%pS") call.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/kernel/cpu/mcheck/mce.c | 3 +--
 arch/x86/mm/mmio-mod.c           | 5 ++---
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index b1d616d08eee..8ca8f6eb32db 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -14,7 +14,6 @@
 #include <linux/capability.h>
 #include <linux/miscdevice.h>
 #include <linux/ratelimit.h>
-#include <linux/kallsyms.h>
 #include <linux/rcupdate.h>
 #include <linux/kobject.h>
 #include <linux/uaccess.h>
@@ -235,7 +234,7 @@ static void __print_mce(struct mce *m)
 			m->cs, m->ip);
 
 		if (m->cs == __KERNEL_CS)
-			print_symbol("{%s}", m->ip);
+			pr_cont("{%pS}", (void *)m->ip);
 		pr_cont("\n");
 	}
 
diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
index 4d434ddb75db..2c1ecf4763c4 100644
--- a/arch/x86/mm/mmio-mod.c
+++ b/arch/x86/mm/mmio-mod.c
@@ -29,7 +29,6 @@
 #include <linux/slab.h>
 #include <linux/uaccess.h>
 #include <linux/io.h>
-#include <linux/kallsyms.h>
 #include <asm/pgtable.h>
 #include <linux/mmiotrace.h>
 #include <asm/e820/api.h> /* for ISA_START_ADDRESS */
@@ -123,8 +122,8 @@ static void die_kmmio_nesting_error(struct pt_regs *regs, unsigned long addr)
 	pr_emerg("unexpected fault for address: 0x%08lx, last fault for address: 0x%08lx\n",
 		 addr, my_reason->addr);
 	print_pte(addr);
-	print_symbol(KERN_EMERG "faulting IP is at %s\n", regs->ip);
-	print_symbol(KERN_EMERG "last faulting IP was at %s\n", my_reason->ip);
+	pr_emerg("faulting IP is at %pS\n", (void *)regs->ip);
+	pr_emerg("last faulting IP was at %pS\n", (void *)my_reason->ip);
 #ifdef __i386__
 	pr_emerg("eax: %08lx   ebx: %08lx   ecx: %08lx   edx: %08lx\n",
 		 regs->ax, regs->bx, regs->cx, regs->dx);
-- 
2.15.1

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

* [PATCH 09/13] drivers: do not use print_symbol()
  2017-12-11 12:50 [PATCH 00/13] replace print_symbol() with printk()-s Sergey Senozhatsky
                   ` (7 preceding siblings ...)
  2017-12-11 12:50 ` [PATCH 08/13] x86: " Sergey Senozhatsky
@ 2017-12-11 12:50 ` Sergey Senozhatsky
  2017-12-11 12:50 ` [PATCH 10/13] sysfs: " Sergey Senozhatsky
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 37+ messages in thread
From: Sergey Senozhatsky @ 2017-12-11 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

print_symbol() uses extra stack space to sprintf() symbol
information and then to feed that buffer to printk()

  char buffer[KSYM_SYMBOL_LEN];

  sprint_symbol(buffer, address);
  printk(fmt, buffer);

Replace print_symbol() with a direct printk("%pS") call.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/base/core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index bf45587bcb46..36e20498159b 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -20,7 +20,6 @@
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/genhd.h>
-#include <linux/kallsyms.h>
 #include <linux/mutex.h>
 #include <linux/pm_runtime.h>
 #include <linux/netdevice.h>
@@ -685,8 +684,8 @@ static ssize_t dev_attr_show(struct kobject *kobj, struct attribute *attr,
 	if (dev_attr->show)
 		ret = dev_attr->show(dev, dev_attr, buf);
 	if (ret >= (ssize_t)PAGE_SIZE) {
-		print_symbol("dev_attr_show: %s returned bad count\n",
-				(unsigned long)dev_attr->show);
+		printk("dev_attr_show: %pS returned bad count\n",
+				dev_attr->show);
 	}
 	return ret;
 }
-- 
2.15.1

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

* [PATCH 10/13] sysfs: do not use print_symbol()
  2017-12-11 12:50 [PATCH 00/13] replace print_symbol() with printk()-s Sergey Senozhatsky
                   ` (8 preceding siblings ...)
  2017-12-11 12:50 ` [PATCH 09/13] drivers: " Sergey Senozhatsky
@ 2017-12-11 12:50 ` Sergey Senozhatsky
  2017-12-11 12:50 ` [PATCH 11/13] irq debug: " Sergey Senozhatsky
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 37+ messages in thread
From: Sergey Senozhatsky @ 2017-12-11 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

print_symbol() uses extra stack space to sprintf() symbol
information and then to feed that buffer to printk()

  char buffer[KSYM_SYMBOL_LEN];

  sprint_symbol(buffer, address);
  printk(fmt, buffer);

Replace print_symbol() with a direct printk("%pS") call.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/sysfs/file.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 39c75a86c67f..bfcbe486d385 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -12,7 +12,6 @@
 
 #include <linux/module.h>
 #include <linux/kobject.h>
-#include <linux/kallsyms.h>
 #include <linux/slab.h>
 #include <linux/list.h>
 #include <linux/mutex.h>
@@ -70,8 +69,8 @@ static int sysfs_kf_seq_show(struct seq_file *sf, void *v)
 	 * indicate truncated result or overflow in normal use cases.
 	 */
 	if (count >= (ssize_t)PAGE_SIZE) {
-		print_symbol("fill_read_buffer: %s returned bad count\n",
-			(unsigned long)ops->show);
+		printk("fill_read_buffer: %pS returned bad count\n",
+				ops->show);
 		/* Try to struggle along */
 		count = PAGE_SIZE - 1;
 	}
-- 
2.15.1

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

* [PATCH 11/13] irq debug: do not use print_symbol()
  2017-12-11 12:50 [PATCH 00/13] replace print_symbol() with printk()-s Sergey Senozhatsky
                   ` (9 preceding siblings ...)
  2017-12-11 12:50 ` [PATCH 10/13] sysfs: " Sergey Senozhatsky
@ 2017-12-11 12:50 ` Sergey Senozhatsky
  2017-12-11 12:55   ` David Laight
  2017-12-12  7:34   ` [PATCHv2 " Sergey Senozhatsky
  2017-12-11 12:50 ` [PATCH 12/13] lib: " Sergey Senozhatsky
                   ` (4 subsequent siblings)
  15 siblings, 2 replies; 37+ messages in thread
From: Sergey Senozhatsky @ 2017-12-11 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

print_symbol() uses extra stack space to sprintf() symbol
information and then to feed that buffer to printk()

  char buffer[KSYM_SYMBOL_LEN];

  sprint_symbol(buffer, address);
  printk(fmt, buffer);

Replace print_symbol() with a direct printk("%pS") call.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/irq/debug.h | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/kernel/irq/debug.h b/kernel/irq/debug.h
index 17f05ef8f575..5766e15c1160 100644
--- a/kernel/irq/debug.h
+++ b/kernel/irq/debug.h
@@ -3,8 +3,6 @@
  * Debugging printout:
  */
 
-#include <linux/kallsyms.h>
-
 #define ___P(f) if (desc->status_use_accessors & f) printk("%14s set\n", #f)
 #define ___PS(f) if (desc->istate & f) printk("%14s set\n", #f)
 /* FIXME */
@@ -15,13 +13,13 @@ static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
 	printk("irq %d, desc: %p, depth: %d, count: %d, unhandled: %d\n",
 		irq, desc, desc->depth, desc->irq_count, desc->irqs_unhandled);
 	printk("->handle_irq():  %p, ", desc->handle_irq);
-	print_symbol("%s\n", (unsigned long)desc->handle_irq);
+	pr_cont("%pS\n", desc->handle_irq);
 	printk("->irq_data.chip(): %p, ", desc->irq_data.chip);
-	print_symbol("%s\n", (unsigned long)desc->irq_data.chip);
+	pr_cont("%pS\n", desc->irq_data.chip);
 	printk("->action(): %p\n", desc->action);
 	if (desc->action) {
 		printk("->action->handler(): %p, ", desc->action->handler);
-		print_symbol("%s\n", (unsigned long)desc->action->handler);
+		pr_cont("%pS\n", desc->action->handler);
 	}
 
 	___P(IRQ_LEVEL);
-- 
2.15.1

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

* [PATCH 12/13] lib: do not use print_symbol()
  2017-12-11 12:50 [PATCH 00/13] replace print_symbol() with printk()-s Sergey Senozhatsky
                   ` (10 preceding siblings ...)
  2017-12-11 12:50 ` [PATCH 11/13] irq debug: " Sergey Senozhatsky
@ 2017-12-11 12:50 ` Sergey Senozhatsky
  2017-12-11 12:50 ` [PATCH 13/13] arc: do not use __print_symbol() Sergey Senozhatsky
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 37+ messages in thread
From: Sergey Senozhatsky @ 2017-12-11 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

print_symbol() uses extra stack space to sprintf() symbol
information and then to feed that buffer to printk()

  char buffer[KSYM_SYMBOL_LEN];

  sprint_symbol(buffer, address);
  printk(fmt, buffer);

Replace print_symbol() with a direct printk("%pS") call.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
 lib/smp_processor_id.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c
index 835cc6df2776..85925aaa4fff 100644
--- a/lib/smp_processor_id.c
+++ b/lib/smp_processor_id.c
@@ -5,7 +5,6 @@
  * DEBUG_PREEMPT variant of smp_processor_id().
  */
 #include <linux/export.h>
-#include <linux/kallsyms.h>
 #include <linux/sched.h>
 
 notrace static unsigned int check_preemption_disabled(const char *what1,
@@ -43,7 +42,7 @@ notrace static unsigned int check_preemption_disabled(const char *what1,
 	printk(KERN_ERR "BUG: using %s%s() in preemptible [%08x] code: %s/%d\n",
 		what1, what2, preempt_count() - 1, current->comm, current->pid);
 
-	print_symbol("caller is %s\n", (long)__builtin_return_address(0));
+	printk("caller is %pS\n", __builtin_return_address(0));
 	dump_stack();
 
 out_enable:
-- 
2.15.1

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

* [PATCH 13/13] arc: do not use __print_symbol()
  2017-12-11 12:50 [PATCH 00/13] replace print_symbol() with printk()-s Sergey Senozhatsky
                   ` (11 preceding siblings ...)
  2017-12-11 12:50 ` [PATCH 12/13] lib: " Sergey Senozhatsky
@ 2017-12-11 12:50 ` Sergey Senozhatsky
  2017-12-11 16:28   ` Vineet Gupta
  2017-12-11 16:26 ` [PATCH 00/13] replace print_symbol() with printk()-s Joe Perches
                   ` (2 subsequent siblings)
  15 siblings, 1 reply; 37+ messages in thread
From: Sergey Senozhatsky @ 2017-12-11 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

__print_symbol() uses extra stack space to sprintf() symbol
information and then to feed that buffer to printk()

  char buffer[KSYM_SYMBOL_LEN];

  sprint_symbol(buffer, address);
  printk(fmt, buffer);

Replace __print_symbol() with a direct printk("%pS") call.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
---
 arch/arc/kernel/stacktrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arc/kernel/stacktrace.c b/arch/arc/kernel/stacktrace.c
index 74315f302971..bf40e06f3fb8 100644
--- a/arch/arc/kernel/stacktrace.c
+++ b/arch/arc/kernel/stacktrace.c
@@ -163,7 +163,7 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs,
  */
 static int __print_sym(unsigned int address, void *unused)
 {
-	__print_symbol("  %s\n", address);
+	printk("  %pS\n", (void *)address);
 	return 0;
 }
 
-- 
2.15.1

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

* [PATCH 11/13] irq debug: do not use print_symbol()
  2017-12-11 12:50 ` [PATCH 11/13] irq debug: " Sergey Senozhatsky
@ 2017-12-11 12:55   ` David Laight
  2017-12-12  2:50     ` Sergey Senozhatsky
  2017-12-12  7:34   ` [PATCHv2 " Sergey Senozhatsky
  1 sibling, 1 reply; 37+ messages in thread
From: David Laight @ 2017-12-11 12:55 UTC (permalink / raw)
  To: linux-arm-kernel

From: Sergey Senozhatsky
> Sent: 11 December 2017 12:50
> print_symbol() uses extra stack space to sprintf() symbol
> information and then to feed that buffer to printk()
> 
>   char buffer[KSYM_SYMBOL_LEN];
> 
>   sprint_symbol(buffer, address);
>   printk(fmt, buffer);
> 
> Replace print_symbol() with a direct printk("%pS") call.
> 
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> ---
>  kernel/irq/debug.h | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/irq/debug.h b/kernel/irq/debug.h
> index 17f05ef8f575..5766e15c1160 100644
> --- a/kernel/irq/debug.h
> +++ b/kernel/irq/debug.h
...
> @@ -15,13 +13,13 @@ static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
>  	printk("irq %d, desc: %p, depth: %d, count: %d, unhandled: %d\n",
>  		irq, desc, desc->depth, desc->irq_count, desc->irqs_unhandled);
>  	printk("->handle_irq():  %p, ", desc->handle_irq);
> -	print_symbol("%s\n", (unsigned long)desc->handle_irq);
> +	pr_cont("%pS\n", desc->handle_irq);

Looks like you can (and should) use a single printk() instead of pr_cont.

	David

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

* [PATCH 00/13] replace print_symbol() with printk()-s
  2017-12-11 12:50 [PATCH 00/13] replace print_symbol() with printk()-s Sergey Senozhatsky
                   ` (12 preceding siblings ...)
  2017-12-11 12:50 ` [PATCH 13/13] arc: do not use __print_symbol() Sergey Senozhatsky
@ 2017-12-11 16:26 ` Joe Perches
  2017-12-12  2:47   ` Sergey Senozhatsky
  2017-12-20 10:20 ` Sergey Senozhatsky
  2018-01-05 10:03 ` Petr Mladek
  15 siblings, 1 reply; 37+ messages in thread
From: Joe Perches @ 2017-12-11 16:26 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 2017-12-11 at 21:50 +0900, Sergey Senozhatsky wrote:
> print_symbol

Yay.

Just about exactly 5 years earlier...
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-December/137121.html

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

* [PATCH 13/13] arc: do not use __print_symbol()
  2017-12-11 12:50 ` [PATCH 13/13] arc: do not use __print_symbol() Sergey Senozhatsky
@ 2017-12-11 16:28   ` Vineet Gupta
  2017-12-12  2:41     ` Sergey Senozhatsky
  0 siblings, 1 reply; 37+ messages in thread
From: Vineet Gupta @ 2017-12-11 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

On 12/11/2017 04:53 AM, Sergey Senozhatsky wrote:
> __print_symbol() uses extra stack space to sprintf() symbol
> information and then to feed that buffer to printk()
>
>    char buffer[KSYM_SYMBOL_LEN];
>
>    sprint_symbol(buffer, address);
>    printk(fmt, buffer);
>
> Replace __print_symbol() with a direct printk("%pS") call.
>
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> Cc: Vineet Gupta <vgupta@synopsys.com>

Applied to arc for-curr

Thx,
-Vineet

> ---
>   arch/arc/kernel/stacktrace.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arc/kernel/stacktrace.c b/arch/arc/kernel/stacktrace.c
> index 74315f302971..bf40e06f3fb8 100644
> --- a/arch/arc/kernel/stacktrace.c
> +++ b/arch/arc/kernel/stacktrace.c
> @@ -163,7 +163,7 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs,
>    */
>   static int __print_sym(unsigned int address, void *unused)
>   {
> -	__print_symbol("  %s\n", address);
> +	printk("  %pS\n", (void *)address);
>   	return 0;
>   }
>   

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

* [PATCH 08/13] x86: do not use print_symbol()
  2017-12-11 12:50 ` [PATCH 08/13] x86: " Sergey Senozhatsky
@ 2017-12-11 17:45   ` Borislav Petkov
  2017-12-12  2:41     ` Sergey Senozhatsky
  0 siblings, 1 reply; 37+ messages in thread
From: Borislav Petkov @ 2017-12-11 17:45 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Dec 11, 2017 at 09:50:20PM +0900, Sergey Senozhatsky wrote:
> print_symbol() uses extra stack space to sprintf() symbol
> information and then to feed that buffer to printk()
> 
>   char buffer[KSYM_SYMBOL_LEN];
> 
>   sprint_symbol(buffer, address);
>   printk(fmt, buffer);
> 
> Replace print_symbol() with a direct printk("%pS") call.
> 
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> Cc: Tony Luck <tony.luck@intel.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> ---
>  arch/x86/kernel/cpu/mcheck/mce.c | 3 +--
>  arch/x86/mm/mmio-mod.c           | 5 ++---
>  2 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
> index b1d616d08eee..8ca8f6eb32db 100644
> --- a/arch/x86/kernel/cpu/mcheck/mce.c
> +++ b/arch/x86/kernel/cpu/mcheck/mce.c
> @@ -14,7 +14,6 @@
>  #include <linux/capability.h>
>  #include <linux/miscdevice.h>
>  #include <linux/ratelimit.h>
> -#include <linux/kallsyms.h>
>  #include <linux/rcupdate.h>
>  #include <linux/kobject.h>
>  #include <linux/uaccess.h>
> @@ -235,7 +234,7 @@ static void __print_mce(struct mce *m)
>  			m->cs, m->ip);
>  
>  		if (m->cs == __KERNEL_CS)
> -			print_symbol("{%s}", m->ip);
> +			pr_cont("{%pS}", (void *)m->ip);
>  		pr_cont("\n");
>  	}
>  

For the mce.c bit above:

Acked-by: Borislav Petkov <bp@suse.de>

Thx.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

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

* [PATCH 13/13] arc: do not use __print_symbol()
  2017-12-11 16:28   ` Vineet Gupta
@ 2017-12-12  2:41     ` Sergey Senozhatsky
  0 siblings, 0 replies; 37+ messages in thread
From: Sergey Senozhatsky @ 2017-12-12  2:41 UTC (permalink / raw)
  To: linux-arm-kernel

On (12/11/17 08:28), Vineet Gupta wrote:
> On 12/11/2017 04:53 AM, Sergey Senozhatsky wrote:
> > __print_symbol() uses extra stack space to sprintf() symbol
> > information and then to feed that buffer to printk()
> > 
> >    char buffer[KSYM_SYMBOL_LEN];
> > 
> >    sprint_symbol(buffer, address);
> >    printk(fmt, buffer);
> > 
> > Replace __print_symbol() with a direct printk("%pS") call.
> > 
> > Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> > Cc: Vineet Gupta <vgupta@synopsys.com>
> 
> Applied to arc for-curr

thanks.

	-ss

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

* [PATCH 08/13] x86: do not use print_symbol()
  2017-12-11 17:45   ` Borislav Petkov
@ 2017-12-12  2:41     ` Sergey Senozhatsky
  0 siblings, 0 replies; 37+ messages in thread
From: Sergey Senozhatsky @ 2017-12-12  2:41 UTC (permalink / raw)
  To: linux-arm-kernel

On (12/11/17 18:45), Borislav Petkov wrote:
> For the mce.c bit above:
> 
> Acked-by: Borislav Petkov <bp@suse.de>

thanks.

	-ss

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

* [PATCH 00/13] replace print_symbol() with printk()-s
  2017-12-11 16:26 ` [PATCH 00/13] replace print_symbol() with printk()-s Joe Perches
@ 2017-12-12  2:47   ` Sergey Senozhatsky
  2017-12-12  3:10     ` Joe Perches
  0 siblings, 1 reply; 37+ messages in thread
From: Sergey Senozhatsky @ 2017-12-12  2:47 UTC (permalink / raw)
  To: linux-arm-kernel

On (12/11/17 08:26), Joe Perches wrote:
> On Mon, 2017-12-11 at 21:50 +0900, Sergey Senozhatsky wrote:
> > print_symbol
> 
> Yay.
> 
> Just about exactly 5 years earlier...
> http://lists.infradead.org/pipermail/linux-arm-kernel/2012-December/137121.html

indeed :)

hopefully it won't take us another 5 years to finally

---

 include/linux/kallsyms.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index 7288f9c395b6..794fd35cad4b 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -176,7 +176,8 @@ void __check_printsym_format(const char *fmt, ...)
 {
 }
 
-static inline void print_symbol(const char *fmt, unsigned long addr)
+static inline void __deprecated print_symbol(const char *fmt,
+					     unsigned long addr)
 {
 	__check_printsym_format(fmt, "");
 	__print_symbol(fmt, (unsigned long)

---

	-ss

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

* [PATCH 11/13] irq debug: do not use print_symbol()
  2017-12-11 12:55   ` David Laight
@ 2017-12-12  2:50     ` Sergey Senozhatsky
  0 siblings, 0 replies; 37+ messages in thread
From: Sergey Senozhatsky @ 2017-12-12  2:50 UTC (permalink / raw)
  To: linux-arm-kernel

On (12/11/17 12:55), David Laight wrote:
> >  kernel/irq/debug.h | 8 +++-----
> >  1 file changed, 3 insertions(+), 5 deletions(-)
> > 
> > diff --git a/kernel/irq/debug.h b/kernel/irq/debug.h
> > index 17f05ef8f575..5766e15c1160 100644
> > --- a/kernel/irq/debug.h
> > +++ b/kernel/irq/debug.h
> ...
> > @@ -15,13 +13,13 @@ static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
> >  	printk("irq %d, desc: %p, depth: %d, count: %d, unhandled: %d\n",
> >  		irq, desc, desc->depth, desc->irq_count, desc->irqs_unhandled);
> >  	printk("->handle_irq():  %p, ", desc->handle_irq);
> > -	print_symbol("%s\n", (unsigned long)desc->handle_irq);
> > +	pr_cont("%pS\n", desc->handle_irq);
> 
> Looks like you can (and should) use a single printk() instead of pr_cont.

thanks, good point. those pr_cont()-s basically just replicate
the old behaviour; but it'll be better to get tid of them. will
follow up shortly.

	-ss

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

* [PATCH 00/13] replace print_symbol() with printk()-s
  2017-12-12  2:47   ` Sergey Senozhatsky
@ 2017-12-12  3:10     ` Joe Perches
  2017-12-21  5:54       ` Sergey Senozhatsky
  0 siblings, 1 reply; 37+ messages in thread
From: Joe Perches @ 2017-12-12  3:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 2017-12-12 at 11:47 +0900, Sergey Senozhatsky wrote:
> On (12/11/17 08:26), Joe Perches wrote:
> > On Mon, 2017-12-11 at 21:50 +0900, Sergey Senozhatsky wrote:
> > > print_symbol
> > Yay.
> > Just about exactly 5 years earlier...
> > http://lists.infradead.org/pipermail/linux-arm-kernel/2012-December/137121.html
> 
> indeed :)
> 
> hopefully it won't take us another 5 years to finally
[]
> diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
[]
> -static inline void print_symbol(const char *fmt, unsigned long addr)
> +static inline void __deprecated print_symbol(const char *fmt,
> +					     unsigned long addr)
>  {
>  	__check_printsym_format(fmt, "");
>  	__print_symbol(fmt, (unsigned long)

As far as I'm concerned, as soon as there is
no longer a single user in the kernel tree,
better to delete it instead.

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

* [PATCHv2 11/13] irq debug: do not use print_symbol()
  2017-12-11 12:50 ` [PATCH 11/13] irq debug: " Sergey Senozhatsky
  2017-12-11 12:55   ` David Laight
@ 2017-12-12  7:34   ` Sergey Senozhatsky
  1 sibling, 0 replies; 37+ messages in thread
From: Sergey Senozhatsky @ 2017-12-12  7:34 UTC (permalink / raw)
  To: linux-arm-kernel

print_symbol() uses extra stack space to sprintf() symbol
information and then to feed that buffer to printk()

  char buffer[KSYM_SYMBOL_LEN];

  sprint_symbol(buffer, address);
  printk(fmt, buffer);

Replace print_symbol() with a direct printk("%pS") call.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/irq/debug.h | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/kernel/irq/debug.h b/kernel/irq/debug.h
index 17f05ef8f575..7e06dd275c17 100644
--- a/kernel/irq/debug.h
+++ b/kernel/irq/debug.h
@@ -3,8 +3,6 @@
  * Debugging printout:
  */
 
-#include <linux/kallsyms.h>
-
 #define ___P(f) if (desc->status_use_accessors & f) printk("%14s set\n", #f)
 #define ___PS(f) if (desc->istate & f) printk("%14s set\n", #f)
 /* FIXME */
@@ -14,14 +12,14 @@ static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
 {
 	printk("irq %d, desc: %p, depth: %d, count: %d, unhandled: %d\n",
 		irq, desc, desc->depth, desc->irq_count, desc->irqs_unhandled);
-	printk("->handle_irq():  %p, ", desc->handle_irq);
-	print_symbol("%s\n", (unsigned long)desc->handle_irq);
-	printk("->irq_data.chip(): %p, ", desc->irq_data.chip);
-	print_symbol("%s\n", (unsigned long)desc->irq_data.chip);
+	printk("->handle_irq():  %p, %pS\n",
+		desc->handle_irq, desc->handle_irq);
+	printk("->irq_data.chip(): %p, %pS\n",
+		desc->irq_data.chip, desc->irq_data.chip);
 	printk("->action(): %p\n", desc->action);
 	if (desc->action) {
-		printk("->action->handler(): %p, ", desc->action->handler);
-		print_symbol("%s\n", (unsigned long)desc->action->handler);
+		printk("->action->handler(): %p, %pS\n",
+			desc->action->handler, desc->action->handler);
 	}
 
 	___P(IRQ_LEVEL);
-- 
2.15.1

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

* [PATCH 00/13] replace print_symbol() with printk()-s
  2017-12-11 12:50 [PATCH 00/13] replace print_symbol() with printk()-s Sergey Senozhatsky
                   ` (13 preceding siblings ...)
  2017-12-11 16:26 ` [PATCH 00/13] replace print_symbol() with printk()-s Joe Perches
@ 2017-12-20 10:20 ` Sergey Senozhatsky
  2018-01-05 10:03 ` Petr Mladek
  15 siblings, 0 replies; 37+ messages in thread
From: Sergey Senozhatsky @ 2017-12-20 10:20 UTC (permalink / raw)
  To: linux-arm-kernel

On (12/11/17 21:50), Sergey Senozhatsky wrote:
> 
> 	A rather automatic replacement of print_symbol()
> with direct printk() calls. print_symbol() uses extra stack
> buffer (KSYM_SYMBOL_LEN 128 bytes) and, basically, should
> be identical to printk(%pS).
> 
> 	I can't test all of the patches, because I don't
> own any of those exotic arch-s. Sorry for the inconvenience.
> 
> Sergey Senozhatsky (13):
>   arm: do not use print_symbol()
>   arm64: do not use print_symbol()
>   c6x: do not use print_symbol()
>   ia64: do not use print_symbol()
>   mn10300: do not use print_symbol()
>   sh: do not use print_symbol()
>   unicore32: do not use print_symbol()
>   x86: do not use print_symbol()
>   drivers: do not use print_symbol()
>   sysfs: do not use print_symbol()
>   irq debug: do not use print_symbol()
>   lib: do not use print_symbol()
>   arc: do not use __print_symbol()

Hello,

can we please have more reviews/acks/etc?

	-ss

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

* [PATCH 00/13] replace print_symbol() with printk()-s
  2017-12-12  3:10     ` Joe Perches
@ 2017-12-21  5:54       ` Sergey Senozhatsky
  0 siblings, 0 replies; 37+ messages in thread
From: Sergey Senozhatsky @ 2017-12-21  5:54 UTC (permalink / raw)
  To: linux-arm-kernel

On (12/11/17 19:10), Joe Perches wrote:
[..]
> As far as I'm concerned, as soon as there is
> no longer a single user in the kernel tree,
> better to delete it instead.

sounds good to me. can drop it, once the series upstreamed.

8< ---

From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: [PATCH] kallsyms: remove print_symbol() function

No more print_symbol()/__print_symbol() users left, remove these
symbols.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Suggested-by: Joe Perches <joe@perches.com>
---
 Documentation/filesystems/sysfs.txt                    |  4 ++--
 Documentation/translations/zh_CN/filesystems/sysfs.txt |  4 ++--
 include/linux/kallsyms.h                               | 18 ------------------
 kernel/kallsyms.c                                      | 11 -----------
 4 files changed, 4 insertions(+), 33 deletions(-)

diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt
index 9a3658cc399e..a1426cabcef1 100644
--- a/Documentation/filesystems/sysfs.txt
+++ b/Documentation/filesystems/sysfs.txt
@@ -154,8 +154,8 @@ static ssize_t dev_attr_show(struct kobject *kobj, struct attribute *attr,
         if (dev_attr->show)
                 ret = dev_attr->show(dev, dev_attr, buf);
         if (ret >= (ssize_t)PAGE_SIZE) {
-                print_symbol("dev_attr_show: %s returned bad count\n",
-                                (unsigned long)dev_attr->show);
+                printk("dev_attr_show: %pS returned bad count\n",
+                                dev_attr->show);
         }
         return ret;
 }
diff --git a/Documentation/translations/zh_CN/filesystems/sysfs.txt b/Documentation/translations/zh_CN/filesystems/sysfs.txt
index 7d3b05edb8ce..452271dda141 100644
--- a/Documentation/translations/zh_CN/filesystems/sysfs.txt
+++ b/Documentation/translations/zh_CN/filesystems/sysfs.txt
@@ -167,8 +167,8 @@ static ssize_t dev_attr_show(struct kobject *kobj, struct attribute *attr,
         if (dev_attr->show)
                 ret = dev_attr->show(dev, dev_attr, buf);
         if (ret >= (ssize_t)PAGE_SIZE) {
-                print_symbol("dev_attr_show: %s returned bad count\n",
-                                (unsigned long)dev_attr->show);
+                printk("dev_attr_show: %pS returned bad count\n",
+                                dev_attr->show);
         }
         return ret;
 }
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index 7288f9c395b6..d79d1e7486bd 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -94,9 +94,6 @@ extern int sprint_symbol(char *buffer, unsigned long address);
 extern int sprint_symbol_no_offset(char *buffer, unsigned long address);
 extern int sprint_backtrace(char *buffer, unsigned long address);
 
-/* Look up a kernel symbol and print it to the kernel messages. */
-extern void __print_symbol(const char *fmt, unsigned long address);
-
 int lookup_symbol_name(unsigned long addr, char *symname);
 int lookup_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name);
 
@@ -166,23 +163,8 @@ static inline int kallsyms_show_value(void)
 	return false;
 }
 
-/* Stupid that this does nothing, but I didn't create this mess. */
-#define __print_symbol(fmt, addr)
 #endif /*CONFIG_KALLSYMS*/
 
-/* This macro allows us to keep printk typechecking */
-static __printf(1, 2)
-void __check_printsym_format(const char *fmt, ...)
-{
-}
-
-static inline void print_symbol(const char *fmt, unsigned long addr)
-{
-	__check_printsym_format(fmt, "");
-	__print_symbol(fmt, (unsigned long)
-		       __builtin_extract_return_addr((void *)addr));
-}
-
 static inline void print_ip_sym(unsigned long ip)
 {
 	printk("[<%p>] %pS\n", (void *) ip, (void *) ip);
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index 24f456689f9c..a23e21ada81b 100644
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -429,17 +429,6 @@ int sprint_backtrace(char *buffer, unsigned long address)
 	return __sprint_symbol(buffer, address, -1, 1);
 }
 
-/* Look up a kernel symbol and print it to the kernel messages. */
-void __print_symbol(const char *fmt, unsigned long address)
-{
-	char buffer[KSYM_SYMBOL_LEN];
-
-	sprint_symbol(buffer, address);
-
-	printk(fmt, buffer);
-}
-EXPORT_SYMBOL(__print_symbol);
-
 /* To avoid using get_symbol_offset for every symbol, we carry prefix along. */
 struct kallsym_iter {
 	loff_t pos;
-- 
2.15.1

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

* [PATCH 00/13] replace print_symbol() with printk()-s
  2017-12-11 12:50 [PATCH 00/13] replace print_symbol() with printk()-s Sergey Senozhatsky
                   ` (14 preceding siblings ...)
  2017-12-20 10:20 ` Sergey Senozhatsky
@ 2018-01-05 10:03 ` Petr Mladek
  2018-01-05 10:21   ` Sergey Senozhatsky
  15 siblings, 1 reply; 37+ messages in thread
From: Petr Mladek @ 2018-01-05 10:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon 2017-12-11 21:50:12, Sergey Senozhatsky wrote:
> 	Hello,
> 
> 	A rather automatic replacement of print_symbol()
> with direct printk() calls. print_symbol() uses extra stack
> buffer (KSYM_SYMBOL_LEN 128 bytes) and, basically, should
> be identical to printk(%pS).

To make it clear, both print_symbol() and printk(%pS)
print the adress using sprint_symbol(). And even printk(%pS)
uses the buffer on the stack, see:

char *symbol_string(char *buf, char *end, void *ptr,
		    struct printf_spec spec, const char *fmt)
{
[...]
	char sym[KSYM_SYMBOL_LEN];
[...]
		sprint_symbol(sym, value);
}

Anyway, print_symbol() is an old weird API and it would be nice
to eventually get rid of it. I could take this patches into
printk.git. Would you mind if I change the commit messages
to something like?:

    print_symbol() is an old weird API. It has been
    obsoleted by printk() and %pS format specifier.

Best Regards,
Petr

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

* [PATCH 00/13] replace print_symbol() with printk()-s
  2018-01-05 10:03 ` Petr Mladek
@ 2018-01-05 10:21   ` Sergey Senozhatsky
  2018-01-05 10:25     ` Sergey Senozhatsky
                       ` (2 more replies)
  0 siblings, 3 replies; 37+ messages in thread
From: Sergey Senozhatsky @ 2018-01-05 10:21 UTC (permalink / raw)
  To: linux-arm-kernel

On (01/05/18 11:03), Petr Mladek wrote:
[..]
> Anyway, print_symbol() is an old weird API and it would be nice
> to eventually get rid of it. I could take this patches into
> printk.git.

no objections from my side if the patch set will go through the printk tree.
shall we wait for ACKs or can we move on? do you plan to land it in 4.16?

> Would you mind if I change the commit messages to something like?:
> 
>     print_symbol() is an old weird API. It has been
>     obsoleted by printk() and %pS format specifier.

I wouldn't. let's drop the "weird" part. other than that looks
good to me.

	-ss

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

* [PATCH 00/13] replace print_symbol() with printk()-s
  2018-01-05 10:21   ` Sergey Senozhatsky
@ 2018-01-05 10:25     ` Sergey Senozhatsky
  2018-01-05 14:42       ` Petr Mladek
  2018-01-05 11:38     ` Petr Mladek
  2018-01-05 12:01     ` Sergey Senozhatsky
  2 siblings, 1 reply; 37+ messages in thread
From: Sergey Senozhatsky @ 2018-01-05 10:25 UTC (permalink / raw)
  To: linux-arm-kernel

On (01/05/18 19:21), Sergey Senozhatsky wrote:
> On (01/05/18 11:03), Petr Mladek wrote:
> [..]
> > Anyway, print_symbol() is an old weird API and it would be nice
> > to eventually get rid of it. I could take this patches into
> > printk.git.
> 
> no objections from my side if the patch set will go through the printk tree.
> shall we wait for ACKs or can we move on? do you plan to land it in 4.16?
> 
> > Would you mind if I change the commit messages to something like?:
> > 
> >     print_symbol() is an old weird API. It has been
> >     obsoleted by printk() and %pS format specifier.
> 
> I wouldn't. let's drop the "weird" part. other than that looks
> good to me.

oh, one more thing. one extra patch, which gets rid of
print_symbol()/__print_symbol().

8< ===

From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: [PATCH] kallsyms: remove print_symbol() function

No more print_symbol()/__print_symbol() users left, remove these
symbols.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Suggested-by: Joe Perches <joe@perches.com>
---
 Documentation/filesystems/sysfs.txt                    |  4 ++--
 Documentation/translations/zh_CN/filesystems/sysfs.txt |  4 ++--
 include/linux/kallsyms.h                               | 18 ------------------
 kernel/kallsyms.c                                      | 11 -----------
 4 files changed, 4 insertions(+), 33 deletions(-)

diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt
index 9a3658cc399e..a1426cabcef1 100644
--- a/Documentation/filesystems/sysfs.txt
+++ b/Documentation/filesystems/sysfs.txt
@@ -154,8 +154,8 @@ static ssize_t dev_attr_show(struct kobject *kobj, struct attribute *attr,
         if (dev_attr->show)
                 ret = dev_attr->show(dev, dev_attr, buf);
         if (ret >= (ssize_t)PAGE_SIZE) {
-                print_symbol("dev_attr_show: %s returned bad count\n",
-                                (unsigned long)dev_attr->show);
+                printk("dev_attr_show: %pS returned bad count\n",
+                                dev_attr->show);
         }
         return ret;
 }
diff --git a/Documentation/translations/zh_CN/filesystems/sysfs.txt b/Documentation/translations/zh_CN/filesystems/sysfs.txt
index 7d3b05edb8ce..452271dda141 100644
--- a/Documentation/translations/zh_CN/filesystems/sysfs.txt
+++ b/Documentation/translations/zh_CN/filesystems/sysfs.txt
@@ -167,8 +167,8 @@ static ssize_t dev_attr_show(struct kobject *kobj, struct attribute *attr,
         if (dev_attr->show)
                 ret = dev_attr->show(dev, dev_attr, buf);
         if (ret >= (ssize_t)PAGE_SIZE) {
-                print_symbol("dev_attr_show: %s returned bad count\n",
-                                (unsigned long)dev_attr->show);
+                printk("dev_attr_show: %pS returned bad count\n",
+                                dev_attr->show);
         }
         return ret;
 }
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index 23190e5c940b..657a83b943f0 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -94,9 +94,6 @@ extern int sprint_symbol(char *buffer, unsigned long address);
 extern int sprint_symbol_no_offset(char *buffer, unsigned long address);
 extern int sprint_backtrace(char *buffer, unsigned long address);
 
-/* Look up a kernel symbol and print it to the kernel messages. */
-extern void __print_symbol(const char *fmt, unsigned long address);
-
 int lookup_symbol_name(unsigned long addr, char *symname);
 int lookup_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name);
 
@@ -166,23 +163,8 @@ static inline int kallsyms_show_value(void)
 	return false;
 }
 
-/* Stupid that this does nothing, but I didn't create this mess. */
-#define __print_symbol(fmt, addr)
 #endif /*CONFIG_KALLSYMS*/
 
-/* This macro allows us to keep printk typechecking */
-static __printf(1, 2)
-void __check_printsym_format(const char *fmt, ...)
-{
-}
-
-static inline void print_symbol(const char *fmt, unsigned long addr)
-{
-	__check_printsym_format(fmt, "");
-	__print_symbol(fmt, (unsigned long)
-		       __builtin_extract_return_addr((void *)addr));
-}
-
 static inline void print_ip_sym(unsigned long ip)
 {
 	printk("[<%px>] %pS\n", (void *) ip, (void *) ip);
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index 24f456689f9c..a23e21ada81b 100644
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -429,17 +429,6 @@ int sprint_backtrace(char *buffer, unsigned long address)
 	return __sprint_symbol(buffer, address, -1, 1);
 }
 
-/* Look up a kernel symbol and print it to the kernel messages. */
-void __print_symbol(const char *fmt, unsigned long address)
-{
-	char buffer[KSYM_SYMBOL_LEN];
-
-	sprint_symbol(buffer, address);
-
-	printk(fmt, buffer);
-}
-EXPORT_SYMBOL(__print_symbol);
-
 /* To avoid using get_symbol_offset for every symbol, we carry prefix along. */
 struct kallsym_iter {
 	loff_t pos;
-- 
2.15.1

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

* [PATCH 00/13] replace print_symbol() with printk()-s
  2018-01-05 10:21   ` Sergey Senozhatsky
  2018-01-05 10:25     ` Sergey Senozhatsky
@ 2018-01-05 11:38     ` Petr Mladek
  2018-01-05 12:01     ` Sergey Senozhatsky
  2 siblings, 0 replies; 37+ messages in thread
From: Petr Mladek @ 2018-01-05 11:38 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri 2018-01-05 19:21:05, Sergey Senozhatsky wrote:
> On (01/05/18 11:03), Petr Mladek wrote:
> [..]
> > Anyway, print_symbol() is an old weird API and it would be nice
> > to eventually get rid of it. I could take this patches into
> > printk.git.
> 
> no objections from my side if the patch set will go through the printk tree.
> shall we wait for ACKs or can we move on? do you plan to land it in 4.16?

I am going to add this into for-4.16 branch.

It is a rather cosmetic and trivial change. Therefore I do not think
that we would need to wait for all the ACKs. Anyway, I am going to
proactively check for potential conflicts with linux-next.

> > Would you mind if I change the commit messages to something like?:
> > 
> >     print_symbol() is an old weird API. It has been
> >     obsoleted by printk() and %pS format specifier.
> 
> I wouldn't. let's drop the "weird" part. other than that looks
> good to me.

OK.

Best Regards,
Petr

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

* [PATCH 00/13] replace print_symbol() with printk()-s
  2018-01-05 10:21   ` Sergey Senozhatsky
  2018-01-05 10:25     ` Sergey Senozhatsky
  2018-01-05 11:38     ` Petr Mladek
@ 2018-01-05 12:01     ` Sergey Senozhatsky
  2018-01-05 12:23       ` Sergey Senozhatsky
  2 siblings, 1 reply; 37+ messages in thread
From: Sergey Senozhatsky @ 2018-01-05 12:01 UTC (permalink / raw)
  To: linux-arm-kernel

On (01/05/18 19:21), Sergey Senozhatsky wrote:
> >     print_symbol() is an old weird API. It has been
> >     obsoleted by printk() and %pS format specifier.
> 
> I wouldn't. let's drop the "weird" part.

hm...

you are right, it is weird. and the weird part here is that
print_symbol() is used for things like __show_regs()

       print_symbol("PC is at %s\n", instruction_pointer(regs));
       print_symbol("LR is at %s\n", regs->ARM_lr);
       printk("pc : [<%08lx>]    lr : [<%08lx>]    psr: %08lx\n",
              regs->ARM_pc, regs->ARM_lr, regs->ARM_cpsr);

or for EMERG error reporting

        pr_emerg("unexpected fault for address: 0x%08lx, last fault for address: 0x%08lx\n",
                 addr, my_reason->addr);
        print_pte(addr);
       print_symbol(KERN_EMERG "faulting IP is at %s\n", regs->ip);
       print_symbol(KERN_EMERG "last faulting IP was at %s\n", my_reason->ip);
 #ifdef __i386__
        pr_emerg("eax: %08lx   ebx: %08lx   ecx: %08lx   edx: %08lx\n",
                 regs->ax, regs->bx, regs->cx, regs->dx);

or for error reporting in sysfs

               print_symbol("fill_read_buffer: %s returned bad count\n",
                       (unsigned long)ops->show);

and so on.

but, print_symbol() is compiled out on !CONFIG_KALLSYMS systems. so,
basically, we compile out some of errors print outs; even more, on ia64
ia64_do_show_stack() does nothing when there is no CONFIG_KALLSYMS [all
ia64 defconfigs have KALLSYMS_ALL enabled]. printk(%pS), unlike
print_symbol(), is not compiled out and prints the function address
when symbolic name is not available. but, at a glance, print_symbol()
in most of the cases has printk(registers) next to it or before it, so
it doesn't look like we are introducing a regression here by switching
to printk(%pS).

	-ss

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

* [PATCH 00/13] replace print_symbol() with printk()-s
  2018-01-05 12:01     ` Sergey Senozhatsky
@ 2018-01-05 12:23       ` Sergey Senozhatsky
  2018-01-05 13:09         ` Petr Mladek
  0 siblings, 1 reply; 37+ messages in thread
From: Sergey Senozhatsky @ 2018-01-05 12:23 UTC (permalink / raw)
  To: linux-arm-kernel

On (01/05/18 21:01), Sergey Senozhatsky wrote:
[..]
> but, print_symbol() is compiled out on !CONFIG_KALLSYMS systems. so,
> basically, we compile out some of errors print outs; even more, on ia64
> ia64_do_show_stack() does nothing when there is no CONFIG_KALLSYMS [all
> ia64 defconfigs have KALLSYMS_ALL enabled]. printk(%pS), unlike
> print_symbol(), is not compiled out and prints the function address
> when symbolic name is not available. but, at a glance, print_symbol()
> in most of the cases has printk(registers) next to it or before it, so
> it doesn't look like we are introducing a regression here by switching
> to printk(%pS).

well, if this is a problem, then we can have

static inline void print_symbol(const char *fmt, unsigned long addr)
{
       printk(fmt, addr);
}

for CONFIG_KALLSYMS builds, and an empty print_symbol() for !CONFIG_KALLSYMS
builds.


but we still have tons printk(%pS) in the kernel and even print_ip_sym()
(which is not compiled out on !CONFIG_KALLSYMS). so it seems to me that
we can drop print_symbol()/__print_symbol() and switch to printk(%pS)
after all.

	-ss

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

* [PATCH 00/13] replace print_symbol() with printk()-s
  2018-01-05 12:23       ` Sergey Senozhatsky
@ 2018-01-05 13:09         ` Petr Mladek
  0 siblings, 0 replies; 37+ messages in thread
From: Petr Mladek @ 2018-01-05 13:09 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri 2018-01-05 21:23:34, Sergey Senozhatsky wrote:
> On (01/05/18 21:01), Sergey Senozhatsky wrote:
> [..]
> > but, print_symbol() is compiled out on !CONFIG_KALLSYMS systems. so,
> > basically, we compile out some of errors print outs; even more, on ia64
> > ia64_do_show_stack() does nothing when there is no CONFIG_KALLSYMS [all
> > ia64 defconfigs have KALLSYMS_ALL enabled]. printk(%pS), unlike
> > print_symbol(), is not compiled out and prints the function address
> > when symbolic name is not available. but, at a glance, print_symbol()
> > in most of the cases has printk(registers) next to it or before it, so
> > it doesn't look like we are introducing a regression here by switching
> > to printk(%pS).
> 
> well, if this is a problem, then we can have

I believe that this is not a problem. If it was, we would most likely
need to solve it in the existing printk(%pS) callers.

> but we still have tons printk(%pS) in the kernel and even print_ip_sym()
> (which is not compiled out on !CONFIG_KALLSYMS). so it seems to me that
> we can drop print_symbol()/__print_symbol() and switch to printk(%pS)
> after all.

Exactly.

BTW: print_symbol() looks weird to me because:

   + looks like a normal printk() but
   + only one format specifier (%s) is replaced
   + %s is used to print an address/pointer

IMHO, this is counter-intuitive and even error prone.
Also it makes people using crazy hacks like the one fixed
in 4th patch, see
https://lkml.kernel.org/r/20171211125025.2270-5-sergey.senozhatsky at gmail.com

Best Regards,
Petr

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

* [PATCH 00/13] replace print_symbol() with printk()-s
  2018-01-05 10:25     ` Sergey Senozhatsky
@ 2018-01-05 14:42       ` Petr Mladek
  2018-01-05 14:57         ` Sergey Senozhatsky
  2018-01-08  2:09         ` Sergey Senozhatsky
  0 siblings, 2 replies; 37+ messages in thread
From: Petr Mladek @ 2018-01-05 14:42 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri 2018-01-05 19:25:38, Sergey Senozhatsky wrote:
> On (01/05/18 19:21), Sergey Senozhatsky wrote:
> > On (01/05/18 11:03), Petr Mladek wrote:
> > [..]
> > > Anyway, print_symbol() is an old weird API and it would be nice
> > > to eventually get rid of it. I could take this patches into
> > > printk.git.
> > 
> > no objections from my side if the patch set will go through the printk tree.
> > shall we wait for ACKs or can we move on? do you plan to land it in 4.16?
> > 
> > > Would you mind if I change the commit messages to something like?:
> > > 
> > >     print_symbol() is an old weird API. It has been
> > >     obsoleted by printk() and %pS format specifier.
> > 
> > I wouldn't. let's drop the "weird" part. other than that looks
> > good to me.
> 
> oh, one more thing. one extra patch, which gets rid of
> print_symbol()/__print_symbol().

I am all for it. But I would postpone this removal to 4.17.
The reason is rather ugly. 13th patch is already in arc tree.
We would need to shuffle the patch or coordinate pull requests.
I think that it is not worth it. There is no real hurry.
I doubt that the would be any new user in the meantime.

Best Regards,
Petr

PS: I have just pushed 12 patches into printk.git for-4.16 branch.
I will merge this to linux-next branch on Monday. I will not
be around the computer over the weekend...

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

* [PATCH 00/13] replace print_symbol() with printk()-s
  2018-01-05 14:42       ` Petr Mladek
@ 2018-01-05 14:57         ` Sergey Senozhatsky
  2018-01-08  2:09         ` Sergey Senozhatsky
  1 sibling, 0 replies; 37+ messages in thread
From: Sergey Senozhatsky @ 2018-01-05 14:57 UTC (permalink / raw)
  To: linux-arm-kernel

On (01/05/18 15:42), Petr Mladek wrote:
[..]
> > oh, one more thing. one extra patch, which gets rid of
> > print_symbol()/__print_symbol().
> 
> I am all for it. But I would postpone this removal to 4.17.
> The reason is rather ugly. 13th patch is already in arc tree.
> We would need to shuffle the patch or coordinate pull requests.
> I think that it is not worth it. There is no real hurry.
> I doubt that the would be any new user in the meantime.
> 
> Best Regards,
> Petr
> 
> PS: I have just pushed 12 patches into printk.git for-4.16 branch.
> I will merge this to linux-next branch on Monday. I will not
> be around the computer over the weekend...

OK. thanks!

	-ss

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

* [PATCH 00/13] replace print_symbol() with printk()-s
  2018-01-05 14:42       ` Petr Mladek
  2018-01-05 14:57         ` Sergey Senozhatsky
@ 2018-01-08  2:09         ` Sergey Senozhatsky
       [not found]           ` <20180116163301.lh76kvjheyobjgkp@pathway.suse.cz>
  1 sibling, 1 reply; 37+ messages in thread
From: Sergey Senozhatsky @ 2018-01-08  2:09 UTC (permalink / raw)
  To: linux-arm-kernel

On (01/05/18 15:42), Petr Mladek wrote:
> 
> I am all for it. But I would postpone this removal to 4.17.
> The reason is rather ugly. 13th patch is already in arc tree.
> We would need to shuffle the patch or coordinate pull requests.

JFI, the patch is in Linus's tree as of now (d0729bc6bee797fb).

	-ss

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

* [PATCH 00/13] replace print_symbol() with printk()-s
       [not found]           ` <20180116163301.lh76kvjheyobjgkp@pathway.suse.cz>
@ 2018-01-17  2:36             ` Sergey Senozhatsky
  0 siblings, 0 replies; 37+ messages in thread
From: Sergey Senozhatsky @ 2018-01-17  2:36 UTC (permalink / raw)
  To: linux-arm-kernel

On (01/16/18 17:33), Petr Mladek wrote:
[..]
> > JFI, the patch is in Linus's tree as of now (d0729bc6bee797fb).
> 
> Great. I have pushed the patch that removes printk_symbol()
> into printk.git, branch for-4.16-print-symbol.
> 
> Note that I have updated the commit message similar way
> like I did for the other commits. Especially I wanted
> to mention what it was obsoleted by. The message is:
> 
>   kallsyms: remove print_symbol() function
> 
>   No more print_symbol()/__print_symbol() users left, remove these
>   symbols.
> 
>   It was a very old API that encouraged people use continuous lines.
>   It had been obsoleted by %pS format specifier in a normal printk()
>   call.
> 
> 
> See also
> https://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printk.git/commit/?h=for-4.16-print-symbol&id=d2279c9d7f7db7f97567368bfc4539b3411adf8d

thanks!

	-ss

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

end of thread, other threads:[~2018-01-17  2:36 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-11 12:50 [PATCH 00/13] replace print_symbol() with printk()-s Sergey Senozhatsky
2017-12-11 12:50 ` [PATCH 01/13] arm: do not use print_symbol() Sergey Senozhatsky
2017-12-11 12:50 ` [PATCH 02/13] arm64: " Sergey Senozhatsky
2017-12-11 12:50 ` [PATCH 03/13] c6x: " Sergey Senozhatsky
2017-12-11 12:50 ` [PATCH 04/13] ia64: " Sergey Senozhatsky
2017-12-11 12:50 ` [PATCH 05/13] mn10300: " Sergey Senozhatsky
2017-12-11 12:50 ` [PATCH 06/13] sh: " Sergey Senozhatsky
2017-12-11 12:50 ` [PATCH 07/13] unicore32: " Sergey Senozhatsky
2017-12-11 12:50 ` [PATCH 08/13] x86: " Sergey Senozhatsky
2017-12-11 17:45   ` Borislav Petkov
2017-12-12  2:41     ` Sergey Senozhatsky
2017-12-11 12:50 ` [PATCH 09/13] drivers: " Sergey Senozhatsky
2017-12-11 12:50 ` [PATCH 10/13] sysfs: " Sergey Senozhatsky
2017-12-11 12:50 ` [PATCH 11/13] irq debug: " Sergey Senozhatsky
2017-12-11 12:55   ` David Laight
2017-12-12  2:50     ` Sergey Senozhatsky
2017-12-12  7:34   ` [PATCHv2 " Sergey Senozhatsky
2017-12-11 12:50 ` [PATCH 12/13] lib: " Sergey Senozhatsky
2017-12-11 12:50 ` [PATCH 13/13] arc: do not use __print_symbol() Sergey Senozhatsky
2017-12-11 16:28   ` Vineet Gupta
2017-12-12  2:41     ` Sergey Senozhatsky
2017-12-11 16:26 ` [PATCH 00/13] replace print_symbol() with printk()-s Joe Perches
2017-12-12  2:47   ` Sergey Senozhatsky
2017-12-12  3:10     ` Joe Perches
2017-12-21  5:54       ` Sergey Senozhatsky
2017-12-20 10:20 ` Sergey Senozhatsky
2018-01-05 10:03 ` Petr Mladek
2018-01-05 10:21   ` Sergey Senozhatsky
2018-01-05 10:25     ` Sergey Senozhatsky
2018-01-05 14:42       ` Petr Mladek
2018-01-05 14:57         ` Sergey Senozhatsky
2018-01-08  2:09         ` Sergey Senozhatsky
     [not found]           ` <20180116163301.lh76kvjheyobjgkp@pathway.suse.cz>
2018-01-17  2:36             ` Sergey Senozhatsky
2018-01-05 11:38     ` Petr Mladek
2018-01-05 12:01     ` Sergey Senozhatsky
2018-01-05 12:23       ` Sergey Senozhatsky
2018-01-05 13:09         ` Petr Mladek

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