Commit 51ccbb0a authored by Petr Mladek's avatar Petr Mladek

Merge branch 'for-4.16-print-symbol' into for-4.16

parents 3ccdc519 d2279c9d
...@@ -154,8 +154,8 @@ static ssize_t dev_attr_show(struct kobject *kobj, struct attribute *attr, ...@@ -154,8 +154,8 @@ static ssize_t dev_attr_show(struct kobject *kobj, struct attribute *attr,
if (dev_attr->show) if (dev_attr->show)
ret = dev_attr->show(dev, dev_attr, buf); ret = dev_attr->show(dev, dev_attr, buf);
if (ret >= (ssize_t)PAGE_SIZE) { if (ret >= (ssize_t)PAGE_SIZE) {
print_symbol("dev_attr_show: %s returned bad count\n", printk("dev_attr_show: %pS returned bad count\n",
(unsigned long)dev_attr->show); dev_attr->show);
} }
return ret; return ret;
} }
......
...@@ -167,8 +167,8 @@ static ssize_t dev_attr_show(struct kobject *kobj, struct attribute *attr, ...@@ -167,8 +167,8 @@ static ssize_t dev_attr_show(struct kobject *kobj, struct attribute *attr,
if (dev_attr->show) if (dev_attr->show)
ret = dev_attr->show(dev, dev_attr, buf); ret = dev_attr->show(dev, dev_attr, buf);
if (ret >= (ssize_t)PAGE_SIZE) { if (ret >= (ssize_t)PAGE_SIZE) {
print_symbol("dev_attr_show: %s returned bad count\n", printk("dev_attr_show: %pS returned bad count\n",
(unsigned long)dev_attr->show); dev_attr->show);
} }
return ret; return ret;
} }
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include <linux/unistd.h> #include <linux/unistd.h>
#include <linux/user.h> #include <linux/user.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/kallsyms.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/elfcore.h> #include <linux/elfcore.h>
#include <linux/pm.h> #include <linux/pm.h>
...@@ -121,8 +120,8 @@ void __show_regs(struct pt_regs *regs) ...@@ -121,8 +120,8 @@ void __show_regs(struct pt_regs *regs)
show_regs_print_info(KERN_DEFAULT); show_regs_print_info(KERN_DEFAULT);
print_symbol("PC is at %s\n", instruction_pointer(regs)); printk("PC is at %pS\n", (void *)instruction_pointer(regs));
print_symbol("LR is at %s\n", regs->ARM_lr); printk("LR is at %pS\n", (void *)regs->ARM_lr);
printk("pc : [<%08lx>] lr : [<%08lx>] psr: %08lx\n", printk("pc : [<%08lx>] lr : [<%08lx>] psr: %08lx\n",
regs->ARM_pc, regs->ARM_lr, regs->ARM_cpsr); regs->ARM_pc, regs->ARM_lr, regs->ARM_cpsr);
printk("sp : %08lx ip : %08lx fp : %08lx\n", printk("sp : %08lx ip : %08lx fp : %08lx\n",
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/kallsyms.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/cpu.h> #include <linux/cpu.h>
#include <linux/elfcore.h> #include <linux/elfcore.h>
...@@ -221,8 +220,8 @@ void __show_regs(struct pt_regs *regs) ...@@ -221,8 +220,8 @@ void __show_regs(struct pt_regs *regs)
show_regs_print_info(KERN_DEFAULT); show_regs_print_info(KERN_DEFAULT);
print_pstate(regs); print_pstate(regs);
print_symbol("pc : %s\n", regs->pc); printk("pc : %pS\n", (void *)regs->pc);
print_symbol("lr : %s\n", lr); printk("lr : %pS\n", (void *)lr);
printk("sp : %016llx\n", sp); printk("sp : %016llx\n", sp);
i = top_reg; i = top_reg;
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/sched/debug.h> #include <linux/sched/debug.h>
#include <linux/kallsyms.h>
#include <linux/bug.h> #include <linux/bug.h>
#include <asm/soc.h> #include <asm/soc.h>
...@@ -375,8 +374,7 @@ static void show_trace(unsigned long *stack, unsigned long *endstack) ...@@ -375,8 +374,7 @@ static void show_trace(unsigned long *stack, unsigned long *endstack)
if (i % 5 == 0) if (i % 5 == 0)
pr_debug("\n "); pr_debug("\n ");
#endif #endif
pr_debug(" [<%08lx>]", addr); pr_debug(" [<%08lx>] %pS\n", addr, (void *)addr);
print_symbol(" %s\n", addr);
i++; i++;
} }
} }
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/elf.h> #include <linux/elf.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/kallsyms.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -69,7 +68,6 @@ void ...@@ -69,7 +68,6 @@ void
ia64_do_show_stack (struct unw_frame_info *info, void *arg) ia64_do_show_stack (struct unw_frame_info *info, void *arg)
{ {
unsigned long ip, sp, bsp; unsigned long ip, sp, bsp;
char buf[128]; /* don't make it so big that it overflows the stack! */
printk("\nCall Trace:\n"); printk("\nCall Trace:\n");
do { do {
...@@ -79,11 +77,9 @@ ia64_do_show_stack (struct unw_frame_info *info, void *arg) ...@@ -79,11 +77,9 @@ ia64_do_show_stack (struct unw_frame_info *info, void *arg)
unw_get_sp(info, &sp); unw_get_sp(info, &sp);
unw_get_bsp(info, &bsp); unw_get_bsp(info, &bsp);
snprintf(buf, sizeof(buf), printk(" [<%016lx>] %pS\n"
" [<%016lx>] %%s\n"
" sp=%016lx bsp=%016lx\n", " sp=%016lx bsp=%016lx\n",
ip, sp, bsp); ip, (void *)ip, sp, bsp);
print_symbol(buf, ip);
} while (unw_unwind(info) >= 0); } while (unw_unwind(info) >= 0);
} }
...@@ -111,7 +107,7 @@ show_regs (struct pt_regs *regs) ...@@ -111,7 +107,7 @@ show_regs (struct pt_regs *regs)
printk("psr : %016lx ifs : %016lx ip : [<%016lx>] %s (%s)\n", printk("psr : %016lx ifs : %016lx ip : [<%016lx>] %s (%s)\n",
regs->cr_ipsr, regs->cr_ifs, ip, print_tainted(), regs->cr_ipsr, regs->cr_ifs, ip, print_tainted(),
init_utsname()->release); 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", printk("unat: %016lx pfs : %016lx rsc : %016lx\n",
regs->ar_unat, regs->ar_pfs, regs->ar_rsc); regs->ar_unat, regs->ar_pfs, regs->ar_rsc);
printk("rnat: %016lx bsps: %016lx pr : %016lx\n", printk("rnat: %016lx bsps: %016lx pr : %016lx\n",
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/kallsyms.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/kdebug.h> #include <linux/kdebug.h>
#include <linux/bug.h> #include <linux/bug.h>
...@@ -262,8 +261,7 @@ void show_trace(unsigned long *sp) ...@@ -262,8 +261,7 @@ void show_trace(unsigned long *sp)
raslot = ULONG_MAX; raslot = ULONG_MAX;
else else
printk(" ?"); printk(" ?");
print_symbol(" %s", addr); printk(" %pS\n", (void *)addr);
printk("\n");
} }
} }
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <linux/sched/task_stack.h> #include <linux/sched/task_stack.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/elfcore.h> #include <linux/elfcore.h>
#include <linux/kallsyms.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/ftrace.h> #include <linux/ftrace.h>
#include <linux/hw_breakpoint.h> #include <linux/hw_breakpoint.h>
...@@ -37,8 +36,8 @@ void show_regs(struct pt_regs * regs) ...@@ -37,8 +36,8 @@ void show_regs(struct pt_regs * regs)
printk("\n"); printk("\n");
show_regs_print_info(KERN_DEFAULT); show_regs_print_info(KERN_DEFAULT);
print_symbol("PC is at %s\n", instruction_pointer(regs)); printk("PC is at %pS\n", (void *)instruction_pointer(regs));
print_symbol("PR is at %s\n", regs->pr); printk("PR is at %pS\n", (void *)regs->pr);
printk("PC : %08lx SP : %08lx SR : %08lx ", printk("PC : %08lx SP : %08lx SR : %08lx ",
regs->pc, regs->regs[15], regs->sr); regs->pc, regs->regs[15], regs->sr);
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/kallsyms.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/cpu.h> #include <linux/cpu.h>
#include <linux/elfcore.h> #include <linux/elfcore.h>
...@@ -139,8 +138,8 @@ void __show_regs(struct pt_regs *regs) ...@@ -139,8 +138,8 @@ void __show_regs(struct pt_regs *regs)
char buf[64]; char buf[64];
show_regs_print_info(KERN_DEFAULT); show_regs_print_info(KERN_DEFAULT);
print_symbol("PC is at %s\n", instruction_pointer(regs)); printk("PC is at %pS\n", (void *)instruction_pointer(regs));
print_symbol("LR is at %s\n", regs->UCreg_lr); printk("LR is at %pS\n", (void *)regs->UCreg_lr);
printk(KERN_DEFAULT "pc : [<%08lx>] lr : [<%08lx>] psr: %08lx\n" printk(KERN_DEFAULT "pc : [<%08lx>] lr : [<%08lx>] psr: %08lx\n"
"sp : %08lx ip : %08lx fp : %08lx\n", "sp : %08lx ip : %08lx fp : %08lx\n",
regs->UCreg_pc, regs->UCreg_lr, regs->UCreg_asr, regs->UCreg_pc, regs->UCreg_lr, regs->UCreg_asr,
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include <linux/capability.h> #include <linux/capability.h>
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/ratelimit.h> #include <linux/ratelimit.h>
#include <linux/kallsyms.h>
#include <linux/rcupdate.h> #include <linux/rcupdate.h>
#include <linux/kobject.h> #include <linux/kobject.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
...@@ -235,7 +234,7 @@ static void __print_mce(struct mce *m) ...@@ -235,7 +234,7 @@ static void __print_mce(struct mce *m)
m->cs, m->ip); m->cs, m->ip);
if (m->cs == __KERNEL_CS) if (m->cs == __KERNEL_CS)
print_symbol("{%s}", m->ip); pr_cont("{%pS}", (void *)m->ip);
pr_cont("\n"); pr_cont("\n");
} }
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/kallsyms.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <linux/mmiotrace.h> #include <linux/mmiotrace.h>
#include <asm/e820/api.h> /* for ISA_START_ADDRESS */ #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) ...@@ -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", pr_emerg("unexpected fault for address: 0x%08lx, last fault for address: 0x%08lx\n",
addr, my_reason->addr); addr, my_reason->addr);
print_pte(addr); print_pte(addr);
print_symbol(KERN_EMERG "faulting IP is at %s\n", regs->ip); pr_emerg("faulting IP is at %pS\n", (void *)regs->ip);
print_symbol(KERN_EMERG "last faulting IP was at %s\n", my_reason->ip); pr_emerg("last faulting IP was at %pS\n", (void *)my_reason->ip);
#ifdef __i386__ #ifdef __i386__
pr_emerg("eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", pr_emerg("eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n",
regs->ax, regs->bx, regs->cx, regs->dx); regs->ax, regs->bx, regs->cx, regs->dx);
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/genhd.h> #include <linux/genhd.h>
#include <linux/kallsyms.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
...@@ -687,8 +686,8 @@ static ssize_t dev_attr_show(struct kobject *kobj, struct attribute *attr, ...@@ -687,8 +686,8 @@ static ssize_t dev_attr_show(struct kobject *kobj, struct attribute *attr,
if (dev_attr->show) if (dev_attr->show)
ret = dev_attr->show(dev, dev_attr, buf); ret = dev_attr->show(dev, dev_attr, buf);
if (ret >= (ssize_t)PAGE_SIZE) { if (ret >= (ssize_t)PAGE_SIZE) {
print_symbol("dev_attr_show: %s returned bad count\n", printk("dev_attr_show: %pS returned bad count\n",
(unsigned long)dev_attr->show); dev_attr->show);
} }
return ret; return ret;
} }
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/kobject.h> #include <linux/kobject.h>
#include <linux/kallsyms.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/mutex.h> #include <linux/mutex.h>
...@@ -70,8 +69,8 @@ static int sysfs_kf_seq_show(struct seq_file *sf, void *v) ...@@ -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. * indicate truncated result or overflow in normal use cases.
*/ */
if (count >= (ssize_t)PAGE_SIZE) { if (count >= (ssize_t)PAGE_SIZE) {
print_symbol("fill_read_buffer: %s returned bad count\n", printk("fill_read_buffer: %pS returned bad count\n",
(unsigned long)ops->show); ops->show);
/* Try to struggle along */ /* Try to struggle along */
count = PAGE_SIZE - 1; count = PAGE_SIZE - 1;
} }
......
...@@ -100,9 +100,6 @@ extern int sprint_symbol(char *buffer, unsigned long address); ...@@ -100,9 +100,6 @@ extern int sprint_symbol(char *buffer, unsigned long address);
extern int sprint_symbol_no_offset(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); 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_name(unsigned long addr, char *symname);
int lookup_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name); int lookup_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name);
...@@ -172,23 +169,8 @@ static inline int kallsyms_show_value(void) ...@@ -172,23 +169,8 @@ static inline int kallsyms_show_value(void)
return false; return false;
} }
/* Stupid that this does nothing, but I didn't create this mess. */
#define __print_symbol(fmt, addr)
#endif /*CONFIG_KALLSYMS*/ #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) static inline void print_ip_sym(unsigned long ip)
{ {
printk("[<%p>] %pS\n", (void *) ip, (void *) ip); printk("[<%p>] %pS\n", (void *) ip, (void *) ip);
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
* Debugging printout: * Debugging printout:
*/ */
#include <linux/kallsyms.h>
#define ___P(f) if (desc->status_use_accessors & f) printk("%14s set\n", #f) #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) #define ___PS(f) if (desc->istate & f) printk("%14s set\n", #f)
/* FIXME */ /* FIXME */
...@@ -14,14 +12,14 @@ static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc) ...@@ -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", printk("irq %d, desc: %p, depth: %d, count: %d, unhandled: %d\n",
irq, desc, desc->depth, desc->irq_count, desc->irqs_unhandled); irq, desc, desc->depth, desc->irq_count, desc->irqs_unhandled);
printk("->handle_irq(): %p, ", desc->handle_irq); printk("->handle_irq(): %p, %pS\n",
print_symbol("%s\n", (unsigned long)desc->handle_irq); desc->handle_irq, desc->handle_irq);
printk("->irq_data.chip(): %p, ", desc->irq_data.chip); printk("->irq_data.chip(): %p, %pS\n",
print_symbol("%s\n", (unsigned long)desc->irq_data.chip); desc->irq_data.chip, desc->irq_data.chip);
printk("->action(): %p\n", desc->action); printk("->action(): %p\n", desc->action);
if (desc->action) { if (desc->action) {
printk("->action->handler(): %p, ", desc->action->handler); printk("->action->handler(): %p, %pS\n",
print_symbol("%s\n", (unsigned long)desc->action->handler); desc->action->handler, desc->action->handler);
} }
___P(IRQ_LEVEL); ___P(IRQ_LEVEL);
......
...@@ -429,17 +429,6 @@ int sprint_backtrace(char *buffer, unsigned long address) ...@@ -429,17 +429,6 @@ int sprint_backtrace(char *buffer, unsigned long address)
return __sprint_symbol(buffer, address, -1, 1); 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. */ /* To avoid using get_symbol_offset for every symbol, we carry prefix along. */
struct kallsym_iter { struct kallsym_iter {
loff_t pos; loff_t pos;
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
* DEBUG_PREEMPT variant of smp_processor_id(). * DEBUG_PREEMPT variant of smp_processor_id().
*/ */
#include <linux/export.h> #include <linux/export.h>
#include <linux/kallsyms.h>
#include <linux/sched.h> #include <linux/sched.h>
notrace static unsigned int check_preemption_disabled(const char *what1, notrace static unsigned int check_preemption_disabled(const char *what1,
...@@ -43,7 +42,7 @@ 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", printk(KERN_ERR "BUG: using %s%s() in preemptible [%08x] code: %s/%d\n",
what1, what2, preempt_count() - 1, current->comm, current->pid); 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(); dump_stack();
out_enable: out_enable:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment