From mboxrd@z Thu Jan 1 00:00:00 1970 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) X-QQ-mid: bizesmtp13t1483928046tuk0ueon Received: from [10.0.112.23] (unknown [106.120.127.11]) by esmtp4.qq.com (ESMTP) with id ; Mon, 09 Jan 2017 10:14:03 +0800 (CST) X-QQ-SSF: 0010000000200090F870000A0000000 X-QQ-FEAT: MqxrXcXMQ8SHXNEbzEkWDxQZ4z8zNtYe1DGDlaZski7kAWUp9ndaQgno6h84H 2A8tw/dE65HyGY4y2IQ2uSMYlL1du8Zd2tXyMRgXEhoqndX9a9gok0OLmR7qB6+HdSYyhkj a2esGyORYk7xWt6OF2FYXn/N+NRv0YrJDzooNOC8b4CYwokICQ+K9TgsSe9VHp93+y5c+vv JVsDrD0gDpPD+Thsi8ppKp+yf82z4HAJUjVfchUPCHTzHFccmVyYkcYv/lfayfU2/HF6lEB 9z+jxQXof9JWsS+QNCf1sGPu4KUR9PuraRGQ== X-QQ-GoodBg: 0 From: nickcooper-zhangtonghao Message-Id: <36C737CB-D899-4969-8496-D6FC271752D4@opencloud.tech> Mime-Version: 1.0 (Mac OS X Mail 10.0 \(3226\)) Date: Mon, 9 Jan 2017 10:14:12 +0800 In-Reply-To: <20170105082633.48fc19df@xeon-e3> Cc: dev@dpdk.org To: Stephen Hemminger References: <1483617709-7088-1-git-send-email-nic@opencloud.tech> <20170105082633.48fc19df@xeon-e3> X-Mailer: Apple Mail (2.3226) X-QQ-SENDSIZE: 520 X-QQ-Bgrelay: 1 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v2 1/5] eal: Set numa node value for system which not support NUMA. 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: Mon, 09 Jan 2017 02:14:13 -0000 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);