Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5fd0f1ca authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'xtensa-20161116' of git://github.com/jcmvbkbc/linux-xtensa

Pull Xtensa fixes from Max Filippov:

 - fix register dumps, stack dumps and stack traces that got torn due to
   recent printk changes

 - wire up pkey_{mprotect,alloc,free} syscalls

* tag 'xtensa-20161116' of git://github.com/jcmvbkbc/linux-xtensa:
  xtensa: wire up new pkey_{mprotect,alloc,free} syscalls
  xtensa: clean up printk usage for boot/crash logging
parents 984573ab 709fb1f9
Loading
Loading
Loading
Loading
+8 −1
Original line number Original line Diff line number Diff line
@@ -767,7 +767,14 @@ __SYSCALL(346, sys_preadv2, 6)
#define __NR_pwritev2				347
#define __NR_pwritev2				347
__SYSCALL(347, sys_pwritev2, 6)
__SYSCALL(347, sys_pwritev2, 6)


#define __NR_syscall_count			348
#define __NR_pkey_mprotect			348
__SYSCALL(348, sys_pkey_mprotect, 4)
#define __NR_pkey_alloc				349
__SYSCALL(349, sys_pkey_alloc, 2)
#define __NR_pkey_free				350
__SYSCALL(350, sys_pkey_free, 1)

#define __NR_syscall_count			351


/*
/*
 * sysxtensa syscall handler
 * sysxtensa syscall handler
+7 −7
Original line number Original line Diff line number Diff line
@@ -172,9 +172,10 @@ void __init time_init(void)
{
{
	of_clk_init(NULL);
	of_clk_init(NULL);
#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
	printk("Calibrating CPU frequency ");
	pr_info("Calibrating CPU frequency ");
	calibrate_ccount();
	calibrate_ccount();
	printk("%d.%02d MHz\n", (int)ccount_freq/1000000,
	pr_cont("%d.%02d MHz\n",
		(int)ccount_freq / 1000000,
		(int)(ccount_freq / 10000) % 100);
		(int)(ccount_freq / 10000) % 100);
#else
#else
	ccount_freq = CONFIG_XTENSA_CPU_CLOCK*1000000UL;
	ccount_freq = CONFIG_XTENSA_CPU_CLOCK*1000000UL;
@@ -210,8 +211,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)
void calibrate_delay(void)
void calibrate_delay(void)
{
{
	loops_per_jiffy = ccount_freq / HZ;
	loops_per_jiffy = ccount_freq / HZ;
	printk("Calibrating delay loop (skipped)... "
	pr_info("Calibrating delay loop (skipped)... %lu.%02lu BogoMIPS preset\n",
	       "%lu.%02lu BogoMIPS preset\n",
		loops_per_jiffy / (1000000 / HZ),
		loops_per_jiffy / (1000000 / HZ),
		(loops_per_jiffy / (10000 / HZ)) % 100);
		(loops_per_jiffy / (10000 / HZ)) % 100);
}
}
+22 −52
Original line number Original line Diff line number Diff line
@@ -465,17 +465,16 @@ void show_regs(struct pt_regs * regs)


	for (i = 0; i < 16; i++) {
	for (i = 0; i < 16; i++) {
		if ((i % 8) == 0)
		if ((i % 8) == 0)
			printk(KERN_INFO "a%02d:", i);
			pr_info("a%02d:", i);
		printk(KERN_CONT " %08lx", regs->areg[i]);
		pr_cont(" %08lx", regs->areg[i]);
	}
	}
	printk(KERN_CONT "\n");
	pr_cont("\n");

	pr_info("pc: %08lx, ps: %08lx, depc: %08lx, excvaddr: %08lx\n",
	printk("pc: %08lx, ps: %08lx, depc: %08lx, excvaddr: %08lx\n",
		regs->pc, regs->ps, regs->depc, regs->excvaddr);
		regs->pc, regs->ps, regs->depc, regs->excvaddr);
	printk("lbeg: %08lx, lend: %08lx lcount: %08lx, sar: %08lx\n",
	pr_info("lbeg: %08lx, lend: %08lx lcount: %08lx, sar: %08lx\n",
		regs->lbeg, regs->lend, regs->lcount, regs->sar);
		regs->lbeg, regs->lend, regs->lcount, regs->sar);
	if (user_mode(regs))
	if (user_mode(regs))
		printk("wb: %08lx, ws: %08lx, wmask: %08lx, syscall: %ld\n",
		pr_cont("wb: %08lx, ws: %08lx, wmask: %08lx, syscall: %ld\n",
			regs->windowbase, regs->windowstart, regs->wmask,
			regs->windowbase, regs->windowstart, regs->wmask,
			regs->syscall);
			regs->syscall);
}
}
@@ -483,7 +482,7 @@ void show_regs(struct pt_regs * regs)
static int show_trace_cb(struct stackframe *frame, void *data)
static int show_trace_cb(struct stackframe *frame, void *data)
{
{
	if (kernel_text_address(frame->pc)) {
	if (kernel_text_address(frame->pc)) {
		printk(" [<%08lx>] ", frame->pc);
		pr_cont(" [<%08lx>]", frame->pc);
		print_symbol(" %s\n", frame->pc);
		print_symbol(" %s\n", frame->pc);
	}
	}
	return 0;
	return 0;
@@ -494,19 +493,13 @@ void show_trace(struct task_struct *task, unsigned long *sp)
	if (!sp)
	if (!sp)
		sp = stack_pointer(task);
		sp = stack_pointer(task);


	printk("Call Trace:");
	pr_info("Call Trace:\n");
#ifdef CONFIG_KALLSYMS
	printk("\n");
#endif
	walk_stackframe(sp, show_trace_cb, NULL);
	walk_stackframe(sp, show_trace_cb, NULL);
	printk("\n");
#ifndef CONFIG_KALLSYMS
	pr_cont("\n");
#endif
}
}


/*
 * This routine abuses get_user()/put_user() to reference pointers
 * with at least a bit of error checking ...
 */

