* [PATCH] powerpc/xmon: check before calling xive functions
@ 2017-10-17 18:20 Breno Leitao
2017-10-18 13:02 ` Michael Ellerman
2017-10-24 8:09 ` Michael Ellerman
0 siblings, 2 replies; 6+ messages in thread
From: Breno Leitao @ 2017-10-17 18:20 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Breno Leitao
Currently xmon could call XIVE functions from OPAL even if the XIVE is
disabled or does not exist in the system, as in POWER8 machines. This
causes the following exception:
1:mon> dx
cpu 0x1: Vector: 700 (Program Check) at [c000000423c93450]
pc: c00000000009cfa4: opal_xive_dump+0x50/0x68
lr: c0000000000997b8: opal_return+0x0/0x50
This patch simply checks if XIVE is enabled before calling XIVE
functions.
Suggested-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Signed-off-by: Breno Leitao <leitao@debian.org>
---
arch/powerpc/xmon/xmon.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 4679aeb84767..b34976c4a6ba 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -2508,6 +2508,12 @@ static void dump_xives(void)
unsigned long num;
int c;
+ if (!xive_enabled()) {
+ printf("Xive disabled on this system\n");
+
+ return;
+ }
+
c = inchar();
if (c == 'a') {
dump_all_xives();
--
2.14.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc/xmon: check before calling xive functions
2017-10-17 18:20 [PATCH] powerpc/xmon: check before calling xive functions Breno Leitao
@ 2017-10-18 13:02 ` Michael Ellerman
2017-10-19 7:10 ` Benjamin Herrenschmidt
2017-10-24 8:09 ` Michael Ellerman
1 sibling, 1 reply; 6+ messages in thread
From: Michael Ellerman @ 2017-10-18 13:02 UTC (permalink / raw)
To: Breno Leitao, linuxppc-dev; +Cc: Breno Leitao, Stewart Smith
Breno Leitao <leitao@debian.org> writes:
> Currently xmon could call XIVE functions from OPAL even if the XIVE is
> disabled or does not exist in the system, as in POWER8 machines. This
> causes the following exception:
>
> 1:mon> dx
> cpu 0x1: Vector: 700 (Program Check) at [c000000423c93450]
> pc: c00000000009cfa4: opal_xive_dump+0x50/0x68
> lr: c0000000000997b8: opal_return+0x0/0x50
>
> This patch simply checks if XIVE is enabled before calling XIVE
> functions.
Thanks. I'll merge this.
But we should also fix it in skiboot.
cheers
> Suggested-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
> arch/powerpc/xmon/xmon.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
> index 4679aeb84767..b34976c4a6ba 100644
> --- a/arch/powerpc/xmon/xmon.c
> +++ b/arch/powerpc/xmon/xmon.c
> @@ -2508,6 +2508,12 @@ static void dump_xives(void)
> unsigned long num;
> int c;
>
> + if (!xive_enabled()) {
> + printf("Xive disabled on this system\n");
> +
> + return;
> + }
> +
> c = inchar();
> if (c == 'a') {
> dump_all_xives();
> --
> 2.14.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc/xmon: check before calling xive functions
2017-10-18 13:02 ` Michael Ellerman
@ 2017-10-19 7:10 ` Benjamin Herrenschmidt
2017-10-19 13:09 ` Cédric Le Goater
[not found] ` <OF2FDAF97B.BDA3E74C-ON002581BE.004846E4@notes.na.collabserv.com>
0 siblings, 2 replies; 6+ messages in thread
From: Benjamin Herrenschmidt @ 2017-10-19 7:10 UTC (permalink / raw)
To: Michael Ellerman, Breno Leitao, linuxppc-dev; +Cc: Stewart Smith
On Thu, 2017-10-19 at 00:02 +1100, Michael Ellerman wrote:
> Breno Leitao <leitao@debian.org> writes:
>
> > Currently xmon could call XIVE functions from OPAL even if the XIVE is
> > disabled or does not exist in the system, as in POWER8 machines. This
> > causes the following exception:
> >
> > 1:mon> dx
> > cpu 0x1: Vector: 700 (Program Check) at [c000000423c93450]
> > pc: c00000000009cfa4: opal_xive_dump+0x50/0x68
> > lr: c0000000000997b8: opal_return+0x0/0x50
> >
> > This patch simply checks if XIVE is enabled before calling XIVE
> > functions.
>
> Thanks. I'll merge this.
>
> But we should also fix it in skiboot.
No that's wrong. xive_enabled() is only set if Linux is using native
xive mode but some of those xmon functions dump the emulated state.
We should fix the actual cause of the crash.
Cheers,
Ben.
> cheers
>
> > Suggested-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
> > Signed-off-by: Breno Leitao <leitao@debian.org>
> > ---
> > arch/powerpc/xmon/xmon.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
> > index 4679aeb84767..b34976c4a6ba 100644
> > --- a/arch/powerpc/xmon/xmon.c
> > +++ b/arch/powerpc/xmon/xmon.c
> > @@ -2508,6 +2508,12 @@ static void dump_xives(void)
> > unsigned long num;
> > int c;
> >
> > + if (!xive_enabled()) {
> > + printf("Xive disabled on this system\n");
> > +
> > + return;
> > + }
> > +
> > c = inchar();
> > if (c == 'a') {
> > dump_all_xives();
> > --
> > 2.14.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc/xmon: check before calling xive functions
2017-10-19 7:10 ` Benjamin Herrenschmidt
@ 2017-10-19 13:09 ` Cédric Le Goater
[not found] ` <OF2FDAF97B.BDA3E74C-ON002581BE.004846E4@notes.na.collabserv.com>
1 sibling, 0 replies; 6+ messages in thread
From: Cédric Le Goater @ 2017-10-19 13:09 UTC (permalink / raw)
To: benh, Michael Ellerman, Breno Leitao, linuxppc-dev; +Cc: Stewart Smith
On 10/19/2017 09:10 AM, Benjamin Herrenschmidt wrote:
> On Thu, 2017-10-19 at 00:02 +1100, Michael Ellerman wrote:
>> Breno Leitao <leitao@debian.org> writes:
>>
>>> Currently xmon could call XIVE functions from OPAL even if the XIVE is
>>> disabled or does not exist in the system, as in POWER8 machines. This
>>> causes the following exception:
>>>
>>> 1:mon> dx
>>> cpu 0x1: Vector: 700 (Program Check) at [c000000423c93450]
>>> pc: c00000000009cfa4: opal_xive_dump+0x50/0x68
>>> lr: c0000000000997b8: opal_return+0x0/0x50
>>>
>>> This patch simply checks if XIVE is enabled before calling XIVE
>>> functions.
>>
>> Thanks. I'll merge this.
>>
>> But we should also fix it in skiboot.
>
> No that's wrong. xive_enabled() is only set if Linux is using native
> xive mode but some of those xmon functions dump the emulated state.
>
> We should fix the actual cause of the crash.
which should be in the OPAL XIVE dump routines then ?
Cheers
C.
>
> Cheers,
> Ben.
>
>> cheers
>>
>>> Suggested-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
>>> Signed-off-by: Breno Leitao <leitao@debian.org>
>>> ---
>>> arch/powerpc/xmon/xmon.c | 6 ++++++
>>> 1 file changed, 6 insertions(+)
>>>
>>> diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
>>> index 4679aeb84767..b34976c4a6ba 100644
>>> --- a/arch/powerpc/xmon/xmon.c
>>> +++ b/arch/powerpc/xmon/xmon.c
>>> @@ -2508,6 +2508,12 @@ static void dump_xives(void)
>>> unsigned long num;
>>> int c;
>>>
>>> + if (!xive_enabled()) {
>>> + printf("Xive disabled on this system\n");
>>> +
>>> + return;
>>> + }
>>> +
>>> c = inchar();
>>> if (c == 'a') {
>>> dump_all_xives();
>>> --
>>> 2.14.2
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc/xmon: check before calling xive functions
[not found] ` <OF2FDAF97B.BDA3E74C-ON002581BE.004846E4@notes.na.collabserv.com>
@ 2017-10-19 15:21 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 6+ messages in thread
From: Benjamin Herrenschmidt @ 2017-10-19 15:21 UTC (permalink / raw)
To: Cédric Le Goater, Michael Ellerman, Breno Leitao,
linuxppc-dev
Cc: Stewart Smith
On Thu, 2017-10-19 at 15:09 +0200, Cédric Le Goater wrote:
> > No that's wrong. xive_enabled() is only set if Linux is using native
> > xive mode but some of those xmon functions dump the emulated state.
> >
> > We should fix the actual cause of the crash.
>
> which should be in the OPAL XIVE dump routines then ?
Yup, probably needs a NULL check or something...
Cheers,
Ben.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: powerpc/xmon: check before calling xive functions
2017-10-17 18:20 [PATCH] powerpc/xmon: check before calling xive functions Breno Leitao
2017-10-18 13:02 ` Michael Ellerman
@ 2017-10-24 8:09 ` Michael Ellerman
1 sibling, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2017-10-24 8:09 UTC (permalink / raw)
To: Breno Leitao, linuxppc-dev; +Cc: Breno Leitao
On Tue, 2017-10-17 at 18:20:18 UTC, Breno Leitao wrote:
> Currently xmon could call XIVE functions from OPAL even if the XIVE is
> disabled or does not exist in the system, as in POWER8 machines. This
> causes the following exception:
>
> 1:mon> dx
> cpu 0x1: Vector: 700 (Program Check) at [c000000423c93450]
> pc: c00000000009cfa4: opal_xive_dump+0x50/0x68
> lr: c0000000000997b8: opal_return+0x0/0x50
>
> This patch simply checks if XIVE is enabled before calling XIVE
> functions.
>
> Suggested-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
> Signed-off-by: Breno Leitao <leitao@debian.org>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/402e172a2ce76210f2fe921cf419d1
cheers
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-10-24 8:09 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-17 18:20 [PATCH] powerpc/xmon: check before calling xive functions Breno Leitao
2017-10-18 13:02 ` Michael Ellerman
2017-10-19 7:10 ` Benjamin Herrenschmidt
2017-10-19 13:09 ` Cédric Le Goater
[not found] ` <OF2FDAF97B.BDA3E74C-ON002581BE.004846E4@notes.na.collabserv.com>
2017-10-19 15:21 ` Benjamin Herrenschmidt
2017-10-24 8:09 ` Michael Ellerman
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).