Skip to content

Commit

Permalink
examples/l3fwd-power: support traffic pattern aware control
Browse files Browse the repository at this point in the history
Add the support for new traffic pattern aware power control
power management API.

Example:
./l3fwd-power -l xxx   -n 4   -w 0000:xx:00.0 -w 0000:xx:00.1 -- -p 0x3
-P --config="(0,0,xx),(1,0,xx)" --empty-poll="0,0,0" -l 14 -m 9 -h 1

Please Reference l3fwd-power document for full parameter usage

The option "l", "m", "h" are used to set the power index for
LOW, MED, HIGH power state. Only is useful after enable empty-poll

--empty-poll="training_flag, med_threshold, high_threshold"

The option training_flag is used to enable/disable training mode.

The option med_threshold is used to indicate the empty poll threshold
of modest state which is customized by user.

The option high_threshold is used to indicate the empty poll threshold
of busy state which is customized by user.

Above three option default value is all 0.

Once enable empty-poll. System will apply the default parameter if no
other command line options are provided.

If training mode is enabled, the user should ensure that no traffic
is allowed to pass through the system. When training phase complete,
the application transfer to normal operation

System will start running with the modest power mode.
If the traffic goes above 70%, then system will move to High power state.
If the traffic drops below 30%, the system will fallback to the modest
power state.

Example code use master thread to monitoring worker thread busyness.
The default timer resolution is 10ms.

Signed-off-by: Liang Ma <liang.j.ma@intel.com>
Reviewed-by: Lei Yao <lei.a.yao@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
  • Loading branch information
Liang Ma authored and tmonjalo committed Oct 25, 2018
1 parent 450f079 commit a137d01
Show file tree
Hide file tree
Showing 4 changed files with 402 additions and 17 deletions.
69 changes: 69 additions & 0 deletions doc/guides/sample_app_ug/l3_forward_power_man.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ where,

* --no-numa: optional, disables numa awareness

* --empty-poll: Traffic Aware power management. See below for details

See :doc:`l3_forward` for details.
The L3fwd-power example reuses the L3fwd command line options.

Expand Down Expand Up @@ -362,3 +364,70 @@ The algorithm has the following sleeping behavior depending on the idle counter:
If a thread polls multiple Rx queues and different queue returns different sleep duration values,
the algorithm controls the sleep time in a conservative manner by sleeping for the least possible time
in order to avoid a potential performance impact.

Empty Poll Mode
-------------------------
Additionally, there is a traffic aware mode of operation called "Empty
Poll" where the number of empty polls can be monitored to keep track
of how busy the application is. Empty poll mode can be enabled by the
command line option --empty-poll.

See :doc:`Power Management<../prog_guide/power_man>` chapter in the DPDK Programmer's Guide for empty poll mode details.

.. code-block:: console
./l3fwd-power -l xxx -n 4 -w 0000:xx:00.0 -w 0000:xx:00.1 -- -p 0x3 -P --config="(0,0,xx),(1,0,xx)" --empty-poll="0,0,0" -l 14 -m 9 -h 1
Where,

--empty-poll: Enable the empty poll mode instead of original algorithm

--empty-poll="training_flag, med_threshold, high_threshold"

* ``training_flag`` : optional, enable/disable training mode. Default value is 0. If the training_flag is set as 1(true), then the application will start in training mode and print out the trained threshold values. If the training_flag is set as 0(false), the application will start in normal mode, and will use either the default thresholds or those supplied on the command line. The trained threshold values are specific to the user’s system, may give a better power profile when compared to the default threshold values.

* ``med_threshold`` : optional, sets the empty poll threshold of a modestly busy system state. If this is not supplied, the application will apply the default value of 350000.

* ``high_threshold`` : optional, sets the empty poll threshold of a busy system state. If this is not supplied, the application will apply the default value of 580000.

* -l : optional, set up the LOW power state frequency index

* -m : optional, set up the MED power state frequency index

* -h : optional, set up the HIGH power state frequency index

Empty Poll Mode Example Usage
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To initially obtain the ideal thresholds for the system, the training
mode should be run first. This is achieved by running the l3fwd-power
app with the training flag set to “1”, and the other parameters set to
0.

.. code-block:: console
./examples/l3fwd-power/build/l3fwd-power -l 1-3 -- -p 0x0f --config="(0,0,2),(0,1,3)" --empty-poll "1,0,0" –P
This will run the training algorithm for x seconds on each core (cores 2
and 3), and then print out the recommended threshold values for those
cores. The thresholds should be very similar for each core.

.. code-block:: console
POWER: Bring up the Timer
POWER: set the power freq to MED
POWER: Low threshold is 230277
POWER: MED threshold is 335071
POWER: HIGH threshold is 523769
POWER: Training is Complete for 2
POWER: set the power freq to MED
POWER: Low threshold is 236814
POWER: MED threshold is 344567
POWER: HIGH threshold is 538580
POWER: Training is Complete for 3
Once the values have been measured for a particular system, the app can
then be started without the training mode so traffic can start immediately.

.. code-block:: console
./examples/l3fwd-power/build/l3fwd-power -l 1-3 -- -p 0x0f --config="(0,0,2),(0,1,3)" --empty-poll "0,340000,540000" –P
3 changes: 3 additions & 0 deletions examples/l3fwd-power/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)

CFLAGS += -DALLOW_EXPERIMENTAL_API

build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)

Expand Down Expand Up @@ -54,6 +56,7 @@ please change the definition of the RTE_TARGET environment variable)
all:
else

CFLAGS += -DALLOW_EXPERIMENTAL_API
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)

Expand Down

0 comments on commit a137d01

Please sign in to comment.