power: remove experimental empty poll API
The empty poll mechanism was an experimental API added in commit id 450f0791312c. It aimed to allow power saving depending on the traffic profile. However, it required a training phase and required the user to adjust magic numbers depending on their workload.
A new and improved mechanism was added in commit id 682a645438c5, also based on empty polls, implemented a callback mechanism which added 'monitor', 'pause' and 'scale' modes in l3fwd-power. This was and easier mechanism to use, so the original empty poll mechanism is no longer needed.
This patch set removes the experimental empty poll API, the empty poll mode from l3fwd-power, and related documentation.
This is based on a deprecation notice in the previous release.
[1/3] examples/power: remove empty poll mode from [2/3] libs/power: remove experimental empty poll API [3/3] doc/power: remove empty poll documentation
PATCH 1/3 examples/power: remove empty poll mode from l3fwd-power
Remove calls to the experimental empty poll API. l3fwd-power is the only app that uses this.
This API is no longer needed as it is superceded by the monitor/pause/scale callback mechanism.
--- examples/l3fwd-power/main.c | 266 +----------------------------------- 1 file changed, 5 insertions(+), 261 deletions(-)
examples/l3fwd-power/main.c +5 -261
@@ -43,7 +43,6 @@#include <rte_timer.h> #include <rte_power.h> #include <rte_spinlock.h> -#include <rte_power_empty_poll.h> #include <rte_metrics.h> #include <rte_telemetry.h> #include <rte_power_pmd_mgmt.h>
@@ -125,14 +124,6 @@#define RX_DESC_DEFAULT 1024#define TX_DESC_DEFAULT 1024 -/* -* These two thresholds were decided on by running the training algorithm on -* a 2.5GHz Xeon. These defaults can be overridden by supplying non-zero values -* for the med_threshold and high_threshold parameters on the command line. -*/ -#define EMPTY_POLL_MED_THRESHOLD 350000UL -#define EMPTY_POLL_HGH_THRESHOLD 580000UL -#define NUM_TELSTATS RTE_DIM(telstats_strings)static uint16_t nb_rxd =RX_DESC_DEFAULT ;
@@ -150,12 +141,7 @@ static uint32_t enabled_port_mask = 0;static int promiscuous_on =0 ;/* NUMA is enabled by default. */ static int numa_on =1 ; -static bool empty_poll_stop; -static bool empty_poll_train;volatile bool quit_signal; -static struct ep_params *ep_params; -static struct ep_policy policy; -static long ep_med_edpi, ep_hgh_edpi;/* timer to update telemetry every 500ms */ static struct rte_timer telemetry_timer;
@@ -207,7 +193,6 @@ static int parse_ptype; /**< Parse packet type using rx callback, and */enum appmode {APP_MODE_DEFAULT =0 ,APP_MODE_LEGACY , -APP_MODE_EMPTY_POLL ,APP_MODE_TELEMETRY ,APP_MODE_INTERRUPT ,APP_MODE_PMD_MGMT
@@ -423,14 +408,6 @@ static inline uint32_t power_idle_heuristic(uint32_t zero_rx_packet_count);static inline enum freq_scale_hint_t power_freq_scaleup_heuristic ( \unsigned int lcore_id,uint16_t port_id,uint16_t queue_id); - -/* -* These defaults are using the max frequency index (1), a medium index (9) -* and a typical low frequency index (14). These can be adjusted to use -* different indexes using the relevant command line parameters. -*/ -static uint8_t freq_tlb[] = {14 ,9 ,1 }; -static int is_done (void ) {return quit_signal;
@@ -1217,110 +1194,7 @@ main_telemetry_loop(__rte_unused void *dummy)return 0 ; } -/* main processing loop */ -static int -main_empty_poll_loop(__rte_unused void *dummy) -{ -struct rte_mbuf *pkts_burst[MAX_PKT_BURST ]; -unsigned int lcore_id; -uint64_t prev_tsc, diff_tsc, cur_tsc; -int i, j, nb_rx; -uint8_t queueid; -uint16_t portid; -struct lcore_conf *qconf; -struct lcore_rx_queue *rx_queue; - -const uint64_t drain_tsc = - (rte_get_tsc_hz () +US_PER_S -1 ) / -US_PER_S *BURST_TX_DRAIN_US ; - - prev_tsc =0 ; - - lcore_id =rte_lcore_id (); - qconf = &lcore_conf[lcore_id]; - -if (qconf->n_rx_queue ==0 ) { -RTE_LOG (INFO ,L3FWD_POWER ,"lcore %u has nothing to do\n" , - lcore_id); -return 0 ; - } - -for (i =0 ; i < qconf->n_rx_queue; i++) { - portid = qconf->rx_queue_list[i].port_id; - queueid = qconf->rx_queue_list[i].queue_id; -RTE_LOG (INFO ,L3FWD_POWER ," -- lcoreid=%u portid=%u " -"rxqueueid=%hhu\n" , lcore_id, portid, queueid); - } - -while (!is_done ()) { - stats[lcore_id].nb_iteration_looped++; - - cur_tsc =rte_rdtsc (); -/* -* TX burst queue drain -*/ - diff_tsc = cur_tsc - prev_tsc; -if (unlikely (diff_tsc > drain_tsc)) { -for (i =0 ; i < qconf->n_tx_port; ++i) { - portid = qconf->tx_port_id[i]; -rte_eth_tx_buffer_flush (portid, - qconf->tx_queue_id[portid], - qconf->tx_buffer[portid]); - } - prev_tsc = cur_tsc; - } - -/* -* Read packet from RX queues -*/ -for (i =0 ; i < qconf->n_rx_queue; ++i) { - rx_queue = &(qconf->rx_queue_list[i]); - rx_queue->idle_hint =0 ; - portid = rx_queue->port_id; - queueid = rx_queue->queue_id; - - nb_rx =rte_eth_rx_burst (portid, queueid, pkts_burst, -MAX_PKT_BURST ); - - stats[lcore_id].nb_rx_processed += nb_rx; - -if (nb_rx ==0 ) { - -rte_power_empty_poll_stat_update (lcore_id); - -continue ; - }else { -rte_power_poll_stat_update (lcore_id, nb_rx); - } - - -/* Prefetch first packets */ -for (j =0 ; j <PREFETCH_OFFSET && j < nb_rx; j++) { -rte_prefetch0 (rte_pktmbuf_mtod( -pkts_burst [j],void *)); - } - -/* Prefetch and forward already prefetched packets */ -for (j =0 ; j < (nb_rx -PREFETCH_OFFSET ); j++) { -rte_prefetch0 (rte_pktmbuf_mtod(pkts_burst [ - j +PREFETCH_OFFSET ], -void *)); -l3fwd_simple_forward (pkts_burst[j], portid, - qconf); - } - -/* Forward remaining prefetched packets */ -for (; j < nb_rx; j++) { -l3fwd_simple_forward (pkts_burst[j], portid, - qconf); - } - - } - } - -return 0 ; -}/* main processing loop */ static int main_legacy_loop(__rte_unused void *dummy)
@@ -1853,58 +1727,8 @@ parse_pmd_mgmt_config(const char *name)return -1 ; } -static int -parse_ep_config (const char *q_arg) -{ -char s[256 ]; -const char *p = q_arg; -char *end; -int num_arg; - -char *str_fld[3 ]; - -int training_flag; -int med_edpi; -int hgh_edpi; - - ep_med_edpi =EMPTY_POLL_MED_THRESHOLD ; - ep_hgh_edpi =EMPTY_POLL_HGH_THRESHOLD ; - -strlcpy (s, p,sizeof (s)); - - num_arg =rte_strsplit (s,sizeof (s), str_fld,3 ,',' ); - - empty_poll_train = false; - -if (num_arg ==0 ) -return 0 ; - -if (num_arg ==3 ) { - - training_flag =strtoul (str_fld[0 ], &end,0 ); - med_edpi =strtoul (str_fld[1 ], &end,0 ); - hgh_edpi =strtoul (str_fld[2 ], &end,0 ); - -if (training_flag ==1 ) - empty_poll_train = true; - -if (med_edpi >0 ) - ep_med_edpi = med_edpi; - -if (hgh_edpi >0 ) - ep_hgh_edpi = hgh_edpi; - - }else { - -return -1 ; - } - -return 0 ; - -}#define CMD_LINE_OPT_PARSE_PTYPE "parse-ptype"#define CMD_LINE_OPT_LEGACY "legacy" -#define CMD_LINE_OPT_EMPTY_POLL "empty-poll"#define CMD_LINE_OPT_INTERRUPT_ONLY "interrupt-only"#define CMD_LINE_OPT_TELEMETRY "telemetry"#define CMD_LINE_OPT_PMD_MGMT "pmd-mgmt"
@@ -1921,7 +1745,6 @@ parse_args(int argc, char **argv)int opt, ret;char **argvopt;int option_index; -uint32_t limit;char *prgname = argv[0 ];static struct option lgopts[] = { {"config" ,1 ,0 ,0 },
@@ -1929,7 +1752,6 @@ parse_args(int argc, char **argv) {"high-perf-cores", 1, 0, 0}, {"no-numa", 0, 0, 0}, {CMD_LINE_OPT_MAX_PKT_LEN, 1, 0, 0}, - {CMD_LINE_OPT_EMPTY_POLL, 1, 0, 0}, {CMD_LINE_OPT_PARSE_PTYPE, 0, 0, 0}, {CMD_LINE_OPT_LEGACY, 0, 0, 0}, {CMD_LINE_OPT_TELEMETRY, 0, 0, 0},
@@ -1944,7 +1766,7 @@ parse_args(int argc, char **argv) argvopt = argv; -while ((opt =getopt_long (argc, argvopt,"p:l:m:h:PuUi:" , +while ((opt =getopt_long (argc, argvopt,"p:PuUi:" , lgopts, &option_index)) !=EOF ) {switch (opt) {
@@ -1961,18 +1783,6 @@ parse_args(int argc, char **argv)printf ("Promiscuous mode selected\n" ); promiscuous_on =1 ;break ; -case 'l' : - limit =parse_max_pkt_len (optarg); - freq_tlb[LOW ] = limit; -break ; -case 'm' : - limit =parse_max_pkt_len (optarg); - freq_tlb[MED ] = limit; -break ; -case 'h' : - limit =parse_max_pkt_len (optarg); - freq_tlb[HGH ] = limit; -break ;case 'u' : enabled_uncore =parse_uncore_options (UNCORE_MIN ,NULL );if (enabled_uncore <0 ) {
@@ -2042,23 +1852,6 @@ parse_args(int argc, char **argv)printf ("legacy mode is enabled\n" ); } -if (!strncmp (lgopts[option_index].name, -CMD_LINE_OPT_EMPTY_POLL ,10 )) { -if (app_mode !=APP_MODE_DEFAULT ) { -printf (" empty-poll mode is mutually exclusive with other modes\n" ); -return -1 ; - } - app_mode =APP_MODE_EMPTY_POLL ; - ret =parse_ep_config (optarg); - -if (ret) { -printf ("invalid empty poll config\n" ); -print_usage (prgname); -return -1 ; - } -printf ("empty-poll is enabled\n" ); - } -if (!strncmp (lgopts[option_index].name,CMD_LINE_OPT_TELEMETRY ,sizeof (CMD_LINE_OPT_TELEMETRY ))) {
@@ -2575,24 +2368,7 @@ telemetry_setup_timer(void) update_telemetry, NULL); } -static void -empty_poll_setup_timer (void ) -{ -int lcore_id =rte_lcore_id (); -uint64_t hz =rte_get_timer_hz (); - -struct ep_params *ep_ptr = ep_params; - - ep_ptr->interval_ticks = hz /INTERVALS_PER_SECOND ; -rte_timer_reset_sync (&ep_ptr->timer0, - ep_ptr->interval_ticks, -PERIODICAL , - lcore_id, - rte_empty_poll_detection, - (void *)ep_ptr); - -}static int launch_timer (unsigned int lcore_id) {
@@ -2609,10 +2385,7 @@ launch_timer(unsigned int lcore_id)RTE_LOG (INFO ,POWER ,"Bring up the Timer\n" ); -if (app_mode ==APP_MODE_EMPTY_POLL ) -empty_poll_setup_timer (); -else -telemetry_setup_timer (); +telemetry_setup_timer (); cycles_10ms =rte_get_timer_hz () /100 ;
@@ -2657,8 +2430,6 @@ mode_to_str(enum appmode mode)switch (mode) {case APP_MODE_LEGACY :return "legacy" ; -case APP_MODE_EMPTY_POLL : -return "empty poll" ;case APP_MODE_TELEMETRY :return "telemetry" ;case APP_MODE_INTERRUPT :
@@ -2751,8 +2522,7 @@ main(int argc, char **argv) mode_to_str(app_mode));/* only legacy and empty poll mode rely on power library */ -if ((app_mode ==APP_MODE_LEGACY || app_mode ==APP_MODE_EMPTY_POLL ) && -init_power_library ()) +if ((app_mode ==APP_MODE_LEGACY ) &&init_power_library ())rte_exit (EXIT_FAILURE ,"init_power_library failed\n" );if (update_lcore_params () <0 )
@@ -3054,31 +2824,9 @@ main(int argc, char **argv)check_all_ports_link_status (enabled_port_mask); -if (app_mode ==APP_MODE_EMPTY_POLL ) { - -if (empty_poll_train) { - policy.state =TRAINING ; - }else { - policy.state =MED_NORMAL ; - policy.med_base_edpi = ep_med_edpi; - policy.hgh_base_edpi = ep_hgh_edpi; - } - - ret =rte_power_empty_poll_stat_init (&ep_params, - freq_tlb, - &policy); -if (ret <0 ) -rte_exit (EXIT_FAILURE ,"empty poll init failed" ); - } - -/* launch per-lcore init on every lcore */ if (app_mode ==APP_MODE_LEGACY ) {rte_eal_mp_remote_launch (main_legacy_loop,NULL ,CALL_MAIN ); - }else if (app_mode ==APP_MODE_EMPTY_POLL ) { - empty_poll_stop = false; -rte_eal_mp_remote_launch (main_empty_poll_loop,NULL , -SKIP_MAIN ); }else if (app_mode ==APP_MODE_TELEMETRY ) {unsigned int i;
@@ -3110,7 +2858,7 @@ main(int argc, char **argv)rte_eal_mp_remote_launch (main_telemetry_loop,NULL ,CALL_MAIN ); } -if (app_mode ==APP_MODE_EMPTY_POLL || app_mode ==APP_MODE_TELEMETRY ) +if (app_mode ==APP_MODE_TELEMETRY )launch_timer (rte_lcore_id ());RTE_LCORE_FOREACH_WORKER (lcore_id) {
@@ -3146,11 +2894,7 @@ main(int argc, char **argv)rte_eth_dev_close (portid); } -if (app_mode ==APP_MODE_EMPTY_POLL ) -rte_power_empty_poll_stat_free (); - -if ((app_mode ==APP_MODE_LEGACY || app_mode ==APP_MODE_EMPTY_POLL ) && -deinit_power_library ()) +if ((app_mode ==APP_MODE_LEGACY ) &&deinit_power_library ())rte_exit (EXIT_FAILURE ,"deinit_power_library failed\n" );if (rte_eal_cleanup () <0 )
Signature · 1 line
2.17.1
Re: [PATCH v1 1/3] examples/power: remove empty poll mode from l3fwd-power
Quoted 6 lines · David Hunt
Remove calls to the experimental empty poll API. l3fwd-power is the only app that uses this.
This API is no longer needed as it is superceded by the monitor/pause/scale callback mechanism.
I did check the spelling against my spellchecker with checkpatch, and it was clean. Too bad my dictionary uses a disputed spelling...
From https://www.merriam-webster.com/dictionary/supercede: "Supercede has occurred as a spelling variant of supersede since the 17th century, and it is common in current published writing. It continues, however, to be widely regarded as an error."
I'll fix in the next patch revision.
Rgds,
Dave.
RE: [PATCH v1 1/3] examples/power: remove empty poll mode from l3fwd-power
In reply to David HuntQuoted 5 lines
-----Original Message-----
From: David Hunt <[email protected]>
/* only legacy and empty poll mode rely on power library */
You can remove empty poll mode reference in above comment.
<snip>
Can we check, inside print_usage() function , we need to remove below lines
" --empty-poll: enable empty poll detection"
" follow (training_flag, high_threshold, med_threshold)\n"
v2 cover power: remove experimental empty poll API
In reply to David HuntThe empty poll mechanism was an experimental API added in commit id 450f0791312c. It aimed to allow power saving depending on the traffic profile. However, it required a training phase and required the user to adjust magic numbers depending on their workload.
A new and improved mechanism was added in commit id 682a645438c5, also based on empty polls, implemented a callback mechanism which added 'monitor', 'pause' and 'scale' modes in l3fwd-power. This was and easier mechanism to use, so the original empty poll mechanism is no longer needed.
This patch set removes the experimental empty poll API, the empty poll mode from l3fwd-power, and related documentation.
This is based on a deprecation notice in the previous release.
[1/3] examples/power: remove empty poll mode from [2/3] libs/power: remove experimental empty poll API [3/3] doc/power: remove empty poll documentation
PATCH v2 1/3 examples/power: remove empty poll mode from l3fwd-power
Remove calls to the experimental empty poll API. l3fwd-power is the only app that uses this.
This API is no longer needed as it is superseded by the monitor/pause/scale callback mechanism.
--- examples/l3fwd-power/main.c | 270 +----------------------------------- 1 file changed, 6 insertions(+), 264 deletions(-)
examples/l3fwd-power/main.c +6 -264
@@ -43,7 +43,6 @@#include <rte_timer.h> #include <rte_power.h> #include <rte_spinlock.h> -#include <rte_power_empty_poll.h> #include <rte_metrics.h> #include <rte_telemetry.h> #include <rte_power_pmd_mgmt.h>
@@ -125,14 +124,6 @@#define RX_DESC_DEFAULT 1024#define TX_DESC_DEFAULT 1024 -/* -* These two thresholds were decided on by running the training algorithm on -* a 2.5GHz Xeon. These defaults can be overridden by supplying non-zero values -* for the med_threshold and high_threshold parameters on the command line. -*/ -#define EMPTY_POLL_MED_THRESHOLD 350000UL -#define EMPTY_POLL_HGH_THRESHOLD 580000UL -#define NUM_TELSTATS RTE_DIM(telstats_strings)static uint16_t nb_rxd =RX_DESC_DEFAULT ;
@@ -150,12 +141,7 @@ static uint32_t enabled_port_mask = 0;static int promiscuous_on =0 ;/* NUMA is enabled by default. */ static int numa_on =1 ; -static bool empty_poll_stop; -static bool empty_poll_train;volatile bool quit_signal; -static struct ep_params *ep_params; -static struct ep_policy policy; -static long ep_med_edpi, ep_hgh_edpi;/* timer to update telemetry every 500ms */ static struct rte_timer telemetry_timer;
@@ -207,7 +193,6 @@ static int parse_ptype; /**< Parse packet type using rx callback, and */enum appmode {APP_MODE_DEFAULT =0 ,APP_MODE_LEGACY , -APP_MODE_EMPTY_POLL ,APP_MODE_TELEMETRY ,APP_MODE_INTERRUPT ,APP_MODE_PMD_MGMT
@@ -423,14 +408,6 @@ static inline uint32_t power_idle_heuristic(uint32_t zero_rx_packet_count);static inline enum freq_scale_hint_t power_freq_scaleup_heuristic ( \unsigned int lcore_id,uint16_t port_id,uint16_t queue_id); - -/* -* These defaults are using the max frequency index (1), a medium index (9) -* and a typical low frequency index (14). These can be adjusted to use -* different indexes using the relevant command line parameters. -*/ -static uint8_t freq_tlb[] = {14 ,9 ,1 }; -static int is_done (void ) {return quit_signal;
@@ -1217,110 +1194,7 @@ main_telemetry_loop(__rte_unused void *dummy)return 0 ; } -/* main processing loop */ -static int -main_empty_poll_loop(__rte_unused void *dummy) -{ -struct rte_mbuf *pkts_burst[MAX_PKT_BURST ]; -unsigned int lcore_id; -uint64_t prev_tsc, diff_tsc, cur_tsc; -int i, j, nb_rx; -uint8_t queueid; -uint16_t portid; -struct lcore_conf *qconf; -struct lcore_rx_queue *rx_queue; - -const uint64_t drain_tsc = - (rte_get_tsc_hz () +US_PER_S -1 ) / -US_PER_S *BURST_TX_DRAIN_US ; - - prev_tsc =0 ; - - lcore_id =rte_lcore_id (); - qconf = &lcore_conf[lcore_id]; - -if (qconf->n_rx_queue ==0 ) { -RTE_LOG (INFO ,L3FWD_POWER ,"lcore %u has nothing to do\n" , - lcore_id); -return 0 ; - } - -for (i =0 ; i < qconf->n_rx_queue; i++) { - portid = qconf->rx_queue_list[i].port_id; - queueid = qconf->rx_queue_list[i].queue_id; -RTE_LOG (INFO ,L3FWD_POWER ," -- lcoreid=%u portid=%u " -"rxqueueid=%hhu\n" , lcore_id, portid, queueid); - } - -while (!is_done ()) { - stats[lcore_id].nb_iteration_looped++; - - cur_tsc =rte_rdtsc (); -/* -* TX burst queue drain -*/ - diff_tsc = cur_tsc - prev_tsc; -if (unlikely (diff_tsc > drain_tsc)) { -for (i =0 ; i < qconf->n_tx_port; ++i) { - portid = qconf->tx_port_id[i]; -rte_eth_tx_buffer_flush (portid, - qconf->tx_queue_id[portid], - qconf->tx_buffer[portid]); - } - prev_tsc = cur_tsc; - } - -/* -* Read packet from RX queues -*/ -for (i =0 ; i < qconf->n_rx_queue; ++i) { - rx_queue = &(qconf->rx_queue_list[i]); - rx_queue->idle_hint =0 ; - portid = rx_queue->port_id; - queueid = rx_queue->queue_id; - - nb_rx =rte_eth_rx_burst (portid, queueid, pkts_burst, -MAX_PKT_BURST ); - - stats[lcore_id].nb_rx_processed += nb_rx; - -if (nb_rx ==0 ) { - -rte_power_empty_poll_stat_update (lcore_id); - -continue ; - }else { -rte_power_poll_stat_update (lcore_id, nb_rx); - } - - -/* Prefetch first packets */ -for (j =0 ; j <PREFETCH_OFFSET && j < nb_rx; j++) { -rte_prefetch0 (rte_pktmbuf_mtod( -pkts_burst [j],void *)); - } - -/* Prefetch and forward already prefetched packets */ -for (j =0 ; j < (nb_rx -PREFETCH_OFFSET ); j++) { -rte_prefetch0 (rte_pktmbuf_mtod(pkts_burst [ - j +PREFETCH_OFFSET ], -void *)); -l3fwd_simple_forward (pkts_burst[j], portid, - qconf); - } - -/* Forward remaining prefetched packets */ -for (; j < nb_rx; j++) { -l3fwd_simple_forward (pkts_burst[j], portid, - qconf); - } - - } - } - -return 0 ; -}/* main processing loop */ static int main_legacy_loop(__rte_unused void *dummy)
@@ -1636,8 +1510,6 @@ print_usage(const char *prgname)" --max-pkt-len PKTLEN: maximum packet length in decimal (64-9600)\n" " --parse-ptype: parse packet type by software\n" " --legacy: use legacy interrupt-based scaling\n" -" --empty-poll: enable empty poll detection" -" follow (training_flag, high_threshold, med_threshold)\n" " --telemetry: enable telemetry mode, to update" " empty polls, full polls, and core busyness to telemetry\n" " --interrupt-only: enable interrupt-only mode\n"
@@ -1853,58 +1725,8 @@ parse_pmd_mgmt_config(const char *name)return -1 ; } -static int -parse_ep_config (const char *q_arg) -{ -char s[256 ]; -const char *p = q_arg; -char *end; -int num_arg; - -char *str_fld[3 ]; - -int training_flag; -int med_edpi; -int hgh_edpi; - - ep_med_edpi =EMPTY_POLL_MED_THRESHOLD ; - ep_hgh_edpi =EMPTY_POLL_HGH_THRESHOLD ; - -strlcpy (s, p,sizeof (s)); - - num_arg =rte_strsplit (s,sizeof (s), str_fld,3 ,',' ); - - empty_poll_train = false; - -if (num_arg ==0 ) -return 0 ; - -if (num_arg ==3 ) { - - training_flag =strtoul (str_fld[0 ], &end,0 ); - med_edpi =strtoul (str_fld[1 ], &end,0 ); - hgh_edpi =strtoul (str_fld[2 ], &end,0 ); - -if (training_flag ==1 ) - empty_poll_train = true; - -if (med_edpi >0 ) - ep_med_edpi = med_edpi; - -if (hgh_edpi >0 ) - ep_hgh_edpi = hgh_edpi; - - }else { - -return -1 ; - } - -return 0 ; - -}#define CMD_LINE_OPT_PARSE_PTYPE "parse-ptype"#define CMD_LINE_OPT_LEGACY "legacy" -#define CMD_LINE_OPT_EMPTY_POLL "empty-poll"#define CMD_LINE_OPT_INTERRUPT_ONLY "interrupt-only"#define CMD_LINE_OPT_TELEMETRY "telemetry"#define CMD_LINE_OPT_PMD_MGMT "pmd-mgmt"
@@ -1921,7 +1743,6 @@ parse_args(int argc, char **argv)int opt, ret;char **argvopt;int option_index; -uint32_t limit;char *prgname = argv[0 ];static struct option lgopts[] = { {"config" ,1 ,0 ,0 },
@@ -1929,7 +1750,6 @@ parse_args(int argc, char **argv) {"high-perf-cores", 1, 0, 0}, {"no-numa", 0, 0, 0}, {CMD_LINE_OPT_MAX_PKT_LEN, 1, 0, 0}, - {CMD_LINE_OPT_EMPTY_POLL, 1, 0, 0}, {CMD_LINE_OPT_PARSE_PTYPE, 0, 0, 0}, {CMD_LINE_OPT_LEGACY, 0, 0, 0}, {CMD_LINE_OPT_TELEMETRY, 0, 0, 0},
@@ -1944,7 +1764,7 @@ parse_args(int argc, char **argv) argvopt = argv; -while ((opt =getopt_long (argc, argvopt,"p:l:m:h:PuUi:" , +while ((opt =getopt_long (argc, argvopt,"p:PuUi:" , lgopts, &option_index)) !=EOF ) {switch (opt) {
@@ -1961,18 +1781,6 @@ parse_args(int argc, char **argv)printf ("Promiscuous mode selected\n" ); promiscuous_on =1 ;break ; -case 'l' : - limit =parse_max_pkt_len (optarg); - freq_tlb[LOW ] = limit; -break ; -case 'm' : - limit =parse_max_pkt_len (optarg); - freq_tlb[MED ] = limit; -break ; -case 'h' : - limit =parse_max_pkt_len (optarg); - freq_tlb[HGH ] = limit; -break ;case 'u' : enabled_uncore =parse_uncore_options (UNCORE_MIN ,NULL );if (enabled_uncore <0 ) {
@@ -2042,23 +1850,6 @@ parse_args(int argc, char **argv)printf ("legacy mode is enabled\n" ); } -if (!strncmp (lgopts[option_index].name, -CMD_LINE_OPT_EMPTY_POLL ,10 )) { -if (app_mode !=APP_MODE_DEFAULT ) { -printf (" empty-poll mode is mutually exclusive with other modes\n" ); -return -1 ; - } - app_mode =APP_MODE_EMPTY_POLL ; - ret =parse_ep_config (optarg); - -if (ret) { -printf ("invalid empty poll config\n" ); -print_usage (prgname); -return -1 ; - } -printf ("empty-poll is enabled\n" ); - } -if (!strncmp (lgopts[option_index].name,CMD_LINE_OPT_TELEMETRY ,sizeof (CMD_LINE_OPT_TELEMETRY ))) {
@@ -2575,24 +2366,7 @@ telemetry_setup_timer(void) update_telemetry, NULL); } -static void -empty_poll_setup_timer (void ) -{ -int lcore_id =rte_lcore_id (); -uint64_t hz =rte_get_timer_hz (); - -struct ep_params *ep_ptr = ep_params; - - ep_ptr->interval_ticks = hz /INTERVALS_PER_SECOND ; -rte_timer_reset_sync (&ep_ptr->timer0, - ep_ptr->interval_ticks, -PERIODICAL , - lcore_id, - rte_empty_poll_detection, - (void *)ep_ptr); - -}static int launch_timer (unsigned int lcore_id) {
@@ -2609,10 +2383,7 @@ launch_timer(unsigned int lcore_id)RTE_LOG (INFO ,POWER ,"Bring up the Timer\n" ); -if (app_mode ==APP_MODE_EMPTY_POLL ) -empty_poll_setup_timer (); -else -telemetry_setup_timer (); +telemetry_setup_timer (); cycles_10ms =rte_get_timer_hz () /100 ;
@@ -2657,8 +2428,6 @@ mode_to_str(enum appmode mode)switch (mode) {case APP_MODE_LEGACY :return "legacy" ; -case APP_MODE_EMPTY_POLL : -return "empty poll" ;case APP_MODE_TELEMETRY :return "telemetry" ;case APP_MODE_INTERRUPT :
@@ -2750,9 +2519,8 @@ main(int argc, char **argv)RTE_LOG (INFO ,L3FWD_POWER ,"Selected operation mode: %s\n" ,mode_to_str (app_mode)); -/* only legacy and empty poll mode rely on power library */ -if ((app_mode ==APP_MODE_LEGACY || app_mode ==APP_MODE_EMPTY_POLL ) && -init_power_library ()) +/* only legacy mode relies on power library */ +if ((app_mode ==APP_MODE_LEGACY ) &&init_power_library ())rte_exit (EXIT_FAILURE ,"init_power_library failed\n" );if (update_lcore_params () <0 )
@@ -3054,31 +2822,9 @@ main(int argc, char **argv)check_all_ports_link_status (enabled_port_mask); -if (app_mode ==APP_MODE_EMPTY_POLL ) { - -if (empty_poll_train) { - policy.state =TRAINING ; - }else { - policy.state =MED_NORMAL ; - policy.med_base_edpi = ep_med_edpi; - policy.hgh_base_edpi = ep_hgh_edpi; - } - - ret =rte_power_empty_poll_stat_init (&ep_params, - freq_tlb, - &policy); -if (ret <0 ) -rte_exit (EXIT_FAILURE ,"empty poll init failed" ); - } - -/* launch per-lcore init on every lcore */ if (app_mode ==APP_MODE_LEGACY ) {rte_eal_mp_remote_launch (main_legacy_loop,NULL ,CALL_MAIN ); - }else if (app_mode ==APP_MODE_EMPTY_POLL ) { - empty_poll_stop = false; -rte_eal_mp_remote_launch (main_empty_poll_loop,NULL , -SKIP_MAIN ); }else if (app_mode ==APP_MODE_TELEMETRY ) {unsigned int i;
@@ -3110,7 +2856,7 @@ main(int argc, char **argv)rte_eal_mp_remote_launch (main_telemetry_loop,NULL ,CALL_MAIN ); } -if (app_mode ==APP_MODE_EMPTY_POLL || app_mode ==APP_MODE_TELEMETRY ) +if (app_mode ==APP_MODE_TELEMETRY )launch_timer (rte_lcore_id ());RTE_LCORE_FOREACH_WORKER (lcore_id) {
@@ -3146,11 +2892,7 @@ main(int argc, char **argv)rte_eth_dev_close (portid); } -if (app_mode ==APP_MODE_EMPTY_POLL ) -rte_power_empty_poll_stat_free (); - -if ((app_mode ==APP_MODE_LEGACY || app_mode ==APP_MODE_EMPTY_POLL ) && -deinit_power_library ()) +if ((app_mode ==APP_MODE_LEGACY ) &&deinit_power_library ())rte_exit (EXIT_FAILURE ,"deinit_power_library failed\n" );if (rte_eal_cleanup () <0 )
Signature · 1 line
2.17.1
RE: [PATCH v2 1/3] examples/power: remove empty poll mode from l3fwd-power
Quoted 7 lines
-----Original Message-----
From: Hunt, David <[email protected]>Signed-off-by David Hunt <[email protected]>---
PATCH v2 2/3 libs/power: remove experimental empty poll API
In reply to David HuntThis patchset removes the empty poll experimental API, which has been in an experimental state since it was added.
This API is no longer needed as it is superseded by the PMD Power Management monitor/pause/scale callback mechanism.
--- lib/power/meson.build | 2 - lib/power/rte_power_empty_poll.c | 529 ------------------------------- lib/power/rte_power_empty_poll.h | 223 ------------- lib/power/version.map | 7 - 4 files changed, 761 deletions(-) delete mode 100644 lib/power/rte_power_empty_poll.c delete mode 100644 lib/power/rte_power_empty_poll.h
lib/power/meson.build +0 -2
@@ -19,13 +19,11 @@ sources = files( 'power_kvm_vm.c', 'power_pstate_cpufreq.c', 'rte_power.c', - 'rte_power_empty_poll.c', 'rte_power_intel_uncore.c', 'rte_power_pmd_mgmt.c', ) headers = files( 'rte_power.h', - 'rte_power_empty_poll.h', 'rte_power_intel_uncore.h', 'rte_power_pmd_mgmt.h', 'rte_power_guest_channel.h',
lib/power/rte_power_empty_poll.c deleted +0 -529
529 lines not on this page · raw message
lib/power/rte_power_empty_poll.h deleted +0 -223
223 lines not on this page · raw message
lib/power/version.map +0 -7
@@ -25,15 +25,8 @@ DPDK_23 { EXPERIMENTAL { global: - rte_empty_poll_detection; rte_power_check_env_supported; - rte_power_empty_poll_stat_fetch; - rte_power_empty_poll_stat_free; - rte_power_empty_poll_stat_init; - rte_power_empty_poll_stat_update; rte_power_guest_channel_receive_msg; - rte_power_poll_stat_fetch; - rte_power_poll_stat_update; # added in 21.02 rte_power_ethdev_pmgmt_queue_disable;
Signature · 1 line
2.17.1
PATCH v2 3/3 doc/power: remove empty poll documentation
In reply to David HuntRemove the documentation for the removed experimental empty poll API, as it is no longer needed.
This API is no longer needed as it is superseded by the PMD Power Management monitor/pause/scale callback mechanism.
--- doc/guides/prog_guide/power_man.rst | 94 ------------------- doc/guides/rel_notes/release_23_03.rst | 4 + .../sample_app_ug/l3_forward_power_man.rst | 70 -------------- 3 files changed, 4 insertions(+), 164 deletions(-)
doc/guides/prog_guide/power_man.rst +0 -94
@@ -107,100 +107,6 @@ User Cases The power management mechanism is used to save power when performing L3 forwarding. -Empty Poll API --------------- - -Removal Warning -~~~~~~~~~~~~~~~ - -The experimental empty poll API will be removed from the library -in a future DPDK release. -The empty poll mechanism is superseded by the power PMD modes -i.e. monitor, pause and scale. - - -Abstract -~~~~~~~~ - -For packet processing workloads such as DPDK polling is continuous. -This means CPU cores always show 100% busy independent of how much work -those cores are doing. It is critical to accurately determine how busy -a core is hugely important for the following reasons: - - * No indication of overload conditions - * User does not know how much real load is on a system, resulting - in wasted energy as no power management is utilized - -Compared to the original l3fwd-power design, instead of going to sleep -after detecting an empty poll, the new mechanism just lowers the core frequency. -As a result, the application does not stop polling the device, which leads -to improved handling of bursts of traffic. - -When the system become busy, the empty poll mechanism can also increase the core -frequency (including turbo) to do best effort for intensive traffic. This gives -us more flexible and balanced traffic awareness over the standard l3fwd-power -application. - - -Proposed Solution -~~~~~~~~~~~~~~~~~ -The proposed solution focuses on how many times empty polls are executed. -The less the number of empty polls, means current core is busy with processing -workload, therefore, the higher frequency is needed. The high empty poll number -indicates the current core not doing any real work therefore, we can lower the -frequency to safe power. - -In the current implementation, each core has 1 empty-poll counter which assume -1 core is dedicated to 1 queue. This will need to be expanded in the future to -support multiple queues per core. - -Power state definition: -^^^^^^^^^^^^^^^^^^^^^^^ - -* LOW: Not currently used, reserved for future use. - -* MED: the frequency is used to process modest traffic workload. - -* HIGH: the frequency is used to process busy traffic workload. - -There are two phases to establish the power management system: -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -* Training phase. This phase is used to measure the optimal frequency - change thresholds for a given system. The thresholds will differ from - system to system due to differences in processor micro-architecture, - cache and device configurations. - In this phase, the user must ensure that no traffic can enter the - system so that counts can be measured for empty polls at low, medium - and high frequencies. Each frequency is measured for two seconds. - Once the training phase is complete, the threshold numbers are - displayed, and normal mode resumes, and traffic can be allowed into - the system. These threshold number can be used on the command line - when starting the application in normal mode to avoid re-training - every time. - -* Normal phase. Every 10ms the run-time counters are compared - to the supplied threshold values, and the decision will be made - whether to move to a different power state (by adjusting the - frequency). - -API Overview for Empty Poll Power Management -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -* **State Init**: initialize the power management system. - -* **State Free**: free the resource hold by power management system. - -* **Update Empty Poll Counter**: update the empty poll counter. - -* **Update Valid Poll Counter**: update the valid poll counter. - -* **Set the Frequency Index**: update the power state/frequency mapping. - -* **Detect empty poll state change**: empty poll state change detection algorithm then take action. - -User Cases ----------- -The mechanism can applied to any device which is based on polling. e.g. NIC, FPGA. - Ethernet PMD Power Management API ---------------------------------
doc/guides/rel_notes/release_23_03.rst +4 -0
@@ -68,6 +68,10 @@ Removed Items Also, make sure to start the actual text at the margin. ======================================================= + * Removed the experimental empty poll API from the power library + The empty poll mechanism is superseded by the power PMD modes + i.e. monitor, pause and scale. + API Changes -----------
doc/guides/sample_app_ug/l3_forward_power_man.rst +0 -70
82 lines not on this page · raw message
Signature · 1 line
2.17.1
08/02/2023 11:48, David Hunt:
Quoted 12 lines
The empty poll mechanism was an experimental API added in commit id
450f0791312c. It aimed to allow power saving depending on the traffic profile. However, it required a training phase and required the user to adjust magic numbers depending on their workload.A new and improved mechanism was added in commit id
682a645438c5, also based on empty polls, implemented a callback mechanism which added 'monitor', 'pause' and 'scale' modes in l3fwd-power. This was and easier mechanism to use, so the original empty poll mechanism is no longer needed.
Quoted 8 lines
This patch set removes the experimental empty poll API, the empty poll mode from l3fwd-power, and related documentation.
This is based on a deprecation notice in the previous release.
[1/3] examples/power: remove empty poll mode from [2/3] libs/power: remove experimental empty poll API [3/3] doc/power: remove empty poll documentation
Squashed and applied, thanks.
PATCH 2/3 libs/power: remove experimental empty poll API
In reply to David HuntThis patchset removes the empty poll experimental API, which has been in an experimental state since it was added.
This API is no longer needed as it is superceded by the monitor/pause/scale callback mechanism.
--- lib/power/meson.build | 2 - lib/power/rte_power_empty_poll.c | 529 ------------------------------- lib/power/rte_power_empty_poll.h | 223 ------------- lib/power/version.map | 7 - 4 files changed, 761 deletions(-) delete mode 100644 lib/power/rte_power_empty_poll.c delete mode 100644 lib/power/rte_power_empty_poll.h
lib/power/meson.build +0 -2
@@ -19,13 +19,11 @@ sources = files( 'power_kvm_vm.c', 'power_pstate_cpufreq.c', 'rte_power.c', - 'rte_power_empty_poll.c', 'rte_power_intel_uncore.c', 'rte_power_pmd_mgmt.c', ) headers = files( 'rte_power.h', - 'rte_power_empty_poll.h', 'rte_power_intel_uncore.h', 'rte_power_pmd_mgmt.h', 'rte_power_guest_channel.h',
lib/power/rte_power_empty_poll.c deleted +0 -529
529 lines not on this page · raw message
lib/power/rte_power_empty_poll.h deleted +0 -223
223 lines not on this page · raw message
lib/power/version.map +0 -7
@@ -25,15 +25,8 @@ DPDK_23 { EXPERIMENTAL { global: - rte_empty_poll_detection; rte_power_check_env_supported; - rte_power_empty_poll_stat_fetch; - rte_power_empty_poll_stat_free; - rte_power_empty_poll_stat_init; - rte_power_empty_poll_stat_update; rte_power_guest_channel_receive_msg; - rte_power_poll_stat_fetch; - rte_power_poll_stat_update; # added in 21.02 rte_power_ethdev_pmgmt_queue_disable;
Signature · 1 line
2.17.1
RE: [PATCH v1 2/3] libs/power: remove experimental empty poll API
Quoted 5 lines
-----Original Message-----
From: David Hunt <[email protected]>
Subject: [PATCH v1 2/3] libs/power: remove experimental empty poll API
Typo: libs=>lib
Quoted 2 lines
This API is no longer needed as it is superceded by the monitor/pause/scale callback mechanism.
monitor/pause/scale => "PMD Power Management Mode monitor/pause/scale"
Rest of the changes looks ok.
Quoted 1 line
Signed-off-by David Hunt <[email protected]>
PATCH 3/3 doc/power: remove empty poll documentation
In reply to David HuntRemove the documentation for the removed experimental empty poll API, as it is no longer needed.
This API is no longer needed as it is superceded by the monitor/pause/scale callback mechanism.
--- doc/guides/prog_guide/power_man.rst | 94 ------------------- doc/guides/rel_notes/release_23_03.rst | 4 + .../sample_app_ug/l3_forward_power_man.rst | 70 -------------- 3 files changed, 4 insertions(+), 164 deletions(-)
doc/guides/prog_guide/power_man.rst +0 -94
@@ -107,100 +107,6 @@ User Cases The power management mechanism is used to save power when performing L3 forwarding. -Empty Poll API --------------- - -Removal Warning -~~~~~~~~~~~~~~~ - -The experimental empty poll API will be removed from the library -in a future DPDK release. -The empty poll mechanism is superseded by the power PMD modes -i.e. monitor, pause and scale. - - -Abstract -~~~~~~~~ - -For packet processing workloads such as DPDK polling is continuous. -This means CPU cores always show 100% busy independent of how much work -those cores are doing. It is critical to accurately determine how busy -a core is hugely important for the following reasons: - - * No indication of overload conditions - * User does not know how much real load is on a system, resulting - in wasted energy as no power management is utilized - -Compared to the original l3fwd-power design, instead of going to sleep -after detecting an empty poll, the new mechanism just lowers the core frequency. -As a result, the application does not stop polling the device, which leads -to improved handling of bursts of traffic. - -When the system become busy, the empty poll mechanism can also increase the core -frequency (including turbo) to do best effort for intensive traffic. This gives -us more flexible and balanced traffic awareness over the standard l3fwd-power -application. - - -Proposed Solution -~~~~~~~~~~~~~~~~~ -The proposed solution focuses on how many times empty polls are executed. -The less the number of empty polls, means current core is busy with processing -workload, therefore, the higher frequency is needed. The high empty poll number -indicates the current core not doing any real work therefore, we can lower the -frequency to safe power. - -In the current implementation, each core has 1 empty-poll counter which assume -1 core is dedicated to 1 queue. This will need to be expanded in the future to -support multiple queues per core. - -Power state definition: -^^^^^^^^^^^^^^^^^^^^^^^ - -* LOW: Not currently used, reserved for future use. - -* MED: the frequency is used to process modest traffic workload. - -* HIGH: the frequency is used to process busy traffic workload. - -There are two phases to establish the power management system: -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -* Training phase. This phase is used to measure the optimal frequency - change thresholds for a given system. The thresholds will differ from - system to system due to differences in processor micro-architecture, - cache and device configurations. - In this phase, the user must ensure that no traffic can enter the - system so that counts can be measured for empty polls at low, medium - and high frequencies. Each frequency is measured for two seconds. - Once the training phase is complete, the threshold numbers are - displayed, and normal mode resumes, and traffic can be allowed into - the system. These threshold number can be used on the command line - when starting the application in normal mode to avoid re-training - every time. - -* Normal phase. Every 10ms the run-time counters are compared - to the supplied threshold values, and the decision will be made - whether to move to a different power state (by adjusting the - frequency). - -API Overview for Empty Poll Power Management -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -* **State Init**: initialize the power management system. - -* **State Free**: free the resource hold by power management system. - -* **Update Empty Poll Counter**: update the empty poll counter. - -* **Update Valid Poll Counter**: update the valid poll counter. - -* **Set the Frequency Index**: update the power state/frequency mapping. - -* **Detect empty poll state change**: empty poll state change detection algorithm then take action. - -User Cases ----------- -The mechanism can applied to any device which is based on polling. e.g. NIC, FPGA. - Ethernet PMD Power Management API ---------------------------------
doc/guides/rel_notes/release_23_03.rst +4 -0
@@ -68,6 +68,10 @@ Removed Items Also, make sure to start the actual text at the margin. ======================================================= + * Removed the experimental empty poll API from the power library + The empty poll mechanism is superseded by the power PMD modes + i.e. monitor, pause and scale. + API Changes -----------
doc/guides/sample_app_ug/l3_forward_power_man.rst +0 -70
82 lines not on this page · raw message
Signature · 1 line
2.17.1
RE: [PATCH v1 3/3] doc/power: remove empty poll documentation
Quoted 4 lines
-----Original Message-----
From: David Hunt <[email protected]>
--snip--
Quoted 1 line
This API is no longer needed as it is superceded by the monitor/pause/scale
Nitpick.
monitor/pause/scale => "PMD Power Managment modes monitor/pause/scale"
Quoted 1 line
Signed-off-by David Hunt <[email protected]>