Re: [PATCH v4 2/5] powerpc/numa: Handle extra hcall_vphn error cases

2019-10-02 Thread Nathan Lynch
Srikar Dronamraju  writes:
> Currently code handles H_FUNCTION, H_SUCCESS, H_HARDWARE return codes.
> However hcall_vphn can return other return codes. Now it also handles
> H_PARAMETER return code.  Also the rest return codes are handled under the
> default case.

Reviewed-by: Nathan Lynch 

However:

> + case H_PARAMETER:
> + pr_err_ratelimited("hcall_vphn() was passed an invalid 
> parameter. "
> + "Disabling polling...\n");

Consider including the bad parameter value in the message?


[PATCH v4 2/5] powerpc/numa: Handle extra hcall_vphn error cases

2019-09-13 Thread Srikar Dronamraju
Currently code handles H_FUNCTION, H_SUCCESS, H_HARDWARE return codes.
However hcall_vphn can return other return codes. Now it also handles
H_PARAMETER return code.  Also the rest return codes are handled under the
default case.

Signed-off-by: Srikar Dronamraju 
Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Nathan Lynch 
Cc: linuxppc-dev@lists.ozlabs.org
Cc: Satheesh Rajendran 
Reported-by: Abdul Haleem 
---
Changelog (v2->v1):
 Handled comments from Nathan:
  - Split patch from patch 1.
  - Corrected a problem where I missed calling stop_topology_update().
  - Using pr_err_ratelimited instead of printk.

 arch/powerpc/mm/numa.c | 25 -
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 50d68d2..8fbe57c 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1191,23 +1191,30 @@ static long vphn_get_associativity(unsigned long cpu,
VPHN_FLAG_VCPU, associativity);
 
switch (rc) {
+   case H_SUCCESS:
+   dbg("VPHN hcall succeeded. Reset polling...\n");
+   timed_topology_update(0);
+   goto out;
+
case H_FUNCTION:
-   printk_once(KERN_INFO
-   "VPHN is not supported. Disabling polling...\n");
-   stop_topology_update();
+   pr_err_ratelimited("VPHN unsupported. Disabling polling...\n");
break;
case H_HARDWARE:
-   printk(KERN_ERR
-   "hcall_vphn() experienced a hardware fault "
+   pr_err_ratelimited("hcall_vphn() experienced a hardware fault "
"preventing VPHN. Disabling polling...\n");
-   stop_topology_update();
break;
-   case H_SUCCESS:
-   dbg("VPHN hcall succeeded. Reset polling...\n");
-   timed_topology_update(0);
+   case H_PARAMETER:
+   pr_err_ratelimited("hcall_vphn() was passed an invalid 
parameter. "
+   "Disabling polling...\n");
+   break;
+   default:
+   pr_err_ratelimited("hcall_vphn() returned %ld. Disabling 
polling...\n"
+   , rc);
break;
}
 
+   stop_topology_update();
+out:
return rc;
 }
 
-- 
1.8.3.1