Commit 35a52a10 authored by Murilo Opsfelder Araujo's avatar Murilo Opsfelder Araujo Committed by Michael Ellerman

powerpc/traps: Use an explicit ratelimit state for show_signal_msg()

Replace printk_ratelimited() by printk() and a default rate limit
burst to limit displaying unhandled signals messages.

This will allow us to call print_vma_addr() in a future patch, which
does not work with printk_ratelimited().
Signed-off-by: default avatarMurilo Opsfelder Araujo <muriloo@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 658b0f92
...@@ -301,6 +301,13 @@ void user_single_step_siginfo(struct task_struct *tsk, ...@@ -301,6 +301,13 @@ void user_single_step_siginfo(struct task_struct *tsk,
info->si_addr = (void __user *)regs->nip; info->si_addr = (void __user *)regs->nip;
} }
static bool show_unhandled_signals_ratelimited(void)
{
static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL,
DEFAULT_RATELIMIT_BURST);
return show_unhandled_signals && __ratelimit(&rs);
}
static void show_signal_msg(int signr, struct pt_regs *regs, int code, static void show_signal_msg(int signr, struct pt_regs *regs, int code,
unsigned long addr) unsigned long addr)
{ {
...@@ -309,11 +316,15 @@ static void show_signal_msg(int signr, struct pt_regs *regs, int code, ...@@ -309,11 +316,15 @@ static void show_signal_msg(int signr, struct pt_regs *regs, int code,
const char fmt64[] = KERN_INFO "%s[%d]: unhandled signal %d " \ const char fmt64[] = KERN_INFO "%s[%d]: unhandled signal %d " \
"at %016lx nip %016lx lr %016lx code %x\n"; "at %016lx nip %016lx lr %016lx code %x\n";
if (show_unhandled_signals && unhandled_signal(current, signr)) { if (!show_unhandled_signals_ratelimited())
printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32, return;
if (!unhandled_signal(current, signr))
return;
printk(regs->msr & MSR_64BIT ? fmt64 : fmt32,
current->comm, current->pid, signr, current->comm, current->pid, signr,
addr, regs->nip, regs->link, code); addr, regs->nip, regs->link, code);
}
} }
void _exception_pkey(int signr, struct pt_regs *regs, int code, void _exception_pkey(int signr, struct pt_regs *regs, int code,
......
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