[v2,7/7] l3fwd-power: add auto-selection of default mode

Message ID 16cd5ba00d6675037804f671309b245643e173db.1592500565.git.anatoly.burakov@intel.com (mailing list archive)
State Superseded, archived
Headers
Series Add interrupt-only mode to l3fwd-power |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK

Commit Message

Burakov, Anatoly June 18, 2020, 5:18 p.m. UTC
  Currently, the application does support running without the power
library being initialized, but it has to be specifically requested. On
platforms without support for frequency scaling using the power library,
we can just enable interrupt-only mode by default.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Suggested-by: Jerin Jacob <jerinjacobk@gmail.com>
---
 examples/l3fwd-power/main.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
  

Comments

Harman Kalra June 19, 2020, 7:37 a.m. UTC | #1
On Thu, Jun 18, 2020 at 06:18:29PM +0100, Anatoly Burakov wrote:
> External Email
> 
> ----------------------------------------------------------------------
> Currently, the application does support running without the power
> library being initialized, but it has to be specifically requested. On
> platforms without support for frequency scaling using the power library,
> we can just enable interrupt-only mode by default.
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> Suggested-by: Jerin Jacob <jerinjacobk@gmail.com>
> ---

Application probed the platform for frequency scaling support, since
octeontx2 doesnt support it, interrupt-only mode got enabled by default.

Tested-by: Harman Kalra <hkalra@marvell.com>	
	
>  examples/l3fwd-power/main.c | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
> index 51acbfd87d..a66599e734 100644
> --- a/examples/l3fwd-power/main.c
> +++ b/examples/l3fwd-power/main.c
> @@ -2412,6 +2412,20 @@ launch_timer(unsigned int lcore_id)
>  	return 0;
>  }
>  
> +static int
> +autodetect_mode(void)
> +{
> +	/*
> +	 * Empty poll and telemetry modes have to be specifically requested to
> +	 * be enabled, but we can auto-detect between legacy mode with or
> +	 * without interrupts. Both ACPI and pstate can be used.
> +	 */
> +	if (rte_power_check_env_supported(PM_ENV_ACPI_CPUFREQ))
> +		return APP_MODE_LEGACY;
> +	if (rte_power_check_env_supported(PM_ENV_PSTATE_CPUFREQ))
> +		return APP_MODE_LEGACY;
> +	return APP_MODE_INTERRUPT;
> +}
>  
>  int
>  main(int argc, char **argv)
> @@ -2449,7 +2463,7 @@ main(int argc, char **argv)
>  		rte_exit(EXIT_FAILURE, "Invalid L3FWD parameters\n");
>  
>  	if (app_mode == APP_MODE_DEFAULT)
> -		app_mode = APP_MODE_LEGACY;
> +		app_mode = autodetect_mode();
>  
>  	/* only legacy and empty poll mode rely on power library */
>  	if ((app_mode == APP_MODE_LEGACY || app_mode == APP_MODE_EMPTY_POLL) &&
> -- 
> 2.17.1
  
Burakov, Anatoly June 19, 2020, 9:56 a.m. UTC | #2
On 19-Jun-20 8:37 AM, Harman Kalra wrote:
> On Thu, Jun 18, 2020 at 06:18:29PM +0100, Anatoly Burakov wrote:
>> External Email
>>
>> ----------------------------------------------------------------------
>> Currently, the application does support running without the power
>> library being initialized, but it has to be specifically requested. On
>> platforms without support for frequency scaling using the power library,
>> we can just enable interrupt-only mode by default.
>>
>> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
>> Suggested-by: Jerin Jacob <jerinjacobk@gmail.com>
>> ---
> 
> Application probed the platform for frequency scaling support, since
> octeontx2 doesnt support it, interrupt-only mode got enabled by default.
> 
> Tested-by: Harman Kalra <hkalra@marvell.com>	

Perhaps there should be a log indicating which one was picked. There's a 
wrong comment in this particular patch as well, so i'll fix that while 
i'm at it :)

Thanks!

> 	
>>   examples/l3fwd-power/main.c | 16 +++++++++++++++-
>>   1 file changed, 15 insertions(+), 1 deletion(-)
>>
>> diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
>> index 51acbfd87d..a66599e734 100644
>> --- a/examples/l3fwd-power/main.c
>> +++ b/examples/l3fwd-power/main.c
>> @@ -2412,6 +2412,20 @@ launch_timer(unsigned int lcore_id)
>>   	return 0;
>>   }
>>   
>> +static int
>> +autodetect_mode(void)
>> +{
>> +	/*
>> +	 * Empty poll and telemetry modes have to be specifically requested to
>> +	 * be enabled, but we can auto-detect between legacy mode with or
>> +	 * without interrupts. Both ACPI and pstate can be used.
>> +	 */
>> +	if (rte_power_check_env_supported(PM_ENV_ACPI_CPUFREQ))
>> +		return APP_MODE_LEGACY;
>> +	if (rte_power_check_env_supported(PM_ENV_PSTATE_CPUFREQ))
>> +		return APP_MODE_LEGACY;
>> +	return APP_MODE_INTERRUPT;
>> +}
>>   
>>   int
>>   main(int argc, char **argv)
>> @@ -2449,7 +2463,7 @@ main(int argc, char **argv)
>>   		rte_exit(EXIT_FAILURE, "Invalid L3FWD parameters\n");
>>   
>>   	if (app_mode == APP_MODE_DEFAULT)
>> -		app_mode = APP_MODE_LEGACY;
>> +		app_mode = autodetect_mode();
>>   
>>   	/* only legacy and empty poll mode rely on power library */
>>   	if ((app_mode == APP_MODE_LEGACY || app_mode == APP_MODE_EMPTY_POLL) &&
>> -- 
>> 2.17.1
  

Patch

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 51acbfd87d..a66599e734 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -2412,6 +2412,20 @@  launch_timer(unsigned int lcore_id)
 	return 0;
 }
 
+static int
+autodetect_mode(void)
+{
+	/*
+	 * Empty poll and telemetry modes have to be specifically requested to
+	 * be enabled, but we can auto-detect between legacy mode with or
+	 * without interrupts. Both ACPI and pstate can be used.
+	 */
+	if (rte_power_check_env_supported(PM_ENV_ACPI_CPUFREQ))
+		return APP_MODE_LEGACY;
+	if (rte_power_check_env_supported(PM_ENV_PSTATE_CPUFREQ))
+		return APP_MODE_LEGACY;
+	return APP_MODE_INTERRUPT;
+}
 
 int
 main(int argc, char **argv)
@@ -2449,7 +2463,7 @@  main(int argc, char **argv)
 		rte_exit(EXIT_FAILURE, "Invalid L3FWD parameters\n");
 
 	if (app_mode == APP_MODE_DEFAULT)
-		app_mode = APP_MODE_LEGACY;
+		app_mode = autodetect_mode();
 
 	/* only legacy and empty poll mode rely on power library */
 	if ((app_mode == APP_MODE_LEGACY || app_mode == APP_MODE_EMPTY_POLL) &&