Skip to content

Commit 997dd26

Browse files
committed
powerpc/traps: Avoid rate limit messages from show unhandled signals
In the recent commit to add an explicit ratelimit state when showing unhandled signals, commit 35a52a1 ("powerpc/traps: Use an explicit ratelimit state for show_signal_msg()"), I put the check of show_unhandled_signals and the ratelimit state before the call to unhandled_signal() so as to avoid unnecessarily calling the latter when show_unhandled_signals is false. However that causes us to check the ratelimit state on every call, so if we take a lot of *handled* signals that has the effect of making the ratelimit code print warnings that callbacks have been suppressed when they haven't. So rearrange the code so that we check show_unhandled_signals first, then call unhandled_signal() and finally check the ratelimit state. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Reviewed-by: Murilo Opsfelder Araujo <muriloo@linux.ibm.com>
1 parent 993ff6d commit 997dd26

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

arch/powerpc/kernel/traps.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -315,22 +315,21 @@ void user_single_step_siginfo(struct task_struct *tsk,
315315
info->si_addr = (void __user *)regs->nip;
316316
}
317317

318-
static bool show_unhandled_signals_ratelimited(void)
318+
static void show_signal_msg(int signr, struct pt_regs *regs, int code,
319+
unsigned long addr)
319320
{
320321
static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL,
321322
DEFAULT_RATELIMIT_BURST);
322-
return show_unhandled_signals && __ratelimit(&rs);
323-
}
324323

325-
static void show_signal_msg(int signr, struct pt_regs *regs, int code,
326-
unsigned long addr)
327-
{
328-
if (!show_unhandled_signals_ratelimited())
324+
if (!show_unhandled_signals)
329325
return;
330326

331327
if (!unhandled_signal(current, signr))
332328
return;
333329

330+
if (!__ratelimit(&rs))
331+
return;
332+
334333
pr_info("%s[%d]: %s (%d) at %lx nip %lx lr %lx code %x",
335334
current->comm, current->pid, signame(signr), signr,
336335
addr, regs->nip, regs->link, code);

0 commit comments

Comments
 (0)