powerpc/powernv/nvram: opal_nvram_write handle unknown OPAL errors
Nicholas Piggin
reviewerPATCH 1/1 powerpc/powernv/nvram: opal_nvram_write handle unknown OPAL errors
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.
--- arch/powerpc/platforms/powernv/opal-nvram.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/platforms/powernv/opal-nvram.c +2 -0
@@ -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; }
Signature · 1 line
2.16.1
Quoted 14 lines · Nicholas Piggin
opal_nvram_writecurrently just assumes success if it encounters an error other thanOPAL_BUSYorOPAL_BUSY_EVENT. Have it return-EIOon other errors instead.Signed-off-by Nicholas Piggin <[email protected]>--- arch/powerpc/platforms/powernv/opal-nvram.c | 2 ++ 1 file changed, 2 insertions(+)arch/powerpc/platforms/powernv/opal-nvram.c +0
-0
arch/powerpc/platforms/powernv/opal-nvram.c static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index) · line 60
Quoted 2 lines
arch/powerpc/platforms/powernv/opal-nvram.c +0
-0@@ -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?
arch/powerpc/platforms/powernv/opal-nvram.c static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index) · line 63
Quoted 3 lines
arch/powerpc/platforms/powernv/opal-nvram.c +2
-0} +if (rc) +return -EIO ;
Good catch. Thanks!
-Vasant
Nicholas Piggin
reviewerQuoted 10 lines · On Tue, 27 Mar 2018 12:47:31 +0530 Vasant Hegde…
Quoted 9 lines · Nicholas Piggin
opal_nvram_writecurrently just assumes success if it encounters an error other thanOPAL_BUSYorOPAL_BUSY_EVENT. Have it return-EIOon other errors instead.Signed-off-by Nicholas Piggin <[email protected]>--- arch/powerpc/platforms/powernv/opal-nvram.c | 2 ++ 1 file changed, 2 insertions(+)
Quoted 10 lines
arch/powerpc/platforms/powernv/opal-nvram.c static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index) · line 60
Quoted 7 lines
arch/powerpc/platforms/powernv/opal-nvram.c +0
-0@@ -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
Michael Ellerman
reviewerQuoted 3 lines · Nicholas Piggin
opal_nvram_writecurrently just assumes success if it encounters an error other thanOPAL_BUSYorOPAL_BUSY_EVENT. Have it return-EIOon 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
Quoted 15 lines
arch/powerpc/platforms/powernv/opal-nvram.c +2
-0@@ -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; }Signature · 1 line
2.16.1
Nicholas Piggin
reviewerQuoted 7 lines · On Tue, 27 Mar 2018 23:13:00 +1100 Michael Ellerman <[email protected]> wrote:
Quoted 3 lines · Nicholas Piggin
opal_nvram_writecurrently just assumes success if it encounters an error other thanOPAL_BUSYorOPAL_BUSY_EVENT. Have it return-EIOon 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.
Quoted 1 line
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
unscribed me
On Tuesday, March 27, 2018 05:34:30 AM PDT, Michael Ellerman <[email protected]> wrote:
Quoted 3 lines · Nicholas Piggin
opal_nvram_writecurrently just assumes success if it encounters an error other thanOPAL_BUSYorOPAL_BUSY_EVENT. Have it return-EIOon 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
Quoted 15 lines
arch/powerpc/platforms/powernv/opal-nvram.c +2
-0@@ -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; }Signature · 1 line
2.16.1
Quoted 24 lines · Nicholas Piggin
Quoted 10 lines · On Tue, 27 Mar 2018 12:47:31 +0530 Vasant Hegde…
Quoted 9 lines · Nicholas Piggin
opal_nvram_writecurrently just assumes success if it encounters an error other thanOPAL_BUSYorOPAL_BUSY_EVENT. Have it return-EIOon other errors instead.Signed-off-by Nicholas Piggin <[email protected]>--- arch/powerpc/platforms/powernv/opal-nvram.c | 2 ++ 1 file changed, 2 insertions(+)Quoted 10 lines
arch/powerpc/platforms/powernv/opal-nvram.c static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index) · line 60
Quoted 7 lines
arch/powerpc/platforms/powernv/opal-nvram.c +0
-0@@ -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?
Quoted 2 lines
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.
Quoted 5 lines
Linux has a bunch of similar kind of
loops if you grep foropal_poll_eventsandOPAL_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
Quoted 8 lines · Nicholas Piggin
opal_nvram_writecurrently just assumes success if it encounters an error other thanOPAL_BUSYorOPAL_BUSY_EVENT. Have it return-EIOon other errors instead.Signed-off-by Nicholas Piggin <[email protected]>--- arch/powerpc/platforms/powernv/opal-nvram.c | 2 ++ 1 file changed, 2 insertions(+)
Signature · 2 lines
Stewart Smith OPAL Architect, IBM.
Michael Ellerman
AppliedQuoted 7 lines · Nicholas Piggin
opal_nvram_writecurrently just assumes success if it encounters an error other thanOPAL_BUSYorOPAL_BUSY_EVENT. Have it return-EIOon other errors instead.Signed-off-by Nicholas Piggin <[email protected]>Reviewed-by Vasant Hegde <[email protected]>Acked-by Stewart Smith <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/741de617661794246f84a21a02fc5e
cheers