linux-um archives
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Jiri Kosina <trivial@kernel.org>, Tony Luck <tony.luck@intel.com>,
	Jeff Dike <jdike@addtoit.com>,
	Richard Weinberger <richard@nod.at>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, linux-edac@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	user-mode-linux-devel@lists.sourceforge.net,
	user-mode-linux-user@lists.sourceforge.net
Subject: Re: [TRIVIAL PATCH 16/26] x86: Convert print_symbol to %pSR
Date: Wed, 12 Dec 2012 13:30:03 -0800	[thread overview]
Message-ID: <1355347803.8538.16.camel@joe-AO722> (raw)
In-Reply-To: <20121212210959.GH8760@liondog.tnic>

On Wed, 2012-12-12 at 22:09 +0100, Borislav Petkov wrote:
> On Wed, Dec 12, 2012 at 10:19:05AM -0800, Joe Perches wrote:
> > Use the new vsprintf extension to avoid any possible
> > message interleaving.
[]
> > diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
[]
> > @@ -242,13 +242,14 @@ static void print_mce(struct mce *m)
> >  	       m->extcpu, m->mcgstatus, m->bank, m->status);
> >  
> >  	if (m->ip) {
> > -		pr_emerg(HW_ERR "RIP%s %02x:<%016Lx> ",
> > -			!(m->mcgstatus & MCG_STATUS_EIPV) ? " !INEXACT!" : "",
> > -				m->cs, m->ip);
> > -
> >  		if (m->cs == __KERNEL_CS)
> > -			print_symbol("{%s}", m->ip);
> > -		pr_cont("\n");
> > +			pr_emerg(HW_ERR "RIP%s %02x:<%016Lx> {%pSR}\n",
> > +				 !(m->mcgstatus & MCG_STATUS_EIPV) ? " !INEXACT!" : "",
> > +				 m->cs, m->ip, (void *)m->ip);
> > +		else
> > +			pr_emerg(HW_ERR "RIP%s %02x:<%016Lx>\n",
> > +				 !(m->mcgstatus & MCG_STATUS_EIPV) ? " !INEXACT!" : "",
> > +				 m->cs, m->ip);
> >  	}
> 
> I think I'd go ahead and ACK this unless Tony has some comments. I'm not
> happy about the two pr_emerg calls based on the conditional.

It was done to avoid interleaving.

> Or, Tony, what do you think, could we get away if we printed empty
> string for when m->cs != __KERNEL_CS? I'm thinking of not breaking any
> userspace which is parsing that output and seeing "... {}" in that case.
> 
> This assumes that vsprintf can print (void *)0 when passed as an
> argument through %pSR. Joe?

Definitely yes when not #defined CONFIG_KALLSYMS

I believe no object exists at address 0 for all
arches so I believe yes for CONFIG_KALLSYMS too,

My preference is to eventually do away with all the
	"[%0(size)lx] %pSR", addr, (void *)addr
uses and create another %pSx that emits the pointer
address and the function/offset in one go in a
standardized style without caring about the pointer
size.

Something like:

	"%pSp", (void *)addr

would emit

	[<7def0123>] function_name+offset/size



  reply	other threads:[~2012-12-12 21:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-12 18:18 [TRIVIAL PATCH 00/26] treewide: Add and use vsprintf extension %pSR Joe Perches
2012-12-12 18:19 ` [TRIVIAL PATCH 14/26] um: Convert print_symbol to %pSR Joe Perches
2012-12-12 18:19 ` [TRIVIAL PATCH 16/26] x86: " Joe Perches
2012-12-12 21:09   ` Borislav Petkov
2012-12-12 21:30     ` Joe Perches [this message]
2012-12-12 21:48       ` Borislav Petkov
2012-12-12 21:49       ` Luck, Tony
2012-12-12 22:23         ` Joe Perches
2012-12-12 22:45           ` Borislav Petkov
2012-12-13 18:23             ` Joe Perches
2012-12-13 18:37               ` Borislav Petkov
2012-12-13 18:42                 ` H. Peter Anvin
2012-12-13 19:05                   ` Borislav Petkov
2012-12-13 21:35                     ` H. Peter Anvin
2012-12-13 18:57                 ` Joe Perches
2012-12-13 19:13 ` [TRIVIAL PATCH V2 " Joe Perches

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=1355347803.8538.16.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jdike@addtoit.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=richard@nod.at \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=trivial@kernel.org \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    --cc=user-mode-linux-user@lists.sourceforge.net \
    --cc=x86@kernel.org \
    /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