[v9,2/2] examples/l3fwd-power: add PM QoS configuration
Checks
Commit Message
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
Hi Huisong,
On 2024/8/9 17:50, Huisong Li wrote:
> 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..9b386c3710 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 CPU%u.\n",
suggest on core%u and use if (ret != 0)
and how about use warning, if current system don't support it, we just give a warning message
but let's it continue.
> + 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;
> }
>
>
Hi chengwen,
在 2024/9/10 10:26, fengchengwen 写道:
> Hi Huisong,
>
> On 2024/8/9 17:50, Huisong Li wrote:
>> 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..9b386c3710 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 CPU%u.\n",
> suggest on core%u and use if (ret != 0)
Ack
>
> and how about use warning, if current system don't support it, we just give a warning message
> but let's it continue.
Because power lib is just supported and compiled on Linux.
And Linux always enable this feature. So Linux always support it.
I don't know what it would be like to compile l3fwd-power on windows.
But this is the another issue and other power APIs, like rte_power_init,
are used directly in l3fwd-power without any condition.
So how about contiue to use error message?
>
>
>> + 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;
>> }
>>
>>
> .
On 2024/9/10 20:07, lihuisong (C) wrote:
> Hi chengwen,
>
> 在 2024/9/10 10:26, fengchengwen 写道:
>> Hi Huisong,
>>
>> On 2024/8/9 17:50, Huisong Li wrote:
>>> 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..9b386c3710 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 CPU%u.\n",
>> suggest on core%u and use if (ret != 0)
> Ack
>>
>> and how about use warning, if current system don't support it, we just give a warning message
>> but let's it continue.
>
>
> Because power lib is just supported and compiled on Linux.
> And Linux always enable this feature. So Linux always support it.
> I don't know what it would be like to compile l3fwd-power on windows.
> But this is the another issue and other power APIs, like rte_power_init, are used directly in l3fwd-power without any condition.
> So how about contiue to use error message?
ok
>>
>>
>>> + 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;
>>> }
>>>
>> .
@@ -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 CPU%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;
}