From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt0-f169.google.com (mail-qt0-f169.google.com [209.85.216.169]) by dpdk.org (Postfix) with ESMTP id A92FF1B1C8 for ; Wed, 9 May 2018 19:08:20 +0200 (CEST) Received: by mail-qt0-f169.google.com with SMTP id m9-v6so25835887qtb.5 for ; Wed, 09 May 2018 10:08:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bigswitch-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=Hq70k537nentgRDeLSmT/b+twat+F7YX/215FO95z8Y=; b=uu3veHgfiZm1XYCxVO6Z3V8157aRRy9Po7OOwLenW9AQdPTviv849hDBHfbus3vZ+l NMtanqf4CBjybOkK4tBYnOFmJjFMO+NRZdwlvhDztUG4Tf+dPjvRfnEFiUobV3lrD0I4 MXcSh4wyY932RfR4vGNpRKjFTfs5Ein6+nf5WuAzmke/YKPzTlqwT74FWSJ5OpDuv/ZY 8Lai5BkXCu47hkxRr7rqOX+ei/jcHsHoZZZ8q2f9nlCgqllEbhem5Hnx1T5Tez79f1MW TPvw4kbXKGeHDMXj0Zu686RX54zBP2Cl5VTVIb9bepaHaavoC9c1/2Hclxra6FR6GQdU jrGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Hq70k537nentgRDeLSmT/b+twat+F7YX/215FO95z8Y=; b=p0JQrEuMqpjIDvJXswtwucmHfu2VGUkhSwCjymGVc9y1RravXyaRE2sNLsBIa9JXQC 3AkucfUxnwT/MZdkuiOVfSCdR0BunEdhIuAtjVLsODk50x/PMoIy2150hTh2qhydV0jF mq1pblvhcv/J9+XqPLHHMm6/Us9jcFNzrNtRJubVP6Cvh1lcVOxwy+beJDB+hQIrWUU8 PvbgICrSO7t8Uxj3V+NXOO7E9E1/l/pnQd96kg1e49xngyImkhMi2fdMTNLc+pOj9Ib1 zvZMdJzqu3MqmZfog06/2pInA7X/mo8UYj7ViQQQfH83qRKM5QbVxnL/XKNIGu2SFoGw U8SA== X-Gm-Message-State: ALQs6tBxUYOC+wavfqVKyez/ZBDo2iqJJ6ILlp5IH/MXaUIgUISa2jhP PAam/1mn+uyKEO4VC79XfnJhHLZxdwc2S6kqJ98Uo8IWOMw= X-Google-Smtp-Source: AB8JxZrA8hcaSIXFrY781/vovx//Nwx2+FYcw2JC1k6wICT2UEKF2r5h8gw8JJDKvx+QrmDfBGGtcPWnhyMaV+81wsc= X-Received: by 2002:aed:2605:: with SMTP id z5-v6mr44094619qtc.72.1525885699678; Wed, 09 May 2018 10:08:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.247.193 with HTTP; Wed, 9 May 2018 10:08:19 -0700 (PDT) From: Mike Stolarchuk Date: Wed, 9 May 2018 10:08:19 -0700 Message-ID: To: dev@dpdk.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-dev] rte_eth_dev_socket_id() vs KVM/AWS/... X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2018 17:08:20 -0000 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//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 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//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.