static int kstack_depth_to_print = 24;
static int kstack_depth_to_print = 24;


void show_stack(struct task_struct *task, unsigned long *sp)
void show_stack(struct task_struct *task, unsigned long *sp)
@@ -518,52 +511,29 @@ void show_stack(struct task_struct *task, unsigned long *sp)
		sp = stack_pointer(task);
		sp = stack_pointer(task);
	stack = sp;
	stack = sp;


	printk("\nStack: ");
	pr_info("Stack:\n");


	for (i = 0; i < kstack_depth_to_print; i++) {
	for (i = 0; i < kstack_depth_to_print; i++) {
		if (kstack_end(sp))
		if (kstack_end(sp))
			break;
			break;
		if (i && ((i % 8) == 0))
		pr_cont(" %08lx", *sp++);
			printk("\n       ");
		if (i % 8 == 7)
		printk("%08lx ", *sp++);
			pr_cont("\n");
	}
	}
	printk("\n");
	show_trace(task, stack);
	show_trace(task, stack);
}
}


void show_code(unsigned int *pc)
{
	long i;

	printk("\nCode:");

	for(i = -3 ; i < 6 ; i++) {
		unsigned long insn;
		if (__get_user(insn, pc + i)) {
			printk(" (Bad address in pc)\n");
			break;
		}
		printk("%c%08lx%c",(i?' ':'<'),insn,(i?' ':'>'));
	}
}

DEFINE_SPINLOCK(die_lock);
DEFINE_SPINLOCK(die_lock);


void die(const char * str, struct pt_regs * regs, long err)
void die(const char * str, struct pt_regs * regs, long err)
{
{
	static int die_counter;
	static int die_counter;
	int nl = 0;


	console_verbose();
	console_verbose();
	spin_lock_irq(&die_lock);
	spin_lock_irq(&die_lock);


	printk("%s: sig: %ld [#%d]\n", str, err, ++die_counter);
	pr_info("%s: sig: %ld [#%d]%s\n", str, err, ++die_counter,
#ifdef CONFIG_PREEMPT
		IS_ENABLED(CONFIG_PREEMPT) ? " PREEMPT" : "");
	printk("PREEMPT ");
	nl = 1;
#endif
	if (nl)
		printk("\n");
	show_regs(regs);
	show_regs(regs);
	if (!user_mode(regs))
	if (!user_mode(regs))
		show_stack(NULL, (unsigned long*)regs->areg[1]);
		show_stack(NULL, (unsigned long*)regs->areg[1]);