linux-um archives
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Richard Weinberger <richard@nod.at>
Cc: user-mode-linux-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, Joe Perches <joe@perches.com>
Subject: Re: [PATCH 5/7] um: print info about fatal segfaults
Date: Tue, 24 May 2011 12:34:33 -0700	[thread overview]
Message-ID: <20110524123433.0b74f33e.akpm@linux-foundation.org> (raw)
In-Reply-To: <1306075716-20042-5-git-send-email-richard@nod.at>

On Sun, 22 May 2011 16:48:34 +0200
Richard Weinberger <richard@nod.at> 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.


  reply	other threads:[~2011-05-24 19:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-22 14:48 [PATCH 1/7] um: fix UML_LIB_PATH Richard Weinberger
2011-05-22 14:48 ` [uml-devel] [PATCH 2/7] um: remove SIGHUP handler Richard Weinberger
2011-05-22 14:48 ` [uml-devel] [PATCH 3/7] um: add earlyprintk support Richard Weinberger
2011-05-22 14:48 ` [uml-devel] [PATCH 4/7] um: add ucast ethernet transport Richard Weinberger
2011-05-22 14:48 ` [uml-devel] [PATCH 5/7] um: print info about fatal segfaults Richard Weinberger
2011-05-24 19:34   ` Andrew Morton [this message]
2011-05-24 20:02     ` [uml-devel] [PATCH] checkpatch: Add warning for uses of printk_ratelimit Joe Perches
2011-05-24 20:14     ` [PATCH 5/7] um: print info about fatal segfaults Richard Weinberger
2011-05-22 14:48 ` [uml-devel] [PATCH 6/7] um: include linux/prefetch.h Richard Weinberger
2011-05-22 14:48 ` [uml-devel] [PATCH 7/7] um: fix crash while os_dump_core() Richard Weinberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110524123433.0b74f33e.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richard@nod.at \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox