Re: [PATCH 5/7] um: print info about fatal segfaults

From: Andrew Morton
Date: Tue May 24 2011 - 15:34:58 EST


On Sun, 22 May 2011 16:48:34 +0200
Richard Weinberger <richard@xxxxxx> wrote:

> +static void show_segv_info(struct uml_pt_regs *regs)
> +{
> + struct task_struct *tsk = current;
> + struct faultinfo *fi = UPT_FAULTINFO(regs);
> +
> + if (!unhandled_signal(tsk, SIGSEGV))
> + return;
> +
> + if (!printk_ratelimit())
> + return;
> +
> + printk("%s%s[%d]: segfault at %lx ip %p sp %p error %x",
> + task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG,
> + tsk->comm, task_pid_nr(tsk), FAULT_ADDRESS(*fi),
> + (void *)UPT_IP(regs), (void *)UPT_SP(regs),
> + fi->error_code);
> +
> + print_vma_addr(KERN_CONT " in ", UPT_IP(regs));
> + printk(KERN_CONT "\n");
> +}

Please see the nice comment in printk.h

/*
* Please don't use printk_ratelimit(), because it shares ratelimiting state
* with all other unrelated printk_ratelimit() callsites. Instead use
* printk_ratelimited() or plain old __ratelimit().
*/

I thought we had a checkpatch rule for this but apparently I dreamed
it.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/