Skip to contentSkip to conversation

doc: provide examples of using lcores EAL parameter

PATCH Superseded Bruce Richardson 2 participants 5 messages Apr 7, 2025 – May 2, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 doc: provide examples of using lcores EAL parameter

The "--lcores" EAL parameter has a very powerful syntax that can be used to provide precise control over lcore mappings. The docs however, only provided a minimal description of what it can do. Augment the docs by providing some examples of use of the option, and what the resulting core mappings would be.

---
 doc/guides/linux_gsg/eal_args.include.rst | 25 +++++++++++++++++++++++
 1 file changed, 25 insertions(+)
doc/guides/linux_gsg/eal_args.include.rst +25 -0
index 9cfbf7de84..081f09d353 100644
@@ -29,6 +29,31 @@ Lcore-related options
     The grouping ``()`` can be omitted for single element group.
     The ``@`` can be omitted if cpus and lcores have the same value.
 
+    Examples:
+
+    ``--lcores=1-3``: Run threads on physical CPUs 1, 2 and 3,
+    with each thread having the same lcore id as the physical CPU id.
+
+    ``--lcores=1@(1,2)``: Run a single thread with lcore id 1,
+    but with that thread bound to both physical CPUs 1 and 2,
+    so it can run on either, as determined by the operating system.
+
+    ``--lcores='1@31,2@32,3@33'``: Run threads having internal lcore ids of 1, 2 and 3,
+    but with the threads being bound to physical CPUs 31, 32 and 33.
+
+    ``--lcores='(1-3)@(31-33)'``: Run three threads with lcore ids 1, 2 and 3.
+    Unlike the previous example above,
+    each of these threads is not bound to one specific lcore,
+    but rather, all three threads are instead bound to the three physical cores 31, 32 and 33.
+
+    ``--lcores=(1-3)@20``: Run three threads, with lcore ids 1, 2 and 3,
+    where all three threads are bound to (can only run on) physical CPU 20.
+
+.. Note::
+    Binding multiple DPDK lcores can cause problems with poor performance or deadlock when using
+    DPDK rings or memory pools or spinlocks.
+    Such a configuration should only be used with care.
+
 .. Note::
     At a given instance only one core option ``--lcores``, ``-l`` or ``-c`` can
     be used.
Signature · 1 line
2.45.2
#1 lore raw
Quoted 31 lines · Bruce Richardson

The "--lcores" EAL parameter has a very powerful syntax that can be used to provide precise control over lcore mappings. The docs however, only provided a minimal description of what it can do. Augment the docs by providing some examples of use of the option, and what the resulting core mappings would be.

---
 doc/guides/linux_gsg/eal_args.include.rst | 25 +++++++++++++++++++++++
 1 file changed, 25 insertions(+)
doc/guides/linux_gsg/eal_args.include.rst +12 -0
index 9cfbf7de84..081f09d353 100644
@@ -29,6 +29,31 @@ Lcore-related options
     The grouping ``()`` can be omitted for single element group.
     The ``@`` can be omitted if cpus and lcores have the same value.
 
+    Examples:
+
+    ``--lcores=1-3``: Run threads on physical CPUs 1, 2 and 3,
+    with each thread having the same lcore id as the physical CPU id.
+
+    ``--lcores=1@(1,2)``: Run a single thread with lcore id 1,
+    but with that thread bound to both physical CPUs 1 and 2,
+    so it can run on either, as determined by the operating system.
+
+    ``--lcores='1@31,2@32,3@33'``: Run threads having internal lcore ids of 1, 2 and 3,
+    but with the threads being bound to physical CPUs 31, 32 and 33.
+

doc/guides/linux_gsg/eal_args.include.rst Lcore-related options · line 53

Quoted 10 lines
doc/guides/linux_gsg/eal_args.include.rst +10 -0
+    ``--lcores='(1-3)@(31-33)'``: Run three threads with lcore ids 1, 2 and 3.
+    Unlike the previous example above,
+    each of these threads is not bound to one specific lcore,
+    but rather, all three threads are instead bound to the three physical cores 31, 32 and 33.
+
+    ``--lcores=(1-3)@20``: Run three threads, with lcore ids 1, 2 and 3,
+    where all three threads are bound to (can only run on) physical CPU 20.
+
+.. Note::
+    Binding multiple DPDK lcores can cause problems with poor performance or deadlock when using

