From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7BCD445DC0; Thu, 28 Nov 2024 17:09:08 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4BCB040663; Thu, 28 Nov 2024 17:09:08 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by mails.dpdk.org (Postfix) with ESMTP id 8BB1340653 for ; Thu, 28 Nov 2024 17:09:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732810147; x=1764346147; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=n6zC6saHCewrjBp901ZkKJq3pvDE5ADYgQfwec4gVTA=; b=bpQj9JewLt/bXR8n9BhxrmE8bPXZjVSugokoerrjfLREDJN5AimeWrGz F7IhPPqu/0F4h0gCsIwWwqfoWV6KHxibF6u4OgzPO5nFSb/AXg3USkWcV AxiKTDuF6D+926YO62vc8rfDXJ7EVOKZ7y1eczUI+3FOovGjCmHuT1hD0 yvyT+exZGTSfACLJvJfSMn0FB1GmzE4nf2rwBRiAvVT4BcvoMi5I9ZjRN N79Q666r0A5xehJProowoOjsPOaumH99oxCm7Ke/bIBICKDTAxsFdVy6j exWIeyfbkIz5vS4UVra8dbGXyijSdMRtyRn1o4S3mKgyy2Qc++epabhQh g==; X-CSE-ConnectionGUID: E+0WByHQRNWJsVuwio2fNA== X-CSE-MsgGUID: qohCXGNOQum2xH/8bu1XTA== X-IronPort-AV: E=McAfee;i="6700,10204,11270"; a="32417837" X-IronPort-AV: E=Sophos;i="6.12,192,1728975600"; d="scan'208";a="32417837" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Nov 2024 08:08:57 -0800 X-CSE-ConnectionGUID: pPEJz8gVSpq2GbJZOCri1Q== X-CSE-MsgGUID: 5YYnMwsSQGqGuVauMpnsDA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,192,1728975600"; d="scan'208";a="96708835" Received: from silpixa00401119.ir.intel.com ([10.55.129.167]) by fmviesa005.fm.intel.com with ESMTP; 28 Nov 2024 08:08:57 -0800 From: Anatoly Burakov To: dev@dpdk.org, Robin Jarry , Stephen Hemminger Subject: [PATCH v1 1/1] usertools/devbind: fix NUMA node display Date: Thu, 28 Nov 2024 16:08:55 +0000 Message-ID: <9af1231398c4ba116d3b89164690feace37293a9.1732810125.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.43.5 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On some systems, even though NUMA nodes may be present in sysfs, the lspci command will not have NUMANode keys in them, which will cause an exception. Fix to check if NUMANode keys are available in lspci output before enabling NUMA node output. Fixes: a7d69cef8f20 ("usertools/devbind: print device NUMA node") Signed-off-by: Anatoly Burakov --- usertools/dpdk-devbind.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py index 34f8f3ed3b..8a4aac371c 100755 --- a/usertools/dpdk-devbind.py +++ b/usertools/dpdk-devbind.py @@ -113,7 +113,16 @@ # check if this system has NUMA support def is_numa(): - return os.path.exists('/sys/devices/system/node') + if not os.path.exists("/sys/devices/system/node"): + return False + # occasionally, system may report NUMA support but lspci will not, so we + # want to go through all devices and see if any of them do not have NUMANode + # property - this will mean it is not safe to try to access it + for device_dict in devices.values(): + if "NUMANode" not in device_dict: + return False + # all checks passed + return True # check if a specific kernel module is loaded -- 2.43.5