All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/tm: Print 64-bits MSR
@ 2018-08-07  0:32 Breno Leitao
  2018-08-07  1:17 ` Michael Neuling
  0 siblings, 1 reply; 9+ messages in thread
From: Breno Leitao @ 2018-08-07  0:32 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: mikey, Breno Leitao

On a kernel TM Bad thing program exception, the MSR is not being properly
displayed, since it dumps a 32-bits value. MSR is a 64 bits register for
all platforms that have HTM enabled.

This patch dumps the MSR value as 64-bits instead of 32 bits.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 arch/powerpc/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 0e17dcb48720..cd561fd89532 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -1402,7 +1402,7 @@ void program_check_exception(struct pt_regs *regs)
 			goto bail;
 		} else {
 			printk(KERN_EMERG "Unexpected TM Bad Thing exception "
-			       "at %lx (msr 0x%x)\n", regs->nip, reason);
+			       "at %lx (msr 0x%lx)\n", regs->nip, regs->msr);
 			die("Unrecoverable exception", regs, SIGABRT);
 		}
 	}
-- 
2.16.3

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

* Re: [PATCH] powerpc/tm: Print 64-bits MSR
  2018-08-07  0:32 [PATCH] powerpc/tm: Print 64-bits MSR Breno Leitao
@ 2018-08-07  1:17 ` Michael Neuling
  2018-08-07 13:35   ` [PATCH v2] " Breno Leitao
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Neuling @ 2018-08-07  1:17 UTC (permalink / raw)
  To: Breno Leitao, linuxppc-dev

On Mon, 2018-08-06 at 21:32 -0300, Breno Leitao wrote:
> On a kernel TM Bad thing program exception, the MSR is not being properly
> displayed, since it dumps a 32-bits value. MSR is a 64 bits register for
> all platforms that have HTM enabled.
>=20
> This patch dumps the MSR value as 64-bits instead of 32 bits.

(sorry I was distracted when you asked me about this before offline...)

I think you might need to clear up in the description why you are changing
  reason -> msr.

Mikey

> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
>  arch/powerpc/kernel/traps.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>=20
> diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
> index 0e17dcb48720..cd561fd89532 100644
> --- a/arch/powerpc/kernel/traps.c
> +++ b/arch/powerpc/kernel/traps.c
> @@ -1402,7 +1402,7 @@ void program_check_exception(struct pt_regs *regs)
>  			goto bail;
>  		} else {
>  			printk(KERN_EMERG "Unexpected TM Bad Thing exception
> "
> -			       "at %lx (msr 0x%x)\n", regs->nip, reason);
> +			       "at %lx (msr 0x%lx)\n", regs->nip, regs->msr);
>=20
>  			die("Unrecoverable exception", regs, SIGABRT);
>  		}
>  	}

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

* [PATCH v2] powerpc/tm: Print 64-bits MSR
  2018-08-07  1:17 ` Michael Neuling
@ 2018-08-07 13:35   ` Breno Leitao
  2018-08-07 15:50     ` Segher Boessenkool
                       ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Breno Leitao @ 2018-08-07 13:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: mikey, Breno Leitao

On a kernel TM Bad thing program exception, the Machine State Register
(MSR) is not being properly displayed. The exception code dumps a 32-bits
value but MSR is a 64 bits register for all platforms that have HTM
enabled.

This patch dumps the MSR value as a 64-bits value instead of 32 bits. In
order to do so, the 'reason' variable could not be used, since it trimmed
MSR to 32-bits (int).

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 arch/powerpc/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 0e17dcb48720..cd561fd89532 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -1402,7 +1402,7 @@ void program_check_exception(struct pt_regs *regs)
 			goto bail;
 		} else {
 			printk(KERN_EMERG "Unexpected TM Bad Thing exception "
-			       "at %lx (msr 0x%x)\n", regs->nip, reason);
+			       "at %lx (msr 0x%lx)\n", regs->nip, regs->msr);
 			die("Unrecoverable exception", regs, SIGABRT);
 		}
 	}
-- 
2.16.3

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

* Re: [PATCH v2] powerpc/tm: Print 64-bits MSR
  2018-08-07 13:35   ` [PATCH v2] " Breno Leitao
@ 2018-08-07 15:50     ` Segher Boessenkool
  2018-08-07 17:15     ` Christophe LEROY
  2018-10-04  6:14     ` [v2] " Michael Ellerman
  2 siblings, 0 replies; 9+ messages in thread
From: Segher Boessenkool @ 2018-08-07 15:50 UTC (permalink / raw)
  To: Breno Leitao; +Cc: linuxppc-dev, mikey

