[v10,2/2] examples/l3fwd-power: add PM QoS configuration

Message ID 20240912023812.30885-3-lihuisong@huawei.com (mailing list archive)
State Changes Requested
Delegated to: Thomas Monjalon
Headers
Series power: introduce PM QoS interface |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/github-robot: build success github build: passed
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-sample-apps-testing success Testing PASS

Commit Message

lihuisong (C) Sept. 12, 2024, 2:38 a.m. UTC
Add PM QoS configuration to declease the delay after sleep in case of
entering deeper idle state.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 examples/l3fwd-power/main.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
  

Comments

Konstantin Ananyev Oct. 14, 2024, 8:24 a.m. UTC | #1
> Add PM QoS configuration to declease the delay after sleep in case of
> entering deeper idle state.
> 
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
> ---
>  examples/l3fwd-power/main.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
> index 2bb6b092c3..b0ddb54ee2 100644
> --- a/examples/l3fwd-power/main.c
> +++ b/examples/l3fwd-power/main.c
> @@ -47,6 +47,7 @@
>  #include <rte_telemetry.h>
>  #include <rte_power_pmd_mgmt.h>
>  #include <rte_power_uncore.h>
> +#include <rte_power_qos.h>
> 
>  #include "perf_core.h"
>  #include "main.h"
> @@ -2260,6 +2261,22 @@ init_power_library(void)
>  			return -1;
>  		}
>  	}
> +
> +	RTE_LCORE_FOREACH(lcore_id) {
> +		/*
> +		 * Set the worker lcore's to have strict latency limit to allow
> +		 * the CPU to enter the shallowest idle state.
> +		 */
> +		ret = rte_power_qos_set_cpu_resume_latency(lcore_id,
> +					RTE_POWER_QOS_STRICT_LATENCY_VALUE);

I wonder why it is set to all worker cores silently and unconditionally?
Wouldn't it be a change from current behavior of the power library? 

> +		if (ret != 0) {
> +			RTE_LOG(ERR, L3FWD_POWER,
> +				"Failed to set strict resume latency on core%u.\n",
> +				lcore_id);
> +			return ret;
> +		}
> +	}
> +
>  	return ret;
>  }
> 
> @@ -2299,6 +2316,13 @@ deinit_power_library(void)
>  			}
>  		}
>  	}
> +
> +	RTE_LCORE_FOREACH(lcore_id) {
> +		/* Restore the original value in kernel. */
> +		rte_power_qos_set_cpu_resume_latency(lcore_id,
> +				RTE_POWER_QOS_RESUME_LATENCY_NO_CONSTRAINT);
> +	}
> +
>  	return ret;
>  }
> 
> --
> 2.22.0
  
Konstantin Ananyev Oct. 14, 2024, 8:46 a.m. UTC | #2
> > Add PM QoS configuration to declease the delay after sleep in case of
> > entering deeper idle state.
> >
> > Signed-off-by: Huisong Li <lihuisong@huawei.com>
> > Acked-by: Morten Brørup <mb@smartsharesystems.com>
> > ---
> >  examples/l3fwd-power/main.c | 24 ++++++++++++++++++++++++
> >  1 file changed, 24 insertions(+)
> >
> > diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
> > index 2bb6b092c3..b0ddb54ee2 100644
> > --- a/examples/l3fwd-power/main.c
> > +++ b/examples/l3fwd-power/main.c
> > @@ -47,6 +47,7 @@
> >  #include <rte_telemetry.h>
> >  #include <rte_power_pmd_mgmt.h>
> >  #include <rte_power_uncore.h>
> > +#include <rte_power_qos.h>
> >
> >  #include "perf_core.h"
> >  #include "main.h"
> > @@ -2260,6 +2261,22 @@ init_power_library(void)
> >  			return -1;
> >  		}
> >  	}
> > +
> > +	RTE_LCORE_FOREACH(lcore_id) {
> > +		/*
> > +		 * Set the worker lcore's to have strict latency limit to allow
> > +		 * the CPU to enter the shallowest idle state.
> > +		 */
> > +		ret = rte_power_qos_set_cpu_resume_latency(lcore_id,
> > +					RTE_POWER_QOS_STRICT_LATENCY_VALUE);
> 
> I wonder why it is set to all worker cores silently and unconditionally?
> Wouldn't it be a change from current behavior of the power library?
s/library/sample app/

> 
> > +		if (ret != 0) {
> > +			RTE_LOG(ERR, L3FWD_POWER,
> > +				"Failed to set strict resume latency on core%u.\n",
> > +				lcore_id);
> > +			return ret;
> > +		}
> > +	}
> > +
> >  	return ret;
> >  }
> >
> > @@ -2299,6 +2316,13 @@ deinit_power_library(void)
> >  			}
> >  		}
> >  	}
> > +
> > +	RTE_LCORE_FOREACH(lcore_id) {
> > +		/* Restore the original value in kernel. */
> > +		rte_power_qos_set_cpu_resume_latency(lcore_id,
> > +				RTE_POWER_QOS_RESUME_LATENCY_NO_CONSTRAINT);
> > +	}
> > +
> >  	return ret;
> >  }
> >
> > --
> > 2.22.0
  

Patch

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 2bb6b092c3..b0ddb54ee2 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -47,6 +47,7 @@ 
 #include <rte_telemetry.h>
 #include <rte_power_pmd_mgmt.h>
 #include <rte_power_uncore.h>
+#include <rte_power_qos.h>
 
 #include "perf_core.h"
 #include "main.h"
@@ -2260,6 +2261,22 @@  init_power_library(void)
 			return -1;
 		}
 	}
+
+	RTE_LCORE_FOREACH(lcore_id) {
+		/*
+		 * Set the worker lcore's to have strict latency limit to allow
+		 * the CPU to enter the shallowest idle state.
+		 */
+		ret = rte_power_qos_set_cpu_resume_latency(lcore_id,
+					RTE_POWER_QOS_STRICT_LATENCY_VALUE);
+		if (ret != 0) {
+			RTE_LOG(ERR, L3FWD_POWER,
+				"Failed to set strict resume latency on core%u.\n",
+				lcore_id);
+			return ret;
+		}
+	}
+
 	return ret;
 }
 
@@ -2299,6 +2316,13 @@  deinit_power_library(void)
 			}
 		}
 	}
+
+	RTE_LCORE_FOREACH(lcore_id) {
+		/* Restore the original value in kernel. */
+		rte_power_qos_set_cpu_resume_latency(lcore_id,
+				RTE_POWER_QOS_RESUME_LATENCY_NO_CONSTRAINT);
+	}
+
 	return ret;
 }