All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/powernv/nvram: opal_nvram_write handle unknown OPAL errors
@ 2018-03-26 15:02 Nicholas Piggin
  2018-03-27  7:17 ` Vasant Hegde
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Nicholas Piggin @ 2018-03-26 15:02 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin

opal_nvram_write currently just assumes success if it encounters an
error other than OPAL_BUSY or OPAL_BUSY_EVENT. Have it return -EIO
on other errors instead.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/platforms/powernv/opal-nvram.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/platforms/powernv/opal-nvram.c b/arch/powerpc/platforms/powernv/opal-nvram.c
index 9db4398ded5d..13bf625dc3e8 100644
--- a/arch/powerpc/platforms/powernv/opal-nvram.c
+++ b/arch/powerpc/platforms/powernv/opal-nvram.c
@@ -59,6 +59,8 @@ static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index)
 		if (rc == OPAL_BUSY_EVENT)
 			opal_poll_events(NULL);
 	}
+	if (rc)
+		return -EIO;
 	*index += count;
 	return count;
 }
-- 
2.16.1

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

* Re: [PATCH] powerpc/powernv/nvram: opal_nvram_write handle unknown OPAL errors
  2018-03-26 15:02 [PATCH] powerpc/powernv/nvram: opal_nvram_write handle unknown OPAL errors Nicholas Piggin
@ 2018-03-27  7:17 ` Vasant Hegde
  2018-03-27  7:38   ` Nicholas Piggin
  2018-03-27 12:13 ` Michael Ellerman
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Vasant Hegde @ 2018-03-27  7:17 UTC (permalink / raw)
  To: Nicholas Piggin, linuxppc-dev

On 03/26/2018 08:32 PM, Nicholas Piggin wrote:
> opal_nvram_write currently just assumes success if it encounters an
> error other than OPAL_BUSY or OPAL_BUSY_EVENT. Have it return -EIO
> on other errors instead.
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
>   arch/powerpc/platforms/powernv/opal-nvram.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/arch/powerpc/platforms/powernv/opal-nvram.c b/arch/powerpc/platforms/powernv/opal-nvram.c
> index 9db4398ded5d..13bf625dc3e8 100644
> --- a/arch/powerpc/platforms/powernv/opal-nvram.c
> +++ b/arch/powerpc/platforms/powernv/opal-nvram.c
> @@ -59,6 +59,8 @@ static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index)
>   		if (rc == OPAL_BUSY_EVENT)
>   			opal_poll_events(NULL);

Current code does continuous poller here. May be we have small breathing time 
here. What you say?


>   	}
> +	if (rc)
> +		return -EIO;

Good catch. Thanks!

Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>

-Vasant

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

* Re: [PATCH] powerpc/powernv/nvram: opal_nvram_write handle unknown OPAL errors
  2018-03-27  7:17 ` Vasant Hegde
@ 2018-03-27  7:38   ` Nicholas Piggin
  2018-03-28 17:17     ` Vasant Hegde
  0 siblings, 1 reply; 9+ messages in thread
From: Nicholas Piggin @ 2018-03-27  7:38 UTC (permalink / raw)
  To: Vasant Hegde; +Cc: linuxppc-dev, skiboot

On Tue, 27 Mar 2018 12:47:31 +0530
Vasant Hegde <hegdevasant@linux.vnet.ibm.com> wrote:

> On 03/26/2018 08:32 PM, Nicholas Piggin wrote:
> > opal_nvram_write currently just assumes success if it encounters an
> > error other than OPAL_BUSY or OPAL_BUSY_EVENT. Have it return -EIO
> > on other errors instead.
> > 
> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> > ---
> >   arch/powerpc/platforms/powernv/opal-nvram.c | 2 ++
> >   1 file changed, 2 insertions(+)
> > 
> > diff --git a/arch/powerpc/platforms/powernv/opal-nvram.c b/arch/powerpc/platforms/powernv/opal-nvram.c
> > index 9db4398ded5d..13bf625dc3e8 100644
> > --- a/arch/powerpc/platforms/powernv/opal-nvram.c
> > +++ b/arch/powerpc/platforms/powernv/opal-nvram.c
> > @@ -59,6 +59,8 @@ static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index)
> >   		if (rc == OPAL_BUSY_EVENT)
> >   			opal_poll_events(NULL);  
> 
> Current code does continuous poller here. May be we have small breathing time 
> here. What you say?

Yeah that's probably not a bad idea. I cc'ed skiboot list -- what's a
reasonable delay between retries? Linux has a bunch of similar kind of
loops if you grep for opal_poll_events and OPAL_BUSY. It would be good
to convert them all to a standard form with a standard delay as
recommended by OPAL, and where specific calls have different delay
for a good reason, that would be documented in the OPAL API docs.

Thanks,
Nick

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

* Re: [PATCH] powerpc/powernv/nvram: opal_nvram_write handle unknown OPAL errors
  2018-03-26 15:02 [PATCH] powerpc/powernv/nvram: opal_nvram_write handle unknown OPAL errors Nicholas Piggin
  2018-03-27  7:17 ` Vasant Hegde