On Tue, Aug 07, 2018 at 10:35:00AM -0300, Breno Leitao wrote:
> On a kernel TM Bad thing program exception, the Machine State Register
> (MSR) is not being properly displayed. The exception code dumps a 32-bits
> value but MSR is a 64 bits register for all platforms that have HTM
> enabled.
> 
> This patch dumps the MSR value as a 64-bits value instead of 32 bits. In
> order to do so, the 'reason' variable could not be used, since it trimmed
> MSR to 32-bits (int).

So maybe reason should be a long instead of an int?


Segher

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

* Re: [PATCH v2] powerpc/tm: Print 64-bits MSR
  2018-08-07 13:35   ` [PATCH v2] " Breno Leitao
  2018-08-07 15:50     ` Segher Boessenkool
@ 2018-08-07 17:15     ` Christophe LEROY
  2018-08-07 18:41       ` Breno Leitao
  2018-10-04  6:14     ` [v2] " Michael Ellerman
  2 siblings, 1 reply; 9+ messages in thread
From: Christophe LEROY @ 2018-08-07 17:15 UTC (permalink / raw)
  To: Breno Leitao, linuxppc-dev; +Cc: mikey



Le 07/08/2018 à 15:35, Breno Leitao a écrit :
> On a kernel TM Bad thing program exception, the Machine State Register
> (MSR) is not being properly displayed. The exception code dumps a 32-bits
> value but MSR is a 64 bits register for all platforms that have HTM
> enabled.
> 
> This patch dumps the MSR value as a 64-bits value instead of 32 bits. In
> order to do so, the 'reason' variable could not be used, since it trimmed
> MSR to 32-bits (int).

reason is not always regs->msr, see get_reason(), allthough in your case 
it is.

I think it would be better to change 'reason' to 'unsigned long' instead 
of replacing it by regs->msr for the printk.

Christophe


> 
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
>   arch/powerpc/kernel/traps.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
> index 0e17dcb48720..cd561fd89532 100644
> --- a/arch/powerpc/kernel/traps.c
> +++ b/arch/powerpc/kernel/traps.c
> @@ -1402,7 +1402,7 @@ void program_check_exception(struct pt_regs *regs)
>   			goto bail;
>   		} else {
>   			printk(KERN_EMERG "Unexpected TM Bad Thing exception "
> -			       "at %lx (msr 0x%x)\n", regs->nip, reason);
> +			       "at %lx (msr 0x%lx)\n", regs->nip, regs->msr);
>   			die("Unrecoverable exception", regs, SIGABRT);
>   		}
>   	}
> 

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

* Re: [PATCH v2] powerpc/tm: Print 64-bits MSR
  2018-08-07 17:15     ` Christophe LEROY
@ 2018-08-07 18:41       ` Breno Leitao
  2018-08-07 18:57         ` LEROY Christophe
  0 siblings, 1 reply; 9+ messages in thread
From: Breno Leitao @ 2018-08-07 18:41 UTC (permalink / raw)
  To: Christophe LEROY, linuxppc-dev; +Cc: mikey

Hi,

On 08/07/2018 02:15 PM, Christophe LEROY wrote:
> Le 07/08/2018 à 15:35, Breno Leitao a écrit :
>> On a kernel TM Bad thing program exception, the Machine State Register
>> (MSR) is not being properly displayed. The exception code dumps a 32-bits
>> value but MSR is a 64 bits register for all platforms that have HTM
>> enabled.
>>
>> This patch dumps the MSR value as a 64-bits value instead of 32 bits. In
>> order to do so, the 'reason' variable could not be used, since it trimmed
>> MSR to 32-bits (int).
> 
> reason is not always regs->msr, see get_reason(), allthough in your case it is.
> 
> I think it would be better to change 'reason' to 'unsigned long' instead of
> replacing it by regs->msr for the printk.

That was my initial approach, but this code seems to run on 32 bits system,
and I do not want to change the whole 'reason' bit width without having a 32
bits to test, at least.

Also, it is a bit weird doing something as:

	printk("....(msr 0x%lx)....", reason);

I personally think that the follow code is much more readable:

	printk(".... (msr 0x%lx)...", regs->msr);

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

