linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] powerpc/powernv: Treat an empty reboot string as default
@ 2020-02-17  2:48 Oliver O'Halloran
  2020-02-17  2:48 ` [PATCH 2/2] powerpc/powernv: Add explicit fast-reboot support Oliver O'Halloran
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Oliver O'Halloran @ 2020-02-17  2:48 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Oliver O'Halloran

Treat an empty reboot cmd string the same as a NULL string. This squashes a
spurious unsupported reboot message that sometimes gets out when using
xmon.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 arch/powerpc/platforms/powernv/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index 11fdae8..a8fe630 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -229,7 +229,7 @@ static void  __noreturn pnv_restart(char *cmd)
 	pnv_prepare_going_down();
 
 	do {
-		if (!cmd)
+		if (!cmd || !strlen(cmd))
 			rc = opal_cec_reboot();
 		else if (strcmp(cmd, "full") == 0)
 			rc = opal_cec_reboot2(OPAL_REBOOT_FULL_IPL, NULL);
-- 
2.9.5


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

* [PATCH 2/2] powerpc/powernv: Add explicit fast-reboot support
  2020-02-17  2:48 [PATCH 1/2] powerpc/powernv: Treat an empty reboot string as default Oliver O'Halloran
@ 2020-02-17  2:48 ` Oliver O'Halloran
  2020-02-24  3:16   ` Andrew Donnellan
  2020-02-24  2:32 ` [PATCH 1/2] powerpc/powernv: Treat an empty reboot string as default Alexey Kardashevskiy
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Oliver O'Halloran @ 2020-02-17  2:48 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Oliver O'Halloran

Add a way to manually invoke a fast-reboot rather than setting the NVRAM
flag. The idea is to allow userspace to invoke a fast-reboot using the
optional string argument to the reboot() system call, or using the xmon
zr command so we don't need to leave around a persistent changes on
a system to use the feature.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
Companion skiboot patch:
http://lists.ozlabs.org/pipermail/skiboot/2020-February/016420.html
---
 arch/powerpc/include/asm/opal-api.h    | 1 +
 arch/powerpc/platforms/powernv/setup.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h
index c1f25a7..1dffa3c 100644
--- a/arch/powerpc/include/asm/opal-api.h
+++ b/arch/powerpc/include/asm/opal-api.h
@@ -1067,6 +1067,7 @@ enum {
 	OPAL_REBOOT_PLATFORM_ERROR	= 1,
 	OPAL_REBOOT_FULL_IPL		= 2,
 	OPAL_REBOOT_MPIPL		= 3,
+	OPAL_REBOOT_FAST		= 4,
 };
 
 /* Argument to OPAL_PCI_TCE_KILL */
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index a8fe630..3bc188d 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -237,6 +237,8 @@ static void  __noreturn pnv_restart(char *cmd)
 			rc = opal_cec_reboot2(OPAL_REBOOT_MPIPL, NULL);
 		else if (strcmp(cmd, "error") == 0)
 			rc = opal_cec_reboot2(OPAL_REBOOT_PLATFORM_ERROR, NULL);
+		else if (strcmp(cmd, "fast") == 0)
+			rc = opal_cec_reboot2(OPAL_REBOOT_FAST, NULL);
 		else
 			rc = OPAL_UNSUPPORTED;
 
-- 
2.9.5


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

* Re: [PATCH 1/2] powerpc/powernv: Treat an empty reboot string as default
  2020-02-17  2:48 [PATCH 1/2] powerpc/powernv: Treat an empty reboot string as default Oliver O'Halloran
  2020-02-17  2:48 ` [PATCH 2/2] powerpc/powernv: Add explicit fast-reboot support Oliver O'Halloran
@ 2020-02-24  2:32 ` Alexey Kardashevskiy
  2020-02-24 10:04   ` Segher Boessenkool
  2020-02-24  3:13 ` Andrew Donnellan
  2020-03-06  0:27 ` Michael Ellerman
  3 siblings, 1 reply; 8+ messages in thread
From: Alexey Kardashevskiy @ 2020-02-24  2:32 UTC (permalink / raw)
  To: Oliver O'Halloran, linuxppc-dev



On 17/02/2020 13:48, Oliver O'Halloran wrote:
> Treat an empty reboot cmd string the same as a NULL string. This squashes a
> spurious unsupported reboot message that sometimes gets out when using
> xmon.
> 
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
> ---
>  arch/powerpc/platforms/powernv/setup.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
> index 11fdae8..a8fe630 100644
> --- a/arch/powerpc/platforms/powernv/setup.c
> +++ b/arch/powerpc/platforms/powernv/setup.c
> @@ -229,7 +229,7 @@ static void  __noreturn pnv_restart(char *cmd)
>  	pnv_prepare_going_down();
>  
>  	do {
> -		if (!cmd)
> +		if (!cmd || !strlen(cmd))


nit: this does not matter here in practice but

if (!cmd || cmd[0] == '\0')

is faster (you do not care about the length anyway) and safer (@cmd can
potentially be endless) ;)


>  			rc = opal_cec_reboot();
>  		else if (strcmp(cmd, "full") == 0)
>  			rc = opal_cec_reboot2(OPAL_REBOOT_FULL_IPL, NULL);
> 

-- 
Alexey

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

* Re: [PATCH 1/2] powerpc/powernv: Treat an empty reboot string as default
  2020-02-17  2:48 [PATCH 1/2] powerpc/powernv: Treat an empty reboot string as default Oliver O'Halloran
  2020-02-17  2:48 ` [PATCH 2/2] powerpc/powernv: Add explicit fast-reboot support Oliver O'Halloran
  2020-02-24  2:32 ` [PATCH 1/2] powerpc/powernv: Treat an empty reboot string as default Alexey Kardashevskiy
@ 2020-02-24  3:13 ` Andrew Donnellan
  2020-03-06  0:27 ` Michael Ellerman
  3 siblings, 0 replies; 8+ messages in thread
From: Andrew Donnellan @ 2020-02-24  3:13 UTC (permalink / raw)
  To: Oliver O'Halloran, linuxppc-dev

On 17/2/20 1:48 pm, Oliver O'Halloran wrote:
> Treat an empty reboot cmd string the same as a NULL string. This squashes a
> spurious unsupported reboot message that sometimes gets out when using
> xmon.
> 
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>

Pretty sure I've seen that spurious reboot message a few times and never 
thought to check why... this makes sense.

Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com>


-- 
Andrew Donnellan              OzLabs, ADL Canberra
ajd@linux.ibm.com             IBM Australia Limited


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

* Re: [PATCH 2/2] powerpc/powernv: Add explicit fast-reboot support
  2020-02-17  2:48 ` [PATCH 2/2] powerpc/powernv: Add explicit fast-reboot support Oliver O'Halloran
@ 2020-02-24  3:16   ` Andrew Donnellan
  0 siblings, 0 replies; 8+ messages in thread
From: Andrew Donnellan @ 2020-02-24  3:16 UTC (permalink / raw)
  To: Oliver O'Halloran, linuxppc-dev

On 17/2/20 1:48 pm, Oliver O'Halloran wrote:
> Add a way to manually invoke a fast-reboot rather than setting the NVRAM
> flag. The idea is to allow userspace to invoke a fast-reboot using the
> optional string argument to the reboot() system call, or using the xmon
> zr command so we don't need to leave around a persistent changes on
> a system to use the feature.
> 
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>

Both this and the previous patch have passed snowpatch with no warnings, 
and don't seem to have any obvious issues.

Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com>


-- 
Andrew Donnellan              OzLabs, ADL Canberra
ajd@linux.ibm.com             IBM Australia Limited


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

* Re: [PATCH 1/2] powerpc/powernv: Treat an empty reboot string as default
  2020-02-24  2:32 ` [PATCH 1/2] powerpc/powernv: Treat an empty reboot string as default Alexey Kardashevskiy
@ 2020-02-24 10:04   ` Segher Boessenkool
  2020-02-25  1:38     ` Alexey Kardashevskiy
  0 siblings, 1 reply; 8+ messages in thread