@ 2018-03-27 12:13 ` Michael Ellerman
  2018-03-27 12:27   ` Nicholas Piggin
  2018-03-27 12:35   ` T T
  2018-03-29  4:27 ` Stewart Smith
  2018-03-31 14:04 ` Michael Ellerman
  3 siblings, 2 replies; 9+ messages in thread
From: Michael Ellerman @ 2018-03-27 12:13 UTC (permalink / raw)
  To: Nicholas Piggin, linuxppc-dev; +Cc: Nicholas Piggin

Nicholas Piggin <npiggin@gmail.com> writes:

> opal_nvram_write currently just assumes success if it encounters an
> error other than OPAL_BUSY or OPAL_BUSY_EVENT. Have it return -EIO
> on other errors instead.

Does that ever happen with current skiboot?

Even if it doesn't I think I'm inclined to tag this for stable.

cheers

> diff --git a/arch/powerpc/platforms/powernv/opal-nvram.c b/arch/powerpc/platforms/powernv/opal-nvram.c
> index 9db4398ded5d..13bf625dc3e8 100644
> --- a/arch/powerpc/platforms/powernv/opal-nvram.c
> +++ b/arch/powerpc/platforms/powernv/opal-nvram.c
> @@ -59,6 +59,8 @@ static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index)
>  		if (rc == OPAL_BUSY_EVENT)
>  			opal_poll_events(NULL);
>  	}
> +	if (rc)
> +		return -EIO;
>  	*index += count;
>  	return count;
>  }
> -- 
> 2.16.1

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

* Re: [PATCH] powerpc/powernv/nvram: opal_nvram_write handle unknown OPAL errors
  2018-03-27 12:13 ` Michael Ellerman
@ 2018-03-27 12:27   ` Nicholas Piggin
  2018-03-27 12:35   ` T T
  1 sibling, 0 replies; 9+ messages in thread
From: Nicholas Piggin @ 2018-03-27 12:27 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev

On Tue, 27 Mar 2018 23:13:00 +1100
Michael Ellerman <mpe@ellerman.id.au> wrote:

> Nicholas Piggin <npiggin@gmail.com> writes:
> 
> > opal_nvram_write currently just assumes success if it encounters an
> > error other than OPAL_BUSY or OPAL_BUSY_EVENT. Have it return -EIO
> > on other errors instead.  
> 
> Does that ever happen with current skiboot?

I can now even using the mambo fake flash driver that never returns
failure, because skiboot will return OPAL_INTERNAL_ERROR if we try
to re-enter it. So I hit it when testing sreset-in-opal cases (the
crash path wants to write something to nvram).

Not sure about the skiboot flash layer. Aside from programming
errors, it looks like perhaps ECC and BMC failure or unresponsive
could cause errors to come back here.

> Even if it doesn't I think I'm inclined to tag this for stable.

It's turning some relatively minor types of errors into a system
hang, so it seems like it could go in stable. I've hit the -EIO case
in these basic tests and it hasn't had obvious bugs.

Thanks,
Nick

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

* Re: [PATCH] powerpc/powernv/nvram: opal_nvram_write handle unknown OPAL errors
  2018-03-27 12:13 ` Michael Ellerman
  2018-03-27 12:27   ` Nicholas Piggin
@ 2018-03-27 12:35   ` T T
  1 sibling, 0 replies; 9+ messages in thread
From: T T @ 2018-03-27 12:35 UTC (permalink / raw)
  To: Nicholas Piggin, linuxppc-dev, Michael Ellerman

[-- Attachment #1: Type: text/plain, Size: 1101 bytes --]

 unscribed me 

    On ‎Tuesday‎, ‎March‎ ‎27‎, ‎2018‎ ‎05‎:‎34‎:‎30‎ ‎AM‎ ‎PDT, Michael Ellerman <mpe@ellerman.id.au> wrote:  
 
 Nicholas Piggin <npiggin@gmail.com> writes:

> opal_nvram_write currently just assumes success if it encounters an
> error other than OPAL_BUSY or OPAL_BUSY_EVENT. Have it return -EIO
> on other errors instead.

Does that ever happen with current skiboot?

Even if it doesn't I think I'm inclined to tag this for stable.

cheers

> diff --git a/arch/powerpc/platforms/powernv/opal-nvram.c b/arch/powerpc/platforms/powernv/opal-nvram.c
> index 9db4398ded5d..13bf625dc3e8 100644
> --- a/arch/powerpc/platforms/powernv/opal-nvram.c
> +++ b/arch/powerpc/platforms/powernv/opal-nvram.c
> @@ -59,6 +59,8 @@ static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index)
>          if (rc == OPAL_BUSY_EVENT)
>              opal_poll_events(NULL);
>      }
> +    if (rc)
> +        return -EIO;
>      *index += count;
>      return count;
>  }
> -- 
> 2.16.1
  

[-- Attachment #2: Type: text/html, Size: 2646 bytes --]

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

* Re: [PATCH] powerpc/powernv/nvram: opal_nvram_write handle unknown OPAL errors
  2018-03-27  7:38   ` Nicholas Piggin
