[v2] examples/l3fw-power: do not exit on power lib init failure

Message ID 1532685206-25950-1-git-send-email-radu.nicolau@intel.com (mailing list archive)
State Superseded, archived
Headers
Series [v2] examples/l3fw-power: do not exit on power lib init failure |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Radu Nicolau July 27, 2018, 9:53 a.m. UTC
  Do not exit the application if power library fails to initialize
or high performance cores configuration cannot be used.

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
v2: updated init_power_library to return error code if any core init fails


 examples/l3fwd-power/main.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
  

Comments

Thomas Monjalon Aug. 5, 2018, 8:26 p.m. UTC | #1
No review?

27/07/2018 11:53, Radu Nicolau:
> Do not exit the application if power library fails to initialize
> or high performance cores configuration cannot be used.
> 
> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
> ---
> v2: updated init_power_library to return error code if any core init fails
> 
> 
>  examples/l3fwd-power/main.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
> index d15cd52..e73b853 100644
> --- a/examples/l3fwd-power/main.c
> +++ b/examples/l3fwd-power/main.c
> @@ -1638,11 +1638,13 @@ init_power_library(void)
>  	for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
>  		if (rte_lcore_is_enabled(lcore_id)) {
>  			/* init power management library */
> -			ret = rte_power_init(lcore_id);
> -			if (ret)
> +			int cpi_ret = rte_power_init(lcore_id);
> +			if (cpi_ret) {
>  				RTE_LOG(ERR, POWER,
>  				"Library initialization failed on core %u\n",
>  				lcore_id);
> +				ret = -1;
> +			}
>  		}
>  	}
>  	return ret;
> @@ -1683,10 +1685,10 @@ main(int argc, char **argv)
>  		rte_exit(EXIT_FAILURE, "Invalid L3FWD parameters\n");
>  
>  	if (init_power_library())
> -		rte_exit(EXIT_FAILURE, "init_power_library failed\n");
> +		RTE_LOG(ERR, POWER, "init_power_library failed\n");
>  
>  	if (update_lcore_params() < 0)
> -		rte_exit(EXIT_FAILURE, "update_lcore_params failed\n");
> +		RTE_LOG(ERR, POWER, "update_lcore_params failed\n");
>  
>  	if (check_lcore_params() < 0)
>  		rte_exit(EXIT_FAILURE, "check_lcore_params failed\n");
>
  
Hunt, David Aug. 7, 2018, 1:16 p.m. UTC | #2
On 27/7/2018 10:53 AM, Radu Nicolau wrote:
> Do not exit the application if power library fails to initialize
> or high performance cores configuration cannot be used.
>
> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
> ---
> v2: updated init_power_library to return error code if any core init fails
>
>
>   examples/l3fwd-power/main.c | 10 ++++++----
>   1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
> index d15cd52..e73b853 100644
> --- a/examples/l3fwd-power/main.c
> +++ b/examples/l3fwd-power/main.c
> @@ -1638,11 +1638,13 @@ init_power_library(void)
>   	for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
>   		if (rte_lcore_is_enabled(lcore_id)) {
>   			/* init power management library */
> -			ret = rte_power_init(lcore_id);
> -			if (ret)
> +			int cpi_ret = rte_power_init(lcore_id);
> +			if (cpi_ret) {
>   				RTE_LOG(ERR, POWER,
>   				"Library initialization failed on core %u\n",
>   				lcore_id);
> +				ret = -1;
> +			}
>   		}
>   	}
>   	return ret;
> @@ -1683,10 +1685,10 @@ main(int argc, char **argv)
>   		rte_exit(EXIT_FAILURE, "Invalid L3FWD parameters\n");
>   
>   	if (init_power_library())
> -		rte_exit(EXIT_FAILURE, "init_power_library failed\n");
> +		RTE_LOG(ERR, POWER, "init_power_library failed\n");
>   
>   	if (update_lcore_params() < 0)
> -		rte_exit(EXIT_FAILURE, "update_lcore_params failed\n");
> +		RTE_LOG(ERR, POWER, "update_lcore_params failed\n");
>   
>   	if (check_lcore_params() < 0)
>   		rte_exit(EXIT_FAILURE, "check_lcore_params failed\n");

Hi Radu,

I think this patch needs to be seen as a Fix instead of a patch.
The patch that introduced the API to query the power capabilities of a 
core moved around some
functionality that now causes the application to exit earlier than 
previously was the case, making
problems for the test framework.
I think if you added some explanation around this, and the following 
line, it would be fine:

Fixes: f88e7c175a68 ("examples/l3fwd-power: add high/regular perf cores 
options")

Regards,
Dave.
  

Patch

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index d15cd52..e73b853 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -1638,11 +1638,13 @@  init_power_library(void)
 	for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
 		if (rte_lcore_is_enabled(lcore_id)) {
 			/* init power management library */
-			ret = rte_power_init(lcore_id);
-			if (ret)
+			int cpi_ret = rte_power_init(lcore_id);
+			if (cpi_ret) {
 				RTE_LOG(ERR, POWER,
 				"Library initialization failed on core %u\n",
 				lcore_id);
+				ret = -1;
+			}
 		}
 	}
 	return ret;
@@ -1683,10 +1685,10 @@  main(int argc, char **argv)
 		rte_exit(EXIT_FAILURE, "Invalid L3FWD parameters\n");
 
 	if (init_power_library())
-		rte_exit(EXIT_FAILURE, "init_power_library failed\n");
+		RTE_LOG(ERR, POWER, "init_power_library failed\n");
 
 	if (update_lcore_params() < 0)
-		rte_exit(EXIT_FAILURE, "update_lcore_params failed\n");
+		RTE_LOG(ERR, POWER, "update_lcore_params failed\n");
 
 	if (check_lcore_params() < 0)
 		rte_exit(EXIT_FAILURE, "check_lcore_params failed\n");