linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Neuling <mikey@neuling.org>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: linuxppc-dev@lists.ozlabs.org, Anton Blanchard <anton@samba.org>
Subject: Re: [PATCH 3/3] powerpc: Correctly context switch DSCR on POWER8
Date: Mon, 05 Aug 2013 19:26:36 +1000	[thread overview]
Message-ID: <15850.1375694796@ale.ozlabs.ibm.com> (raw)
In-Reply-To: <20130805184205.79cafb9ac299313228ec53cc@canb.auug.org.au>

Stephen Rothwell <sfr@canb.auug.org.au> wrote:

> [This time from a good email address :-)]
> 
> Hi Mikey,
> 
> On Mon,  5 Aug 2013 17:28:06 +1000 Michael Neuling
> <mikey@neuling.org> wrote:
> >
> > +++ b/arch/powerpc/kernel/traps.c
> > @@ -1296,43 +1294,56 @@ void vsx_unavailable_exception(struct pt_regs *regs)
> >  	die("Unrecoverable VSX Unavailable Exception", regs, SIGABRT);
> >  }
> >  
> > +#ifdef CONFIG_PPC64
> >  void facility_unavailable_exception(struct pt_regs *regs)
> >  {
> >  	static char *facility_strings[] = {
> > -		"FPU",
> > -		"VMX/VSX",
> > -		"DSCR",
> > -		"PMU SPRs",
> > -		"BHRB",
> > -		"TM",
> > -		"AT",
> > -		"EBB",
> > -		"TAR",
> > +		[FSCR_FP_LG] = "FPU",
> > +		[FSCR_VECVSX_LG] = "VMX/VSX",
> > +		[FSCR_DSCR_LG] = "DSCR",
> > +		[FSCR_PM_LG] = "PMU SPRs",
> > +		[FSCR_BHRB_LG] = "BHRB",
> > +		[FSCR_TM_LG] = "TM",
> > +		[FSCR_EBB_LG] = "EBB",
> > +		[FSCR_TAR_LG] = "TAR",
> 
> I assume that you intentionally dropped "AT".

Yeah.

> 
> >  	};
> > -	char *facility, *prefix;
> > +	char *facility;
> >  	u64 value;
> > +	u8 status;
> > +	bool hv;
> >  
> >  	if (regs->trap == 0xf60) {
> >  		value = mfspr(SPRN_FSCR);
> > -		prefix = "";
> > +		hv = false;
> >  	} else {
> >  		value = mfspr(SPRN_HFSCR);
> > -		prefix = "Hypervisor ";
> > +		hv = true;
> >  	}
> 
> Maybe:
> 	hv = regs->trap == 0xf60;
> 	if (hv)
> 		value = mfspr(SPRN_HFSCR);
> 	else
> 		value = mfspr(SPRN_HFSCR);
> or
> 	value = mfspr(hv ? SPRN_HFSCR : SPRN_HFSCR);

ok.

> 
> > -	value = value >> 56;
> > +	status = value >> 56;
> > +
> > +	if (status < ARRAY_SIZE(facility_strings))
> > +		facility = facility_strings[status];
> > +	else
> > +		facility = "unknown";
> 
> For entries in the array that are not set, this will give facility ==
> NULL.  Is that what you intended?

No it wasn't, I'll catch that case, thanks.

> 
> >  	pr_err("%sFacility '%s' unavailable, exception at 0x%lx, MSR=%lx\n",
> > -		prefix, facility, regs->nip, regs->msr);
> > +	       hv ? "Hypervisor ":"", facility, regs->nip, regs->msr);
> 
> ... and this may attempt to print a NULL pointer with %s.  Also please
> put spaces around the : .

OK.

Mikey

  reply	other threads:[~2013-08-05  9:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-05  7:28 [PATCH 1/3] powerpc: Rework setting up H/FSCR bit definitions Michael Neuling
2013-08-05  7:28 ` [PATCH 2/3] powerpc: Fix hypervisor facility unavaliable vector number Michael Neuling
2013-08-05  7:28 ` [PATCH 3/3] powerpc: Correctly context switch DSCR on POWER8 Michael Neuling
2013-08-05  8:42   ` Stephen Rothwell
2013-08-05  9:26     ` Michael Neuling [this message]
2013-08-05 10:16       ` Michael Neuling
2013-08-05 11:00         ` [PATCH v2 " Michael Neuling
2013-08-09  5:49           ` [PATCH v3 " Michael Neuling
2013-08-09  3:46 ` [PATCH v2 1/3] powerpc: Rework setting up H/FSCR bit definitions Michael Neuling

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=15850.1375694796@ale.ozlabs.ibm.com \
    --to=mikey@neuling.org \
    --cc=anton@samba.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=sfr@canb.auug.org.au \
    /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;
as well as URLs for NNTP newsgroup(s).