@ 2018-03-28 17:17     ` Vasant Hegde
  0 siblings, 0 replies; 9+ messages in thread
From: Vasant Hegde @ 2018-03-28 17:17 UTC (permalink / raw)
  To: Nicholas Piggin; +Cc: linuxppc-dev, skiboot

On 03/27/2018 01:08 PM, Nicholas Piggin wrote:
> On Tue, 27 Mar 2018 12:47:31 +0530
> Vasant Hegde <hegdevasant@linux.vnet.ibm.com> wrote:
> 
>> On 03/26/2018 08:32 PM, Nicholas Piggin wrote:
>>> opal_nvram_write currently just assumes success if it encounters an
>>> error other than OPAL_BUSY or OPAL_BUSY_EVENT. Have it return -EIO
>>> on other errors instead.
>>>
>>> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
>>> ---
>>>    arch/powerpc/platforms/powernv/opal-nvram.c | 2 ++
>>>    1 file changed, 2 insertions(+)
>>>
>>> diff --git a/arch/powerpc/platforms/powernv/opal-nvram.c b/arch/powerpc/platforms/powernv/opal-nvram.c
>>> index 9db4398ded5d..13bf625dc3e8 100644
>>> --- a/arch/powerpc/platforms/powernv/opal-nvram.c
>>> +++ b/arch/powerpc/platforms/powernv/opal-nvram.c
>>> @@ -59,6 +59,8 @@ static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index)
>>>    		if (rc == OPAL_BUSY_EVENT)
>>>    			opal_poll_events(NULL);
>>
>> Current code does continuous poller here. May be we have small breathing time
>> here. What you say?
> 
> Yeah that's probably not a bad idea. I cc'ed skiboot list -- what's a
> reasonable delay between retries?

I think it depends on individual API. Like in case of dump retrival I've 20ms 
delay... as FSP takes time to copy data to host memory. But may be here we can 
have smaller delay.

> Linux has a bunch of similar kind of
> loops if you grep for opal_poll_events and OPAL_BUSY. It would be good
> to convert them all to a standard form with a standard delay as
> recommended by OPAL, and where specific calls have different delay
> for a good reason, that would be documented in the OPAL API docs.

Yes. We should update API documentation.

-Vasant

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

* Re: [PATCH] powerpc/powernv/nvram: opal_nvram_write handle unknown OPAL errors
  2018-03-26 15:02 [PATCH] powerpc/powernv/nvram: opal_nvram_write handle unknown OPAL errors Nicholas Piggin
  2018-03-27  7:17 ` Vasant Hegde
  2018-03-27 12:13 ` Michael Ellerman
@ 2018-03-29  4:27 ` Stewart Smith
  2018-03-31 14:04 ` Michael Ellerman
  3 siblings, 0 replies; 9+ messages in thread
From: Stewart Smith @ 2018-03-29  4:27 UTC (permalink / raw)
  To: Nicholas Piggin, linuxppc-dev; +Cc: Nicholas Piggin

Nicholas Piggin <npiggin@gmail.com> writes:
> opal_nvram_write currently just assumes success if it encounters an
> error other than OPAL_BUSY or OPAL_BUSY_EVENT. Have it return -EIO
> on other errors instead.
>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
>  arch/powerpc/platforms/powernv/opal-nvram.c | 2 ++
>  1 file changed, 2 insertions(+)

Acked-by: Stewart Smith <stewart@linux.ibm.com>

-- 
Stewart Smith
OPAL Architect, IBM.

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

* Re: powerpc/powernv/nvram: opal_nvram_write handle unknown OPAL errors
  2018-03-26 15:02 [PATCH] powerpc/powernv/nvram: opal_nvram_write handle unknown OPAL errors Nicholas Piggin
                   ` (2 preceding siblings ...)
  2018-03-29  4:27 ` Stewart Smith
@ 2018-03-31 14:04 ` Michael Ellerman
  3 siblings, 0 replies; 9+ messages in thread
From: Michael Ellerman @ 2018-03-31 14:04 UTC (permalink / raw)
  To: Nicholas Piggin, linuxppc-dev; +Cc: Nicholas Piggin

On Mon, 2018-03-26 at 15:02:33 UTC, Nicholas Piggin wrote:
> opal_nvram_write currently just assumes success if it encounters an
> error other than OPAL_BUSY or OPAL_BUSY_EVENT. Have it return -EIO
> on other errors instead.
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
> Acked-by: Stewart Smith <stewart@linux.ibm.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/741de617661794246f84a21a02fc5e

cheers

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

end of thread, other threads:[~2018-03-31 14:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-26 15:02 [PATCH] powerpc/powernv/nvram: opal_nvram_write handle unknown OPAL errors Nicholas Piggin
2018-03-27  7:17 ` Vasant Hegde
2018-03-27  7:38   ` Nicholas Piggin
2018-03-28 17:17     ` Vasant Hegde
2018-03-27 12:13 ` Michael Ellerman
2018-03-27 12:27   ` Nicholas Piggin
2018-03-27 12:35   ` T T
2018-03-29  4:27 ` Stewart Smith
2018-03-31 14:04 ` 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.