Bug 1525039

Summary: Virtio PMD: Allocate rings memory on same NUMA node the Virtio device is
Product: Red Hat Enterprise Linux 8 Reporter: Maxime Coquelin <maxime.coquelin>
Component: dpdkAssignee: Maxime Coquelin <maxime.coquelin>
Status: CLOSED ERRATA QA Contact: Pei Zhang <pezhang>
Severity: medium Docs Contact:
Priority: medium    
Version: ---CC: aadam, ailan, akaris, atheurer, atragler, jasowang, jhsiao, jmaxwell, ktraynor, maxime.coquelin, ovs-qe, pezhang, pveiga, tredaelli
Target Milestone: pre-dev-freezeKeywords: Extras
Target Release: 8.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dpdk-18.11-8.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-05 20:59:24 UTC Type: Feature Request
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1682308, 1738635    
Bug Blocks: 1679810, 1689408, 1701002    
Attachments:
Description Flags
Guest XML example with one Virtio-net device per NUMA node
none
Guest XML. none

Description Maxime Coquelin 2017-12-12 14:02:45 UTC
Created attachment 1366669 [details]
Guest XML example with one Virtio-net device per NUMA node

Description of problem:

Currently, in DPDK's Virtio PMD driver, the rings memory is allocated with SOCKET_ID_ANY parameter for NUMA affinity.
It turns out the rings memory will always be allocated on the same NUMA node of the CPU running the Virtio PMD probe, which is not always on the same NUMA node than the CPUs doing the device polling.

In case of big guests spanned on multiple hosts NUMA nodes (CPU, memory), the user may want to spread multiple Virtio devices on the different NUMA nodes, so that host and guest CPUs and memory used for one device are on a same NUMA node.

It is possible to set Virtio-pci device NUMA affinity by adding PCI eXpander Bridges (PXB) between the root port and the devices, but DPDK Virtio PMD does not use it to allocate the rings memory.

The goal of this ticket is to have Virtio PMD to allocate rings memory on the same node as the probed device.

Version-Release number of selected component (if applicable):
all DPDK version (up to v17.11)

How reproducible:

Steps to Reproduce:
Create a guest spanned on two host NUMA nodes and two Virtio device using vhost-user backend connected to OVS-DPDK .

The guest also create two NUMA nodes and assign memory and CPUs to it, and assign each Virtio device on a different NUMA node using PXB.

Once guest is booted, bind the two Virtio devices to vfio-pci, and start testpmd using these two devices.

On host side, check on which NUMA node the vhost ports are:
ovs-appctl dpif-netdev/pmd-rxq-show

Actual results:
The two vhost ports are on the same NUMA node

Expected results:
The two vhost ports are on different NUMA nodes

Additional info:

Please find in attachment an example of guest declaring 2 NUMA nodes pinned to 2 host NUMA nodes, with one virtio-net device on each node.

Comment 8 Maxime Coquelin 2018-11-27 10:55:22 UTC
Patch posted upstream: http://patches.dpdk.org/patch/48349/

Comment 10 Maxime Coquelin 2019-03-12 20:16:27 UTC
Backport available.

Branch: private-mcoqueli-bz1525039

Comment 16 Jean-Tsung Hsiao 2019-08-20 19:25:53 UTC
Hi Pei,
This issue is on the VM side. Would you be able to take care of the bug verification?
Thanks!
Jean

Comment 17 Pei Zhang 2019-08-21 05:21:23 UTC
(In reply to Jean-Tsung Hsiao from comment #16)
> Hi Pei,
> This issue is on the VM side. Would you be able to take care of the bug
> verification?
> Thanks!
> Jean

Hi Jean,

OK, I'm taking it and will verify it soon.

Best regards,

Pei

Comment 19 Pei Zhang 2019-09-06 08:50:51 UTC
== Steps:

1. Boot guest with 2 NUMA nodes using 2 pcie-expander-bus, and put 2 vhost-user ports to each of them.

2. In guest, start testpmd.

3. Check vhost-user port numa node.

== Reproduced with dpdk-18.11-3.el8.x86_64: 

After step3, all 2 vhost-user ports are in numa node 1.

# ovs-appctl dpif-netdev/pmd-rxq-show
pmd thread numa_id 1 core_id 21:
  isolated : false
pmd thread numa_id 0 core_id 28:
  isolated : false
  port: dpdk0             queue-id:  0  pmd usage: 10 %
  port: dpdk1             queue-id:  0  pmd usage: 14 %
  port: vhost-user0       queue-id:  0  pmd usage: 12 %
  port: vhost-user0       queue-id:  1  pmd usage:  0 %
  port: vhost-user1       queue-id:  0  pmd usage:  8 %
  port: vhost-user1       queue-id:  1  pmd usage:  0 %


== Verified with dpdk-18.11-8.el8.x86_64:

# ovs-appctl dpif-netdev/pmd-rxq-show
pmd thread numa_id 1 core_id 21:
  isolated : false
  port: vhost-user1       queue-id:  0  pmd usage:  0 %
  port: vhost-user1       queue-id:  1  pmd usage:  0 %
pmd thread numa_id 0 core_id 28:
  isolated : false
  port: dpdk0             queue-id:  0  pmd usage:  8 %
  port: dpdk1             queue-id:  0  pmd usage:  8 %
  port: vhost-user0       queue-id:  0  pmd usage:  0 %
  port: vhost-user0       queue-id:  1  pmd usage:  0 %


So this bug has been fixed very well.

Comment 20 Pei Zhang 2019-09-06 08:52:07 UTC
Created attachment 1612249 [details]
Guest XML.

Comment 21 Pei Zhang 2019-09-06 08:59:19 UTC
Move to 'VERIFIED' as Comment 19 and Comment 20.

More details: We need to reserve hugepage for both NUMA node 0 and NUMA node 1 in guest.

Comment 23 errata-xmlrpc 2019-11-05 20:59:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:3394