public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: PPC: Fix unknown SPR error message in emulation
@ 2012-04-24  9:23 Mihai Caraman
  2012-04-26 13:25 ` Alexander Graf
  0 siblings, 1 reply; 4+ messages in thread
From: Mihai Caraman @ 2012-04-24  9:23 UTC (permalink / raw)
  To: kvm-ppc; +Cc: kvm, Mihai Caraman

mtspr/mfspr emulation prints an error message for unknown SPRs. The message
was badly formatted displaying the hex value without 0x prefix. Use decimal
representation in accordance with the manuals, though the Linux headers
annoyingly use hex.

Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
---
 arch/powerpc/kvm/emulate.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
index afc9154..06d12c4 100644
--- a/arch/powerpc/kvm/emulate.c
+++ b/arch/powerpc/kvm/emulate.c
@@ -296,7 +296,7 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
 			default:
 				emulated = kvmppc_core_emulate_mfspr(vcpu, sprn, rt);
 				if (emulated == EMULATE_FAIL) {
-					printk("mfspr: unknown spr %x\n", sprn);
+					printk("mfspr: unknown spr %u\n", sprn);
 					kvmppc_set_gpr(vcpu, rt, 0);
 				}
 				break;
@@ -364,7 +364,7 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
 			default:
 				emulated = kvmppc_core_emulate_mtspr(vcpu, sprn, rs);
 				if (emulated == EMULATE_FAIL)
-					printk("mtspr: unknown spr %x\n", sprn);
+					printk("mfspr: unknown spr %u\n", sprn);
 				break;
 			}
 			kvmppc_set_exit_type(vcpu, EMULATED_MTSPR_EXITS);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: PPC: Fix unknown SPR error message in emulation
  2012-04-24  9:23 [PATCH] KVM: PPC: Fix unknown SPR error message in emulation Mihai Caraman
@ 2012-04-26 13:25 ` Alexander Graf
  2012-04-26 17:47   ` Scott Wood
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Graf @ 2012-04-26 13:25 UTC (permalink / raw)
  To: Mihai Caraman; +Cc: kvm-ppc, kvm


On 24.04.2012, at 11:23, Mihai Caraman wrote:

> mtspr/mfspr emulation prints an error message for unknown SPRs. The message
> was badly formatted displaying the hex value without 0x prefix. Use decimal
> representation in accordance with the manuals, though the Linux headers
> annoyingly use hex.
> 
> Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
> ---
> arch/powerpc/kvm/emulate.c |    4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
> index afc9154..06d12c4 100644
> --- a/arch/powerpc/kvm/emulate.c
> +++ b/arch/powerpc/kvm/emulate.c
> @@ -296,7 +296,7 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
> 			default:
> 				emulated = kvmppc_core_emulate_mfspr(vcpu, sprn, rt);
> 				if (emulated == EMULATE_FAIL) {
> -					printk("mfspr: unknown spr %x\n", sprn);
> +					printk("mfspr: unknown spr %u\n", sprn);

This means that if an older kernel threw an error on let's say SPR_VRSAVE, we got an error saying that it couldn't find "100", while with new kernels we'd get 256. However, we don't have any indication if we're on an old or new kernel, making user failures pretty hard to debug.

So either we change the message to hex always, with 0x prefixed, or we rephrase it to give us some indication if the user is running a patched kernel.


Alex


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: PPC: Fix unknown SPR error message in emulation
  2012-04-26 13:25 ` Alexander Graf
@ 2012-04-26 17:47   ` Scott Wood
  2012-04-28 19:34     ` Caraman Mihai Claudiu-B02008
  0 siblings, 1 reply; 4+ messages in thread
From: Scott Wood @ 2012-04-26 17:47 UTC (permalink / raw)
  To: Alexander Graf; +Cc: Mihai Caraman, kvm-ppc, kvm

On 04/26/2012 08:25 AM, Alexander Graf wrote:
> 
> On 24.04.2012, at 11:23, Mihai Caraman wrote:
> 
>> mtspr/mfspr emulation prints an error message for unknown SPRs. The message
>> was badly formatted displaying the hex value without 0x prefix. Use decimal
>> representation in accordance with the manuals, though the Linux headers
>> annoyingly use hex.
>>
>> Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
>> ---
>> arch/powerpc/kvm/emulate.c |    4 ++--
>> 1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
>> index afc9154..06d12c4 100644
>> --- a/arch/powerpc/kvm/emulate.c
>> +++ b/arch/powerpc/kvm/emulate.c
>> @@ -296,7 +296,7 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
>> 			default:
>> 				emulated = kvmppc_core_emulate_mfspr(vcpu, sprn, rt);
>> 				if (emulated == EMULATE_FAIL) {
>> -					printk("mfspr: unknown spr %x\n", sprn);
>> +					printk("mfspr: unknown spr %u\n", sprn);
> 
> This means that if an older kernel threw an error on let's say
> SPR_VRSAVE, we got an error saying that it couldn't find "100", while

Eww.  Perhaps we should grep for bare %x and fix them all at once?  And
not let any more in...

> with new kernels we'd get 256. However, we don't have any indication
> if we're on an old or new kernel, making user failures pretty hard to
> debug.
> 
> So either we change the message to hex always, with 0x prefixed, or
> we rephrase it to give us some indication if the user is running a
> patched kernel.

How about:
printk("mfspr: unknown spr %u (dec)\n", sprn);

Or if we just care about having some sort of marker that those familiar
with the history will understand, and don't want something nicer-looking
that doesn't make it look like appending (dec) should be normal practice:

printk("mfspr: unknown spr #%u\n", sprn);

-Scott

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] KVM: PPC: Fix unknown SPR error message in emulation
  2012-04-26 17:47   ` Scott Wood
@ 2012-04-28 19:34     ` Caraman Mihai Claudiu-B02008
  0 siblings, 0 replies; 4+ messages in thread
From: Caraman Mihai Claudiu-B02008 @ 2012-04-28 19:34 UTC (permalink / raw)
  To: Wood Scott-B07421, Alexander Graf
  Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org

On 04/26/2012 08:25 AM, Alexander Graf wrote:
>
> On 24.04.2012, at 11:23, Mihai Caraman wrote:
>
>> mtspr/mfspr emulation prints an error message for unknown SPRs. The message
>> was badly formatted displaying the hex value without 0x prefix. Use decimal
>> representation in accordance with the manuals, though the Linux headers
>> annoyingly use hex.
> 
> However, we don't have any indication if we're on an old or new kernel, making user \
> failures pretty hard to debug.

One argument for switching to decimal was that booke206 mfpmr/mtpmr emulation
already used it but I see now that this support is not upstream yet.

-Mike

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-04-28 19:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-24  9:23 [PATCH] KVM: PPC: Fix unknown SPR error message in emulation Mihai Caraman
2012-04-26 13:25 ` Alexander Graf
2012-04-26 17:47   ` Scott Wood
2012-04-28 19:34     ` Caraman Mihai Claudiu-B02008

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox