Re: [PATCH 1/2] powerpc/powernv: Treat an empty reboot string as default

2020-03-05 Thread Michael Ellerman
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 

Series applied to powerpc next, thanks.

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

cheers


Re: [PATCH 1/2] powerpc/powernv: Treat an empty reboot string as default

2020-02-24 Thread Alexey Kardashevskiy



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


Re: [PATCH 1/2] powerpc/powernv: Treat an empty reboot string as default

2020-02-24 Thread Segher Boessenkool
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


Re: [PATCH 1/2] powerpc/powernv: Treat an empty reboot string as default

2020-02-23 Thread Andrew Donnellan

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 


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 


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



Re: [PATCH 1/2] powerpc/powernv: Treat an empty reboot string as default

2020-02-23 Thread Alexey Kardashevskiy



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 
> ---
>  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


[PATCH 1/2] powerpc/powernv: Treat an empty reboot string as default

2020-02-16 Thread 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 
---
 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