Skip to content

Commit

Permalink
examples/eventdev: check CPU core enabling
Browse files Browse the repository at this point in the history
[ upstream commit 3d15913 ]

In the case that the cores are isolated, if "-l" or "-c" parameter is not
added, the cores will not be enabled and can not launch worker function
correctly. In the meanwhile, no error information is reported.

For example:
totally CPUs:16
isolated CPUs:1-8
command: sudo gdb -args ./dpdk-eventdev_pipeline --vdev event_sw0 \
        -- -r1 -t1 -e4 -w F00 -s4 -n0 -c32 -W1000 -D

cores information:
rte_config->lcore_role = {ROLE_RTE, ROLE_OFF, ROLE_OFF, ROLE_OFF,
                          ROLE_OFF, ROLE_OFF, ROLE_OFF, ROLE_OFF,
                          ROLE_OFF, ROLE_RTE, ROLE_RTE, ROLE_RTE,
                          ROLE_RTE, ROLE_RTE, ROLE_RTE, ROLE_RTE}

output information:
...
[main()] lcore 9 executing worker, using eventdev port 0
[main()] lcore 10 executing worker, using eventdev port 1
[main()] lcore 11 executing worker, using eventdev port 2

This is because "RTE_LCORE_FOREACH_WORKER" chooses the enabled core. In
the case that the cores are isolated, "the lcore_role" flag of isolated
cores are set as "ROLE_OFF" by default(not enabled). So if we choose
these isolated cores as workers, "RTE_LCORE_FOREACH_WORKER" will ignore
these cores and not launch worker functions on them.

To fix this, add "-l" parameters to doc and add lcore enabled check.

Fixes: 1094ca9 ("doc: add SW eventdev pipeline to sample app guide")

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
  • Loading branch information
Feifeiarm authored and bluca committed Feb 4, 2021
1 parent 4f4f0b0 commit d802206
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 3 additions & 2 deletions doc/guides/sample_app_ug/eventdev_pipeline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ options.
An example eventdev pipeline running with the software eventdev PMD using
these settings is shown below:

* ``-l 0,2,8-15``: lcore to use
* ``-r1``: core mask 0x1 for RX
* ``-t1``: core mask 0x1 for TX
* ``-e4``: core mask 0x4 for the software scheduler
Expand All @@ -46,8 +47,8 @@ these settings is shown below:

.. code-block:: console
./<build_dir>/examples/dpdk-eventdev_pipeline --vdev event_sw0 -- -r1 -t1 \
-e4 -w FF00 -s4 -n0 -c32 -W1000 -D
./<build_dir>/examples/dpdk-eventdev_pipeline -l 0,2,8-15 --vdev event_sw0 \
-- -r1 -t1 -e4 -w FF00 -s4 -n0 -c32 -W1000 -D
The application has some sanity checking built-in, so if there is a function
(e.g.; the RX core) which doesn't have a cpu core mask assigned, the application
Expand Down
9 changes: 8 additions & 1 deletion examples/eventdev_pipeline/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,15 @@ parse_app_args(int argc, char **argv)

if (fdata->worker_core[i])
cdata.num_workers++;
if (core_in_use(i))
if (core_in_use(i)) {
if (!rte_lcore_is_enabled(i)) {
printf("lcore %d is not enabled in lcore list\n",
i);
rte_exit(EXIT_FAILURE,
"check lcore params failed\n");
}
cdata.active_cores++;
}
}
}

Expand Down

0 comments on commit d802206

Please sign in to comment.