* Re: [PATCH v2] powerpc/tm: Print 64-bits MSR
  2018-08-07 18:41       ` Breno Leitao
@ 2018-08-07 18:57         ` LEROY Christophe
  2018-08-08 15:50           ` Breno Leitao
  0 siblings, 1 reply; 9+ messages in thread
From: LEROY Christophe @ 2018-08-07 18:57 UTC (permalink / raw)
  To: Breno Leitao; +Cc: mikey, linuxppc-dev

Breno Leitao <leitao@debian.org> a =C3=A9crit=C2=A0:

> Hi,
>
> On 08/07/2018 02:15 PM, Christophe LEROY wrote:
>> Le 07/08/2018 =C3=A0 15:35, Breno Leitao a =C3=A9crit=C2=A0:
>>> On a kernel TM Bad thing program exception, the Machine State Register
>>> (MSR) is not being properly displayed. The exception code dumps a 32-bi=
ts
>>> value but MSR is a 64 bits register for all platforms that have HTM
>>> enabled.
>>>
>>> This patch dumps the MSR value as a 64-bits value instead of 32 bits. I=
n
>>> order to do so, the 'reason' variable could not be used, since it trimm=
ed
>>> MSR to 32-bits (int).
>>
>> reason is not always regs->msr, see get_reason(), allthough in your=20=
=20
>>=20case it is.
>>
>> I think it would be better to change 'reason' to 'unsigned long' instead=
 of
>> replacing it by regs->msr for the printk.
>
> That was my initial approach, but this code seems to run on 32 bits syste=
m,
> and I do not want to change the whole 'reason' bit width without having a=
 32
> bits to test, at least.

But 'unsigned long' is still 32 bits on ppc32, so it makes no=20=20
difference=20with 'unsigned int'
And I will test it for you if needed

Christophe

>
> Also, it is a bit weird doing something as:
>
> 	printk("....(msr 0x%lx)....", reason);
>
> I personally think that the follow code is much more readable:
>
> 	printk(".... (msr 0x%lx)...", regs->msr);

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

* Re: [PATCH v2] powerpc/tm: Print 64-bits MSR
  2018-08-07 18:57         ` LEROY Christophe
@ 2018-08-08 15:50           ` Breno Leitao
  0 siblings, 0 replies; 9+ messages in thread
From: Breno Leitao @ 2018-08-08 15:50 UTC (permalink / raw)
  To: LEROY Christophe; +Cc: mikey, linuxppc-dev

Hi Leroy,

On 08/07/2018 03:57 PM, LEROY Christophe wrote:
> Breno Leitao <leitao@debian.org> a écrit :

>> On 08/07/2018 02:15 PM, Christophe LEROY wrote:
>>> Le 07/08/2018 à 15:35, Breno Leitao a écrit :

>>> I think it would be better to change 'reason' to 'unsigned long' instead of
>>> replacing it by regs->msr for the printk.
>>
>> That was my initial approach, but this code seems to run on 32 bits system,
>> and I do not want to change the whole 'reason' bit width without having a 32
>> bits to test, at least.
> 
> But 'unsigned long' is still 32 bits on ppc32, so it makes no difference with
> 'unsigned int'
> And I will test it for you if needed

Cool, I really appreciate it, and I would definitely need it once I have a
more intrusive HTM patchset I am working on.

Regarding this one, I think the change is so simple as-is that  I would
prefer to continue with the v2 patch, if you do not mind.

Thank you!

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

* Re: [v2] powerpc/tm: Print 64-bits MSR
  2018-08-07 13:35   ` [PATCH v2] " Breno Leitao
  2018-08-07 15:50     ` Segher Boessenkool
  2018-08-07 17:15     ` Christophe LEROY
@ 2018-10-04  6:14     ` Michael Ellerman
  2 siblings, 0 replies; 9+ messages in thread
From: Michael Ellerman @ 2018-10-04  6:14 UTC (permalink / raw)
  To: Breno Leitao, linuxppc-dev; +Cc: Breno Leitao, mikey

On Tue, 2018-08-07 at 13:35:00 UTC, Breno Leitao wrote:
> On a kernel TM Bad thing program exception, the Machine State Register
> (MSR) is not being properly displayed. The exception code dumps a 32-bits
> value but MSR is a 64 bits register for all platforms that have HTM
> enabled.
> 
> This patch dumps the MSR value as a 64-bits value instead of 32 bits. In
> order to do so, the 'reason' variable could not be used, since it trimmed
> MSR to 32-bits (int).
> 
> Signed-off-by: Breno Leitao <leitao@debian.org>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/51303113e32fd92d327b3c441c45e2

cheers

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

end of thread, other threads:[~2018-10-04  6:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-07  0:32 [PATCH] powerpc/tm: Print 64-bits MSR Breno Leitao
2018-08-07  1:17 ` Michael Neuling
2018-08-07 13:35   ` [PATCH v2] " Breno Leitao
2018-08-07 15:50     ` Segher Boessenkool
2018-08-07 17:15     ` Christophe LEROY
2018-08-07 18:41       ` Breno Leitao
2018-08-07 18:57         ` LEROY Christophe
2018-08-08 15:50           ` Breno Leitao
2018-10-04  6:14     ` [v2] " Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.