[PATCH v2 3/3] examples/l3fwd-power: enable PMD power monitor on Arm

Stephen Hemminger stephen at networkplumber.org
Mon Nov 7 17:01:44 CET 2022


On Mon,  7 Nov 2022 15:04:49 +0800
Feifei Wang <feifei.wang2 at arm.com> wrote:

> +				/* Ensure the main lcore does not enter the power-monitor state,
> +				 * so that it can be used to wake up other lcores on ARM.
> +				 * This is due to WFE instruction has no timeout wake-up mechanism,
> +				 * and if users want to exit actively, the main lcore is needed
> +				 * to send SEV instruction to wake up other lcores.
> +				 */
> +				unsigned int main_lcore = rte_get_main_lcore();

This can be done in a simpler an cleaner manner with a continue statement
earlier in the loop.

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index fd3ade330f82..115535fd4cd7 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -2984,6 +2984,16 @@ main(int argc, char **argv)
 			}
 
 			if (app_mode == APP_MODE_PMD_MGMT && !baseline_enabled) {
+#ifdef RTE_ARCH_ARM64
+				/* Ensure the main lcore does not enter the power-monitor state,
+				 * so that it can be used to wake up other lcores on ARM.
+				 * This is due to WFE instruction has no timeout wake-up mechanism,
+				 * and if users want to exit actively, the main lcore is needed
+				 * to send SEV instruction to wake up other lcors.
+				 */
+				if (lcore_id == rte_get_main_lcore())
+					continue;
+#endif
 				/* Set power_pmd_mgmt configs passed by user */
 				rte_power_pmd_mgmt_set_emptypoll_max(max_empty_polls);
 				ret = rte_power_pmd_mgmt_set_pause_duration(pause_duration);


More information about the dev mailing list