devlink: Introduce cpu_affinity command
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest4 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | net netlink: Introduce NLA_BITFIELD typeinclude/ include/ lib/ +1 more | +185 | 0 replies | |
| 2/4 | devlink: Add support for NLA_BITFIELD for devlink paraminclude/ net/ | +139 | 0 replies | |
| 3/4 | devlink: Add new cpu_affinity generic device paramDocumentation/ include/ net/ | +14 | 0 replies | |
| 4/4 | net/mlx5: Support cpu_affinity devlink dev paramDocumentation/ drivers/ drivers/ +4 more | +256 | 0 replies |
Reviews trailers per patch
3 of 4 patches have a Reviewed-by or Acked-by.
| Patch | Moshe Shemesh |
|---|---|
| 1/4 | R-b |
| 2/4 | R-b |
| 3/4 | |
| 4/4 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH net-next 0/4] devlink: Introduce cpu_affinity command
Currently a user can only configure the IRQ CPU affinity of a device via the global /proc/irq/../smp_afinity interface, however this interface changes the affinity globally across all subsystems connected to the device.
Historically, this API is useful for single function devices since, generally speaking, the queue structure created on top of the IRQ vectors is predictable enough that this control is usable.
However, with complex multi-subsystem devices, like mlx5, the assignment of queues at every layer throughout the software stack is complex and there are multiple queues, each for different usage, over the same IRQ. Hence, a simple fiddling of the base IRQ is no longer effective.
As an example mlx5 SF's can share MSI-X IRQ between themselves, which means that currently user doesn't have control over which SF to use which CPU set. Hence, an application and IRQ can run on different CPUs, which leads to lower performance, as shown in the bellow table.
application=netperf, SF-IRQ channel affinity latecy(usec)
(lower is better)
cpu=0 (numa=0) cpu={0} cpu={0} 14.417
cpu=8 (numa=0) cpu={0} cpu={0} 15.114 (+5%)
cpu=1 (numa=1) cpu={0} cpu={0} 17.784 (+30%)This series is a start at resolving this problem by inverting the control of the affinities. Instead of having the user go around behind the driver and adjusting the IRQs the driver already created we want to have the user tell the software layer what CPUs to use and the software layer will manage this. The suggested command will then trickle down to the PCI driver which will create/share MSI-X IRQs and resources to achieve it. In the mlx5 SF example the involved software components would be devlink, rdma, vdpa and netdev.
This series introduces a devlink control that assigns a CPU set to the cross-subsystem mlx5_core PCI function device. This can be used either on PF, VF or SF and restricts all the software layers above it to the given CPU set.
For specified CPU, SF either uses an existing IRQ affiliated to the CPU or a new IRQ available from the device. For example if user gives affinity 3 (11 in binary), SF will create driver internal required completion EQ, attached to these specific CPU's IRQ.
If SF is already fully probed, devlink reload is required for cpu_affinity to take effect.
The following command sets the affinity of mlx5 PF/VF/SF. devlink command structure:
$ devlink dev param set auxiliary/mlx5_core.sf.4 name cpu_affinity value \
[cpu_bitmask] cmode driverinitApplications that want to restrict a SF or VF HW to a CPU set, for instance container workloads, can make use of this API to easily achieve it.
Shay Drory (4):
net netlink: Introduce NLA_BITFIELD type
devlink: Add support for NLA_BITFIELD for devlink param
devlink: Add new cpu_affinity generic device param net/mlx5: Support cpu_affinity devlink dev param
.../networking/devlink/devlink-params.rst | 5 + Documentation/networking/devlink/mlx5.rst | 3 + .../net/ethernet/mellanox/mlx5/core/devlink.c | 123 +++++++++++++++ .../net/ethernet/mellanox/mlx5/core/devlink.h | 2 + drivers/net/ethernet/mellanox/mlx5/core/eq.c | 39 +++++ .../ethernet/mellanox/mlx5/core/mlx5_core.h | 2 + .../ethernet/mellanox/mlx5/core/mlx5_irq.h | 5 +- .../net/ethernet/mellanox/mlx5/core/pci_irq.c | 85 +++++++++- include/net/devlink.h | 22 +++ include/net/netlink.h | 30 ++++ include/uapi/linux/netlink.h | 10 ++ lib/nlattr.c | 145 +++++++++++++++++- net/core/devlink.c | 143 +++++++++++++++-- net/netlink/policy.c | 4 + 14 files changed, 594 insertions(+), 24 deletions(-)
Signature · 1 line
2.21.3