# \[PATCH\] powerpc/pseries/dlpar: handle ibm, configure-connector delay status

- Subsystems: LINUX FOR POWERPC (32-BIT AND 64-BIT), THE REST
- Maintainers: Madhavan Srinivasan, Linus Torvalds
- Status: LANDED (768d70e19ba5 · 2021-02-08 14:09)
- Landed in mainline as 768d70e19ba5 on 2021-02-08.
- List: linuxppc-dev
- 4 messages, 3 authors
- Page: https://ratatoskr.run/linuxppc-dev/2021/01/9520299/t

## \[PATCH\] powerpc/pseries/dlpar: handle ibm, configure-connector delay status

- From: Nathan Lynch \<hidden\>
- Date: 2021-01-07 03:02:24 
- Message: https://ratatoskr.run/linuxppc-dev/2021/01/9520299.md

```text
dlpar_configure_connector() has two problems in its handling of
ibm,configure-connector's return status:

1. When the status is -2 (busy, call again), we call
   ibm,configure-connector again immediately without checking whether
   to schedule, which can result in monopolizing the CPU.
2. Extended delay status (9900..9905) goes completely unhandled,
   causing the configuration to unnecessarily terminate.

Fix both of these issues by using rtas_busy_delay().

Fixes: ab519a011caa ("powerpc/pseries: Kernel DLPAR Infrastructure")
Signed-off-by: Nathan Lynch <redacted>
---
 arch/powerpc/platforms/pseries/dlpar.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index 16e86ba8aa20..f6b7749d6ada 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -127,7 +127,6 @@ void dlpar_free_cc_nodes(struct device_node *dn)
 #define NEXT_PROPERTY   3
 #define PREV_PARENT     4
 #define MORE_MEMORY     5
-#define CALL_AGAIN	-2
 #define ERR_CFG_USE     -9003
 
 struct device_node *dlpar_configure_connector(__be32 drc_index,
@@ -168,6 +167,9 @@ struct device_node *dlpar_configure_connector(__be32 drc_index,
 
 		spin_unlock(&rtas_data_buf_lock);
 
+		if (rtas_busy_delay(rc))
+			continue;
+
 		switch (rc) {
 		case COMPLETE:
 			break;
@@ -216,9 +218,6 @@ struct device_node *dlpar_configure_connector(__be32 drc_index,
 			last_dn = last_dn->parent;
 			break;
 
-		case CALL_AGAIN:
-			break;
-
 		case MORE_MEMORY:
 		case ERR_CFG_USE:
 		default:
-- 
2.29.2

```

## Re: \[PATCH\] powerpc/pseries/dlpar: handle ibm, configure-connector delay status

- From: Nathan Lynch \<hidden\>
- Date: 2021-02-05 13:18:57 
- Message: https://ratatoskr.run/linuxppc-dev/2021/02/9520820.md

```text
Nathan Lynch [ref] writes:
> dlpar_configure_connector() has two problems in its handling of
> ibm,configure-connector's return status:
>
> 1. When the status is -2 (busy, call again), we call
>    ibm,configure-connector again immediately without checking whether
>    to schedule, which can result in monopolizing the CPU.
> 2. Extended delay status (9900..9905) goes completely unhandled,
>    causing the configuration to unnecessarily terminate.
>
> Fix both of these issues by using rtas_busy_delay().
>
> Fixes: ab519a011caa ("powerpc/pseries: Kernel DLPAR Infrastructure")
> Signed-off-by: Nathan Lynch <redacted>

Just following up and adding some people to cc in hopes of getting some
review for this.


> ---
>  arch/powerpc/platforms/pseries/dlpar.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
> index 16e86ba8aa20..f6b7749d6ada 100644
> --- a/arch/powerpc/platforms/pseries/dlpar.c
> +++ b/arch/powerpc/platforms/pseries/dlpar.c
> @@ -127,7 +127,6 @@ void dlpar_free_cc_nodes(struct device_node *dn)
>  #define NEXT_PROPERTY   3
>  #define PREV_PARENT     4
>  #define MORE_MEMORY     5
> -#define CALL_AGAIN	-2
>  #define ERR_CFG_USE     -9003
>  
>  struct device_node *dlpar_configure_connector(__be32 drc_index,
> @@ -168,6 +167,9 @@ struct device_node *dlpar_configure_connector(__be32 drc_index,
>  
>  		spin_unlock(&rtas_data_buf_lock);
>  
> +		if (rtas_busy_delay(rc))
> +			continue;
> +
>  		switch (rc) {
>  		case COMPLETE:
>  			break;
> @@ -216,9 +218,6 @@ struct device_node *dlpar_configure_connector(__be32 drc_index,
>  			last_dn = last_dn->parent;
>  			break;
>  
> -		case CALL_AGAIN:
> -			break;
> -
>  		case MORE_MEMORY:
>  		case ERR_CFG_USE:
>  		default:
> -- 
> 2.29.2
```

## Re: \[PATCH\] powerpc/pseries/dlpar: handle ibm,configure-connector delay status

- From: Tyrel Datwyler \<tyreld@linux.ibm.com\>
- Date: 2021-02-05 19:49:00 
- Message: https://ratatoskr.run/linuxppc-dev/2021/02/9520825.md

```text
On 1/6/21 6:59 PM, Nathan Lynch wrote:
> dlpar_configure_connector() has two problems in its handling of
> ibm,configure-connector's return status:
> 
> 1. When the status is -2 (busy, call again), we call
>    ibm,configure-connector again immediately without checking whether
>    to schedule, which can result in monopolizing the CPU.
> 2. Extended delay status (9900..9905) goes completely unhandled,
>    causing the configuration to unnecessarily terminate.
> 
> Fix both of these issues by using rtas_busy_delay().
> 
> Fixes: ab519a011caa ("powerpc/pseries: Kernel DLPAR Infrastructure")
> Signed-off-by: Nathan Lynch <redacted>

Reviewed-by: Tyrel Datwyler <tyreld@linux.ibm.com>

```

## Re: \[PATCH\] powerpc/pseries/dlpar: handle ibm, configure-connector delay status

- From: Michael Ellerman \<hidden\>
- Date: 2021-02-10 14:09:44 
- Message: https://ratatoskr.run/linuxppc-dev/2021/02/9520895.md

```text
On Wed, 6 Jan 2021 20:59:00 -0600, Nathan Lynch wrote:
> dlpar_configure_connector() has two problems in its handling of
> ibm,configure-connector's return status:
> 
> 1. When the status is -2 (busy, call again), we call
>    ibm,configure-connector again immediately without checking whether
>    to schedule, which can result in monopolizing the CPU.
> 2. Extended delay status (9900..9905) goes completely unhandled,
>    causing the configuration to unnecessarily terminate.
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc/pseries/dlpar: handle ibm, configure-connector delay status
      https://git.kernel.org/powerpc/c/768d70e19ba525debd571b36e6d0ab19956c63d7

cheers
```
