Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sparc64: Fix bootup with mcount in some configs.

Functions invoked early when booting up a cpu can't use
tracing because mcount requires a valid 'current_thread_info()'
and TLB mappings to be setup.

The code path of sun4v_register_mondo_queues --> register_one_mondo
is one such case. sun4v_register_mondo_queues already has the
necessary 'notrace' annotation, but register_one_mondo does not.

Normally register_one_mondo is inlined so the bug doesn't trigger,
but with some config/compiler combinations, it won't be so we
must properly mark it notrace.

While we're here, add 'notrace' annoations to prom_printf and
prom_halt so that early error handling won't have the same problem.

Reported-by: Alexander Beregalov <a.beregalov@gmail.com>
Reported-by: Leif Sawyer <lsawyer@gci.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

+5 -6
+1 -1
arch/sparc/kernel/irq_64.c
··· 886 886 * Therefore you cannot make any OBP calls, not even prom_printf, 887 887 * from these two routines. 888 888 */ 889 - static void __cpuinit register_one_mondo(unsigned long paddr, unsigned long type, unsigned long qmask) 889 + static void __cpuinit notrace register_one_mondo(unsigned long paddr, unsigned long type, unsigned long qmask) 890 890 { 891 891 unsigned long num_entries = (qmask + 1) / 64; 892 892 unsigned long status;
+1 -1
arch/sparc/prom/misc_64.c
··· 88 88 /* Drop into the prom, but completely terminate the program. 89 89 * No chance of continuing. 90 90 */ 91 - void prom_halt(void) 91 + void notrace prom_halt(void) 92 92 { 93 93 #ifdef CONFIG_SUN_LDOMS 94 94 if (ldom_domaining_enabled)
+3 -4
arch/sparc/prom/printf.c
··· 14 14 */ 15 15 16 16 #include <linux/kernel.h> 17 + #include <linux/compiler.h> 17 18 18 19 #include <asm/openprom.h> 19 20 #include <asm/oplib.h> 20 21 21 22 static char ppbuf[1024]; 22 23 23 - void 24 - prom_write(const char *buf, unsigned int n) 24 + void notrace prom_write(const char *buf, unsigned int n) 25 25 { 26 26 char ch; 27 27 ··· 33 33 } 34 34 } 35 35 36 - void 37 - prom_printf(const char *fmt, ...) 36 + void notrace prom_printf(const char *fmt, ...) 38 37 { 39 38 va_list args; 40 39 int i;