From patchwork Thu Sep 9 13:03:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 508627 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58701C433F5 for ; Thu, 9 Sep 2021 14:26:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3995D6113A for ; Thu, 9 Sep 2021 14:26:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348312AbhIIO1N (ORCPT ); Thu, 9 Sep 2021 10:27:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345119AbhIIO1K (ORCPT ); Thu, 9 Sep 2021 10:27:10 -0400 Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C69AEC0005F6 for ; Thu, 9 Sep 2021 06:03:29 -0700 (PDT) Received: by mail-qt1-x830.google.com with SMTP id c19so1288633qte.7 for ; Thu, 09 Sep 2021 06:03:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=rfIgA3fd6KWq2QlzbV65DgJpIjqfTAm77OMGuCCqW58=; b=kgKBtvTdbcXCS37izPwYVOwKaYIGmXvygBPdvNAQWQkNa2HHRM4mAlWiYwGvVWIb7C XfOvQiZsMsoKQ5ixDojLNrejNysZARHIbtVrnIfdRfZCEvvD0C7KQGria25FVo5fy2/I L24z/27lQZif3weqWWySzkcGF3wh87iU2eKbVypeyFCqlqvLLdrURp4iK+0BO3cWOAOb ogxPeDGAqaeEVUd+p1PTiJoYppyWi/owX84/b2O97Ar2dOwP7Vzu7D0uhqSpAcjezzSL 3vYjCfvTn1EmzrxeM49FPKfiwHOUSXiQVqo1P+SXjnf9KG+cVGPmeOUh9IHbTWwURMby BSdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=rfIgA3fd6KWq2QlzbV65DgJpIjqfTAm77OMGuCCqW58=; b=0rcEtcAhANoEBrBLAEI/S4QqU65E2N8MCIHIdSR1WD2B1n3PX/w+u0fUD+6DFRR4vj N3EyWDC8GZqp8WHMixDDLwJuYsZ01lno3sfSRIQeGJeiyZzYb/6QFjyZb6ntzFMrARMd ohPszwrvNZv/SfjOifR0dbmGCsxYVRSGH/mtZI1uDktkLRFbZ+C9OsqZ4IIq2L3pV0IG Co1TvMySvUGWgrJk9o/nH17pdB7xycn9ve0BDrfFOqoT6FmvMQfVoc65ErhAFAB5B2oC CKsriasO1CoY+KBuxeObocCxfYwRVx4QZEf1DaINMp5EjqYtRXbQkKzmV26q5S6ZK3DC pZRQ== X-Gm-Message-State: AOAM531r8GSjWP5puSjz9wtrKoeTsHI84ZRmBNKYsy+ndSPVfOjyMQIN ZqCNc/8Csz4l0sdB6OKk+FfwfBjjp6o= X-Google-Smtp-Source: ABdhPJzarJowDnl0amV4trNIqx2GAes6CCPftROfKnmxAA4sIMBj0HMvu1vZ6AvWxIzJAR8mPKSeKQ== X-Received: by 2002:ac8:5c08:: with SMTP id i8mr2611475qti.314.1631192605907; Thu, 09 Sep 2021 06:03:25 -0700 (PDT) Received: from fionn.redhat.com (bras-base-rdwyon0600w-grc-09-184-147-143-99.dsl.bell.ca. [184.147.143.99]) by smtp.gmail.com with ESMTPSA id c4sm1284097qkf.122.2021.09.09.06.03.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 06:03:25 -0700 (PDT) Sender: John Kacur From: John Kacur To: RT , Clark Williams Cc: John Kacur Subject: [PATCH 1/3] rteval: Only process warnings if dmidecode_loaded is True Date: Thu, 9 Sep 2021 09:03:12 -0400 Message-Id: <20210909130314.6109-1-jkacur@redhat.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org If python-dmidecode is not available, then you can't test hasattr or you will get a NameError. Simply return instead. Signed-off-by: John Kacur Tested-by: Punit Agrawal --- rteval/sysinfo/dmi.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rteval/sysinfo/dmi.py b/rteval/sysinfo/dmi.py index bd397360096a..80cf3c723b36 100644 --- a/rteval/sysinfo/dmi.py +++ b/rteval/sysinfo/dmi.py @@ -42,6 +42,9 @@ except ModuleNotFoundError: def ProcessWarnings(): """ Process Warnings from dmidecode """ + if not dmidecode_loaded: + return + if not hasattr(dmidecode, 'get_warnings'): return From patchwork Thu Sep 9 13:03:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 508626 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECA3DC43219 for ; Thu, 9 Sep 2021 14:26:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D241B6115A for ; Thu, 9 Sep 2021 14:26:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348382AbhIIO1O (ORCPT ); Thu, 9 Sep 2021 10:27:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348113AbhIIO1K (ORCPT ); Thu, 9 Sep 2021 10:27:10 -0400 Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1057DC00668E for ; Thu, 9 Sep 2021 06:03:34 -0700 (PDT) Received: by mail-qt1-x829.google.com with SMTP id r21so1273422qtw.11 for ; Thu, 09 Sep 2021 06:03:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SUzgKjeanlGoA38GGK7XEQCJewPtQhN7SZ0sI8vDRC0=; b=qVjChd8tkke5oIGgzA5WhnsMoxhqkKK+e5ulf2f9e62AN4dKhHa5Og4HNoWxvbNbB9 OZw0qX61bBSfDjDw1x4FpJk9+slEQwY0r3vcNrzF6KnrtfAJL9aiQvbz02hp8NaFsKx3 PJcY8LGQT+ryOxsFY0Gt56tZtxoHhwc+3cKI70AQGEYaHpfa08WqzAg+tTuLnPxMDXaE XdWid/p19wePB+EigDWz9+l5ia32j9uR8Wt0q5BE+WYKjnbOeK1YBck7rMq00TigMIlX JtCicZJxfzB3tYh8PmphqGzKLmxMQeiuu3HYqkkF9P/HwYPFvO2j1b6twhMIJ22O5xVq k25Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=SUzgKjeanlGoA38GGK7XEQCJewPtQhN7SZ0sI8vDRC0=; b=iR/nuspXl9On1Cldb5/Z3Ogsn5zt3qPoatx6PFsI309CLffDMbFNNSulX1NNUSfHEE Q94ryf5AwrgO7yyp62DbZhHGLEQ9obg0+LPzyshGFuV4IUEmfMt6Nn9JiAHEczt66XfY Gp1FBOM3j8ieJH/+RkwXtdZw3KqE/hPmfJ+O9WjxKeU+7wrj4yLOzGbEMU59BWfptZkP w9cEZCGIgC4xbz3enmbcLTf6bBxronElW6N+vjT0/7M8PMDSJ8Ex7axPzSCnW7S/NuXM qhKmepa0/lG5nulKJpNnBo0uuv5zzI+SMiLgC4MtYakwEohnOv/3Rj5x/cLwMVGitFWJ vo5Q== X-Gm-Message-State: AOAM532yIKiW73LZcivvWQ9sJHl3aEEk3AH+E/N5w5LIF33yE4NZrIZC +G2FJfur8YU+7ISAxpBD9i0USOy7Mcw= X-Google-Smtp-Source: ABdhPJwkjqb0a4tvqDiDZA1zIM6wwDS3N4pOYNbQz82CPBIyqMA2rtXM5eAvrxUtT3z//D06/Rs2hA== X-Received: by 2002:a05:622a:2d1:: with SMTP id a17mr2624642qtx.236.1631192613130; Thu, 09 Sep 2021 06:03:33 -0700 (PDT) Received: from fionn.redhat.com (bras-base-rdwyon0600w-grc-09-184-147-143-99.dsl.bell.ca. [184.147.143.99]) by smtp.gmail.com with ESMTPSA id c4sm1284097qkf.122.2021.09.09.06.03.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 06:03:32 -0700 (PDT) Sender: John Kacur From: John Kacur To: RT , Clark Williams Cc: Punit Agrawal , John Kacur Subject: [PATCH 3/3] rteval: systopology.py: Add support for systems that don't have Numa Date: Thu, 9 Sep 2021 09:03:14 -0400 Message-Id: <20210909130314.6109-3-jkacur@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210909130314.6109-1-jkacur@redhat.com> References: <20210909130314.6109-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org From: Punit Agrawal Certain systems such as Arm v7 do not have support for Numa nodes, i.e., "/sys/devices/system/node*" does not exist. Instead of erroring out in this situation, it would be better if rteval could use alternate sources to get the system topology and memory information. Introduce the notion of a fake Numa node (as a class) which is used when no numa nodes are found on the system. Other than the constructor, it provides the same interface as the existing NumaNode class so existing users should work without any changes. Signed-off-by: Punit Agrawal - Renamed Fake to Sim for simulated Signed-off-by: John Kacur --- rteval/systopology.py | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/rteval/systopology.py b/rteval/systopology.py index c61ec1a58514..3c996048f8c1 100644 --- a/rteval/systopology.py +++ b/rteval/systopology.py @@ -191,6 +191,30 @@ class NumaNode: """ return list of cpus for this node """ return self.cpus.getcpulist() +class SimNumaNode(NumaNode): + """class representing a simulated NUMA node. + For systems which don't have NUMA enabled (no + /sys/devices/system/node) such as Arm v7 + """ + + cpupath = '/sys/devices/system/cpu' + mempath = '/proc/meminfo' + + def __init__(self): + self.nodeid = 0 + self.cpus = CpuList(sysread(SimNumaNode.cpupath, "possible")) + self.getmeminfo() + + def getmeminfo(self): + self.meminfo = {} + for l in open(SimNumaNode.mempath, "r"): + elements = l.split() + key = elements[0][0:-1] + val = int(elements[1]) + if len(elements) == 3 and elements[2] == "kB": + val *= 1024 + self.meminfo[key] = val + # # Class to abstract the system topology of numa nodes and cpus # @@ -238,12 +262,13 @@ class SysTopology: def getinfo(self): nodes = glob.glob(os.path.join(SysTopology.nodepath, 'node[0-9]*')) - if not nodes: - raise RuntimeError("No valid nodes found in %s!" % SysTopology.nodepath) - nodes.sort() - for n in nodes: - node = int(os.path.basename(n)[4:]) - self.nodes[node] = NumaNode(n) + if nodes: + nodes.sort() + for n in nodes: + node = int(os.path.basename(n)[4:]) + self.nodes[node] = NumaNode(n) + else: + self.nodes[0] = SimNumaNode() def getnodes(self): return list(self.nodes.keys())