All of lore.kernel.org
 help / color / mirror / Atom feed
From: Punit Agrawal <punitagrawal@gmail.com>
To: John Kacur <jkacur@redhat.com>
Cc: punit1.agrawal@toshiba.co.jp, linux-rt-users@vger.kernel.org
Subject: Re: [PATCH 1/5] rteval: systopology.py: Add support for systems that don't have Numa
Date: Mon, 13 Sep 2021 11:28:22 +0900	[thread overview]
Message-ID: <87zgsh9pkp.fsf@stealth> (raw)
In-Reply-To: <b79752f-2af5-cc3f-2738-326d1cfced40@redhat.com> (John Kacur's message of "Thu, 9 Sep 2021 08:34:56 -0400 (EDT)")

Hi John,

John Kacur <jkacur@redhat.com> writes:

> On Wed, 1 Sep 2021, Punit Agrawal wrote:
>
>> From: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
>> 
>> 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 <punit1.agrawal@toshiba.co.jp>
>> ---
>>  rteval/systopology.py | 38 ++++++++++++++++++++++++++++++++------
>>  1 file changed, 32 insertions(+), 6 deletions(-)
>> 
>> diff --git a/rteval/systopology.py b/rteval/systopology.py
>> index c61ec1a58514..7ce9a8c4f707 100644
>> --- a/rteval/systopology.py
>> +++ b/rteval/systopology.py
>> @@ -191,6 +191,31 @@ class NumaNode:
>>          """ return list of cpus for this node """
>>          return self.cpus.getcpulist()
>>  
>> +class FakeNumaNode(NumaNode):
>> +    """class representing a fake NUMA node. The fake NUMA node is used on
>> +    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(FakeNumaNode.cpupath, "possible"))
>> +        self.getmeminfo()
>> +
>> +    def getmeminfo(self):
>> +        self.meminfo = {}
>> +        for l in open(FakeNumaNode.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 +263,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] = FakeNumaNode()
>>  
>>      def getnodes(self):
>>          return list(self.nodes.keys())
>> -- 
>> 2.32.0
>> 
>> 
>
> This is quite clever. I am just going to rename Fake to Sim as short for 
> simulated, but other than that.
>
> Signed-off-by: John Kacur <jkacur@redhat.com>

Thanks for taking a look.

I'll take a look at the updates you sent and respond there as
appropriate.

Regards,
Punit

  reply	other threads:[~2021-09-13  2:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01  8:08 [PATCH 0/5] Enable rteval on Arm based systems Punit Agrawal
2021-09-01  8:08 ` [PATCH 1/5] rteval: systopology.py: Add support for systems that don't have Numa Punit Agrawal
2021-09-09 12:34   ` John Kacur
2021-09-13  2:28     ` Punit Agrawal [this message]
2021-09-01  8:08 ` [PATCH 2/5] rteval: cyclictest.py: Update logic to get core description Punit Agrawal
2021-09-09 12:41   ` John Kacur
2021-09-01  8:08 ` [PATCH 3/5] rteval: kernel.py: Add support for kthreads running with deadline policy Punit Agrawal
2021-09-09 12:47   ` John Kacur
2021-09-15  8:45     ` Punit Agrawal
2021-09-15 12:17       ` John Kacur
2021-09-16 11:34         ` Punit Agrawal
2021-09-01  8:08 ` [PATCH 4/5] rteval: hackbench.py: Enable running on a system with low memory Punit Agrawal
2021-09-09 12:46   ` John Kacur
2021-09-13  7:18     ` Punit Agrawal
2021-09-13 12:52       ` John Kacur
2021-09-14 18:32   ` John Kacur
2021-09-15  1:54     ` Punit Agrawal
2021-09-01  8:08 ` [PATCH 5/5] rteval: kcompile.py: Gracefully handle missing affinity information Punit Agrawal
2021-09-09 19:23   ` John Kacur

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zgsh9pkp.fsf@stealth \
    --to=punitagrawal@gmail.com \
    --cc=jkacur@redhat.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=punit1.agrawal@toshiba.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.