From: Segher Boessenkool @ 2020-02-24 10:04 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: linuxppc-dev, Oliver O'Halloran

On Mon, Feb 24, 2020 at 01:32:28PM +1100, Alexey Kardashevskiy wrote:
> On 17/02/2020 13:48, Oliver O'Halloran wrote:
> > Treat an empty reboot cmd string the same as a NULL string. This squashes a
> > spurious unsupported reboot message that sometimes gets out when using
> > xmon.

> > -		if (!cmd)
> > +		if (!cmd || !strlen(cmd))
> 
> nit: this does not matter here in practice but
> 
> if (!cmd || cmd[0] == '\0')
> 
> is faster (you do not care about the length anyway) and safer (@cmd can
> potentially be endless) ;)

No it isn't, this compiles to identical machine code.  (I tested with
GCC 9, and going back until 4.6 -- the generated code becomes
progressively worse (unrelated to this code, fwiw), but identical for
both cases all the time).


Segher

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

* Re: [PATCH 1/2] powerpc/powernv: Treat an empty reboot string as default
  2020-02-24 10:04   ` Segher Boessenkool
@ 2020-02-25  1:38     ` Alexey Kardashevskiy
  0 siblings, 0 replies; 8+ messages in thread
From: Alexey Kardashevskiy @ 2020-02-25  1:38 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev, Oliver O'Halloran



On 24/02/2020 21:04, Segher Boessenkool wrote:
> On Mon, Feb 24, 2020 at 01:32:28PM +1100, Alexey Kardashevskiy wrote:
>> On 17/02/2020 13:48, Oliver O'Halloran wrote:
>>> Treat an empty reboot cmd string the same as a NULL string. This squashes a
>>> spurious unsupported reboot message that sometimes gets out when using
>>> xmon.
> 
>>> -		if (!cmd)
>>> +		if (!cmd || !strlen(cmd))
>>
>> nit: this does not matter here in practice but
>>
>> if (!cmd || cmd[0] == '\0')
>>
>> is faster (you do not care about the length anyway) and safer (@cmd can
>> potentially be endless) ;)
> 
> No it isn't, this compiles to identical machine code.  (I tested with
> GCC 9, and going back until 4.6 -- the generated code becomes
> progressively worse (unrelated to this code, fwiw), but identical for
> both cases all the time).

oh cool, I did not think gcc is that smart.



-- 
Alexey

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

* Re: [PATCH 1/2] powerpc/powernv: Treat an empty reboot string as default
  2020-02-17  2:48 [PATCH 1/2] powerpc/powernv: Treat an empty reboot string as default Oliver O'Halloran
                   ` (2 preceding siblings ...)
  2020-02-24  3:13 ` Andrew Donnellan
@ 2020-03-06  0:27 ` Michael Ellerman
  3 siblings, 0 replies; 8+ messages in thread
From: Michael Ellerman @ 2020-03-06  0:27 UTC (permalink / raw)
  To: Oliver O'Halloran, linuxppc-dev; +Cc: Oliver O'Halloran

On Mon, 2020-02-17 at 02:48:32 UTC, Oliver O'Halloran wrote:
> Treat an empty reboot cmd string the same as a NULL string. This squashes a
> spurious unsupported reboot message that sometimes gets out when using
> xmon.
> 
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/16985f2d25095899685952296f128a71f0aff05c

cheers

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

end of thread, other threads:[~2020-03-06  0:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-17  2:48 [PATCH 1/2] powerpc/powernv: Treat an empty reboot string as default Oliver O'Halloran
2020-02-17  2:48 ` [PATCH 2/2] powerpc/powernv: Add explicit fast-reboot support Oliver O'Halloran
2020-02-24  3:16   ` Andrew Donnellan
2020-02-24  2:32 ` [PATCH 1/2] powerpc/powernv: Treat an empty reboot string as default Alexey Kardashevskiy
2020-02-24 10:04   ` Segher Boessenkool
2020-02-25  1:38     ` Alexey Kardashevskiy
2020-02-24  3:13 ` Andrew Donnellan
2020-03-06  0:27 ` 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).