[PATCH 2/2] app/testpmd: add testpmd based sleeping
Robin Jarry
rjarry at redhat.com
Fri Mar 17 20:25:56 CET 2023
Anthony Harivel, Mar 16, 2023 at 16:14:
> Sleep for an incremental amount of time if the fwd engine has processed
> less than at least half a burst of packets (i.e 16pkts with default
> setting) on a polling iteration of testpmd.
>
> Upon detecting the threshold of >= 16 pkts on an Rxq, reset the sleep
> time to zero (i.e. no sleep).
>
> Sleep time will be increased on each iteration where the low load
> conditions remain up to a total of the max sleep time which is set by
> the user with the "--max-sleep-us NUM" command line argument or when in
> interactive "mode set max_sleep NUM".
>
> The default max_sleep value is 0, which means that no sleeps will occur
> and the default behaviour is unchanged from previously.
>
> Testing has been performed on AMD EPYC 7702 server with --nb-cores 12.
> The results were obtained via turbostat for each individual lcore:
>
> max_sleep 0 ====== ======== ======== ========
> idle 4Mpps 16Mpps Bursts
> =============== ====== ======== ======== ========
> C1-state % 0 0 0 0
> C2-state % 0 0 0 0
> % usage 100 100 100 100
> Watt / core 1.14 1.18 1.19 1.14
> =============== ====== ======== ======== ========
>
> max_sleep 500 ====== ======== ======== ========
> idle 4Mpps 16Mpps Bursts
> =============== ====== ======== ======== ========
> C1-state % 99 85 74 98.6
> C2-state % 0 0 0 0
> % usage 1 15 26 1
> Watt / core 0.04 0.18 0.28 0 04
> =============== ====== ======== ======== ========
>
> max_sleep 1000 ====== ======== ======== ========
> idle 4Mpps 16Mpps Bursts
> =============== ====== ======== ======== ========
> C1-state % 0 85 74 0.3
> C2-state % 99 0 0 97.6
> % usage 1 15 25 1
> Watt / core 0.02 0.18 0.28 0 02
> =============== ====== ======== ======== ========
>
> On most cases, the consumption of the cores is greatly improved while
> still performing zero packet loss.
>
> Latency test has been performed on each tests above. The CPU has a C1
> latency of 1us and a C2 latency of 400us. On the worst case scenario, Tx
> Burst of thousands packets every seconds, the following latency in us
> (micro seconds) has been observed:
>
> =========== ==== ===== ======
> max_sleep 0 500 1000
> ----------- ---- ----- ------
> max latency 14 560 1260
> min latency 5 5 6
> Avg latency 7 305 617
> =========== ==== ===== ======
>
> link: https://www.github.com/torvalds/linux/tree/master/tools/power/x86/turbostat
> Signed-off-by: Anthony Harivel <aharivel at redhat.com>
Given the amount of time testpmd is used in local development and
automated testing, adding such an option is a great addition to save CPU
power.
Thanks Anthony.
Reviewed-by: Robin Jarry <rjarry at redhat.com>
More information about the dev
mailing list