From mboxrd@z Thu Jan 1 00:00:00 1970 From: nickcooper-zhangtonghao Subject: Re: [PATCH v2 1/5] eal: Set numa node value for system which not support NUMA. Date: Mon, 9 Jan 2017 10:14:12 +0800 Message-ID: <36C737CB-D899-4969-8496-D6FC271752D4@opencloud.tech> References: <1483617709-7088-1-git-send-email-nic@opencloud.tech> <20170105082633.48fc19df@xeon-e3> Mime-Version: 1.0 (Mac OS X Mail 10.0 \(3226\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: dev@dpdk.org To: Stephen Hemminger Return-path: Received: from smtpbgsg2.qq.com (smtpbgsg2.qq.com [54.254.200.128]) by dpdk.org (Postfix) with ESMTP id E1C071E2B for ; Mon, 9 Jan 2017 03:14:12 +0100 (CET) In-Reply-To: <20170105082633.48fc19df@xeon-e3> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Thanks for your reply. The patch you submitted is better. Thanks for = your improvement. My legal name is =E2=80=9CNick Zhang=E2=80=9D. So, Signed-off-by: Nick Zhang Thanks. Nick > On Jan 6, 2017, at 12:26 AM, Stephen Hemminger = wrote: >=20 > It is good to see more checking for valid values. I suspect that = other systems > may have the same problem. My preference would to have the code = comment generic > and to have the precise details of about where this was observed in = the commit > log.=20 >=20 > The following would do same thing but be simpler: >=20 > diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c = b/lib/librte_eal/linuxapp/eal/eal_pci.c > index 43501342..9f09cd98 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_pci.c > +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c > @@ -306,19 +306,12 @@ pci_scan_one(const char *dirname, uint16_t = domain, uint8_t bus, > dev->max_vfs =3D (uint16_t)tmp; > } >=20 > - /* get numa node */ > + /* get numa node, default to 0 if not present */ > snprintf(filename, sizeof(filename), "%s/numa_node", > dirname); > - if (access(filename, R_OK) !=3D 0) { > - /* if no NUMA support, set default to 0 */ > - dev->device.numa_node =3D 0; > - } else { > - if (eal_parse_sysfs_value(filename, &tmp) < 0) { > - free(dev); > - return -1; > - } > + if (eal_parse_sysfs_value(filename, &tmp) =3D=3D 0 && > + tmp < RTE_MAX_NUMA_NODES) > dev->device.numa_node =3D tmp; > - } >=20 > /* parse resources */ > snprintf(filename, sizeof(filename), "%s/resource", dirname);