I seem to have missed some words here. :-(
V2 will be done soon. However, I will wait before sending it in case there is other feedback.

/Bruce

Quoted 9 lines
doc/guides/linux_gsg/eal_args.include.rst +3 -0
+    DPDK rings or memory pools or spinlocks.
+    Such a configuration should only be used with care.
+
 .. Note::
     At a given instance only one core option ``--lcores``, ``-l`` or ``-c`` can
     be used.
Signature · 1 line
2.45.2
Acked-by on v1 1/1
#2 lore raw
In reply to Bruce Richardson
Quoted 26 lines

From: Bruce Richardson [mailto:[email protected]]
Sent: Monday, 7 April 2025 15.25

The "--lcores" EAL parameter has a very powerful syntax that can be used
to provide precise control over lcore mappings. The docs however, only provided a minimal description of what it can do. Augment the docs by providing some examples of use of the option, and what the resulting core mappings would be.

---
 doc/guides/linux_gsg/eal_args.include.rst | 25 +++++++++++++++++++++++
 1 file changed, 25 insertions(+)
doc/guides/linux_gsg/eal_args.include.rst +2 -0
index 9cfbf7de84..081f09d353 100644
@@ -29,6 +29,31 @@ Lcore-related options
     The grouping ``()`` can be omitted for single element group.
     The ``@`` can be omitted if cpus and lcores have the same value.
 
+    Examples:
+

doc/guides/linux_gsg/eal_args.include.rst Lcore-related options · line 43

Quoted 10 lines
doc/guides/linux_gsg/eal_args.include.rst +9 -0
+    ``--lcores=1-3``: Run threads on physical CPUs 1, 2 and 3,
+    with each thread having the same lcore id as the physical CPU id.
+
+    ``--lcores=1@(1,2)``: Run a single thread with lcore id 1,
+    but with that thread bound to both physical CPUs 1 and 2,
+    so it can run on either, as determined by the operating system.
+
+    ``--lcores='1@31,2@32,3@33'``: Run threads having internal lcore
 ids of 1, 2 and 3,
+    but with the threads being bound to physical CPUs 31, 32 and 33.

Maybe add "respectively": "[...] bound to respectively physical CPUs [...]".

doc/guides/linux_gsg/eal_args.include.rst Lcore-related options · line 46

Quoted 5 lines
doc/guides/linux_gsg/eal_args.include.rst +2 -0
+
+    ``--lcores='(1-3)@(31-33)'``: Run three threads with lcore ids 1,

2 and 3.

doc/guides/linux_gsg/eal_args.include.rst +2 -0
+    Unlike the previous example above,
+    each of these threads is not bound to one specific lcore,

lcore -> physical CPU

Quoted 2 lines

+ but rather, all three threads are instead bound to the three
physical cores 31, 32 and 33.

cores -> CPUs

Quoted 9 lines
doc/guides/linux_gsg/eal_args.include.rst +2 -0
+
+    ``--lcores=(1-3)@20``: Run three threads, with lcore ids 1, 2 and

3,
+ where all three threads are bound to (can only run on) physical
CPU 20.

doc/guides/linux_gsg/eal_args.include.rst +3 -0
+
+.. Note::
+    Binding multiple DPDK lcores can cause problems with poor

performance or deadlock when using

"[...] multiple DPDK lcores can cause problems [...]" ->
"[...] multiple DPDK lcores to the same physical CPU can cause problems [...]"

Quoted 9 lines
doc/guides/linux_gsg/eal_args.include.rst +3 -0
+    DPDK rings or memory pools or spinlocks.
+    Such a configuration should only be used with care.
+
 .. Note::
     At a given instance only one core option ``--lcores``, ``-l`` or

``-c`` can
be used.
--
2.45.2

With above changes,

#3 lore raw

PATCH v2 1/1 doc: provide examples of using lcores EAL parameter

In reply to Bruce Richardson

The "--lcores" EAL parameter has a very powerful syntax that can be used to provide precise control over lcore mappings. The docs however, only provided a minimal description of what it can do. Augment the docs by providing some examples of use of the option, and what the resulting core mappings would be.

---
 doc/guides/linux_gsg/eal_args.include.rst | 27 +++++++++++++++++++++++
 1 file changed, 27 insertions(+)
doc/guides/linux_gsg/eal_args.include.rst +27 -0
index 9cfbf7de84..aafe567bfa 100644
@@ -29,6 +29,33 @@ Lcore-related options
     The grouping ``()`` can be omitted for single element group.
     The ``@`` can be omitted if cpus and lcores have the same value.
 
+    Examples:
+
+    ``--lcores=1-3``: Run threads on physical CPUs 1, 2 and 3,
+    with each thread having the same lcore id as the physical CPU id.
+
+    ``--lcores=1@(1,2)``: Run a single thread with lcore id 1,
+    but with that thread bound to both physical CPUs 1 and 2,
+    so it can run on either, as determined by the operating system.
+
+    ``--lcores='1@31,2@32,3@33'``: Run threads having internal lcore ids of 1, 2 and 3,
+    but with the threads being bound to physical CPUs 31, 32 and 33 respectively.
+
+    ``--lcores='(1-3)@(31-33)'``: Run three threads with lcore ids 1, 2 and 3.
+    Unlike the previous example above,
+    each of these threads is not bound to one specific physical CPU,
+    but rather, all three threads are instead bound to the three physical CPUs 31, 32 and 33.
+    This means that each of the three threads can move between the physical CPUs 31-33,
+    as decided by the OS as the application runs.
+
+    ``--lcores=(1-3)@20``: Run three threads, with lcore ids 1, 2 and 3,
+    where all three threads are bound to (can only run on) physical CPU 20.
+
+.. Note::
+    Binding multiple DPDK lcores to a single physical CPU can cause problems with poor performance
+    or deadlock when using DPDK rings or memory pools or spinlocks.
+    Such a configuration should only be used with care.
+
 .. Note::
     At a given instance only one core option ``--lcores``, ``-l`` or ``-c`` can
     be used.
Signature · 1 line
2.45.2
#4 lore raw
Quoted 6 lines · Bruce Richardson

The "--lcores" EAL parameter has a very powerful syntax that can be used to provide precise control over lcore mappings. The docs however, only provided a minimal description of what it can do. Augment the docs by providing some examples of use of the option, and what the resulting core mappings would be.

Quoted 6 lines
---
 doc/guides/linux_gsg/eal_args.include.rst | 27 +++++++++++++++++++++++
 1 file changed, 27 insertions(+)

This patch has now been rolled into the wider set of changes for CPU coremask flags[1].

/Bruce

[1] https://patches.dpdk.org/project/dpdk/list/?series=35137&state=*