DPDK patches and discussions
 help / color / mirror / Atom feed
From: Mike Stolarchuk <mike.stolarchuk@bigswitch.com>
To: dev@dpdk.org
Subject: [dpdk-dev] rte_eth_dev_socket_id() vs KVM/AWS/...
Date: Wed, 9 May 2018 10:08:19 -0700	[thread overview]
Message-ID: <CA+Qp4XxCa98-3YtVmLzRywgS4CpBqanqhJEnwj0VJZyQbBAQHQ@mail.gmail.com> (raw)

Hello Dpdk,

rte_eth_dev_socket_id() describes a -1 return value as:

*Returns*

The NUMA socket id to which the Ethernet device is connected or a default
of zero if the socket could not be determined. -1 is returned is the
port_id value is out of range.

But, rte_eth_dev_socket_id() is implemented as:

int
rte_eth_dev_socket_id(uint16_t port_id)
{
    RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -1);
    return rte_eth_devices[port_id].data->numa_node;
}

And numa_node here is set from /sys/bus/pci/<device>/numa_node.
And https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-pci
documents numa_node as:

What: /sys/bus/pci/devices/.../numa_node
Date: Oct 2014
Contact: Prarit Bhargava <prarit@redhat.com>
Description:
This file contains the NUMA node to which the PCI device is
attached, or -1 if the node is unknown.  The initial value
comes from an ACPI _PXM method or a similar firmware
source.  If that is missing or incorrect, this file can be
written to override the node.  In that case, please report
a firmware bug to the system vendor.  Writing to this file
taints the kernel with TAINT_FIRMWARE_WORKAROUND, which
reduces the supportability of your system.

in other words, a value of -1 for numa_node means the association of the
pci device WRT socket is unknown.
And as an example, in a KVM with e1000's.
/sys/bus/pci/devices/<d>/numa_node can return -1.

This means that rte_eth_dev_socket_id() returns -1 in situations other than
'port_id value is out of range'.
And its not possible to identify whether the port_id is invalid, or whether
the base system didn't
announce the numa_node association.

Perhaps a -1 return value should be an indication the the numa_node
association isn't known,
and a different return value, say -2, should indicate the port_id value is
out of range.


mts.

             reply	other threads:[~2018-05-09 17:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-09 17:08 Mike Stolarchuk [this message]
2018-05-14  8:09 ` Burakov, Anatoly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+Qp4XxCa98-3YtVmLzRywgS4CpBqanqhJEnwj0VJZyQbBAQHQ@mail.gmail.com \
    --to=mike.stolarchuk@bigswitch.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).