kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amos Kong <akong@redhat.com>
To: lmr@redhat.com, autotest@test.kernel.org
Cc: kvm@vger.kernel.org
Subject: [Autotest PATCH v2 3/4] netperf: pin guest vcpus/memory/vhost thread	to numa node
Date: Thu, 05 Jan 2012 11:06:14 +0800	[thread overview]
Message-ID: <20120105030614.8563.65894.stgit@dhcp-8-167.nay.redhat.com> (raw)
In-Reply-To: <20120105030456.8563.65512.stgit@dhcp-8-167.nay.redhat.com>

Dynamically checking hardware and pin guest cpu threads and
guest memory to last numa node

Changes from v1:
- assign numanode to -1 for netperf test

Signed-off-by: Amos Kong <akong@redhat.com>
---
 client/virt/subtests.cfg.sample |    1 +
 client/virt/tests/netperf.py    |   19 ++++++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/client/virt/subtests.cfg.sample b/client/virt/subtests.cfg.sample
index fc2621d..7687887 100644
--- a/client/virt/subtests.cfg.sample
+++ b/client/virt/subtests.cfg.sample
@@ -1012,6 +1012,7 @@ variants:
         # sessions_rr = "50 100 250 500"
         # sizes = "64 256 512 1024"
         # sizes_rr = "64 256 512 1024"
+        numa_node = -1
         variants:
             - guest_guest:
                 vms += " vm2"
diff --git a/client/virt/tests/netperf.py b/client/virt/tests/netperf.py
index fd037df..7a27a93 100644
--- a/client/virt/tests/netperf.py
+++ b/client/virt/tests/netperf.py
@@ -25,6 +25,20 @@ def run_netperf(test, params, env):
     server_ctl = vm.get_address(1)
     session.close()
 
+    logging.debug(commands.getoutput("numactl --hardware"))
+    logging.debug(commands.getoutput("numactl --show"))
+    # pin guest vcpus/memory/vhost threads to last numa node of host by default
+    numa_node = int(params.get('numa_node', -1))
+    p = virt_utils.NumaNode(numa_node)
+    node_num = int(p.get_node_num())
+    vhost_threads = commands.getoutput("ps aux |grep '\[vhost-.*\]'|grep -v grep|awk '{print $2}'")
+    for i in vhost_threads.split():
+        logging.debug("pin vhost_net thread(%s) to host cpu node" % i)
+        p.pin_cpu(i)
+    o = vm.monitor.info("cpus")
+    for i in re.findall("thread_id=(\d+)", o):
+        p.pin_cpu(i)
+
     if "vm2" in params["vms"]:
         vm2 = env.get_vm("vm2")
         vm2.verify_alive()
@@ -198,7 +212,10 @@ def launch_client(sessions, server, server_ctl, host, client, l, nf_args):
         return [nrx, ntx, nrxb, ntxb, nre, nrx_intr, ntx_intr, io_exit, irq_inj]
 
     def netperf_thread(i):
-        cmd = "%s -H %s -l %s %s" % (client_path, server, l, nf_args)
+        output = ssh_cmd(client, "numactl --hardware")
+        n = int(re.findall("available: (\d+) nodes", output)[0]) - 1
+        cmd = "numactl --cpunodebind=%s --membind=%s %s -H %s -l %s %s" % \
+                                    (n, n, client_path, server, l, nf_args)
         output = ssh_cmd(client, cmd)
         f = file("/tmp/netperf.%s.%s.nf" % (pid, i), "w")
         f.write(output)

  parent reply	other threads:[~2012-01-05  3:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-23 10:28 [RFC PATCH 0/4] Network performance regression Amos Kong
2011-12-23 10:28 ` [RFC PATCH 1/4] virt-test: add NTttcp subtests Amos Kong
2011-12-23 10:28 ` [RFC PATCH 2/4] virt-test: Refactor netperf test and add analysis module Amos Kong
2011-12-23 10:28 ` [RFC PATCH 3/4] netperf: pin guest vcpus/memory/vhost thread to numa node Amos Kong
2011-12-23 10:28 ` [RFC PATCH 4/4] virt: Introduce regression testing infrastructure Amos Kong
2011-12-24  1:13   ` Yang Hamo Bai
2011-12-25  1:26     ` Amos Kong
2011-12-29 13:12 ` [RFC PATCH 0/4] Network performance regression Amos Kong
2012-01-05  3:05 ` [Autotest PATCH v2 " Amos Kong
2012-01-05  3:05   ` [Autotest PATCH v2 1/4] virt-test: add NTttcp subtests Amos Kong
2012-01-05  3:06   ` [Autotest PATCH v2 2/4] virt-test: Refactor netperf test and add analysis module Amos Kong
2012-01-05  3:06   ` Amos Kong [this message]
2012-01-05  3:06   ` [Autotest PATCH v2 4/4] virt: Introduce regression testing infrastructure Amos Kong
2012-01-06 20:17   ` [Autotest PATCH v2 0/4] Network performance regression Lucas Meneghel Rodrigues

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=20120105030614.8563.65894.stgit@dhcp-8-167.nay.redhat.com \
    --to=akong@redhat.com \
    --cc=autotest@test.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=lmr@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).