From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wj0-f175.google.com (mail-wj0-f175.google.com [209.85.210.175]) by dpdk.org (Postfix) with ESMTP id 60337F72 for ; Mon, 28 Nov 2016 12:22:34 +0100 (CET) Received: by mail-wj0-f175.google.com with SMTP id mp19so112967428wjc.1 for ; Mon, 28 Nov 2016 03:22:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:user-agent:in-reply-to :references:mime-version:content-transfer-encoding; bh=0nQ/hOddivqhRrOJQkOmlqHEM40u8lMRK2OBXlkdqLE=; b=BKXNQ1rh0X0HJyEXtiXXjG675mJH+D7ovSgcJLHfikIsHbO3MEmDoRIQpANDeDKs/r bgZutiY7Yx9K21MF6rZZfezQh/Kb1hd3XYQoHkQt5U7ob5VuxrZQXfpfGgFR1KfSH2cp AH1FZNC0j/OXEixQbQPmbhkLzXnMBaMU4lrJm6zC1lY3QxNQOhOBbuNcn6WdaiD+8VEm Hh519n9WLjhYg4NMZKRPOjFUm4aVpYaCuxw6KVeBcrySTtswT57PHlstac1Q7WR7pMtG uMUtq6W6hNA66tXn8Ya4Pkez0ceyP5qRKB3QcH8S+dTOIgce0gF4KxyfYAimjWKWhQIh gyAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=0nQ/hOddivqhRrOJQkOmlqHEM40u8lMRK2OBXlkdqLE=; b=FKZ+pUHhXLvgKBPftNEvyDAV/XQEp5wsKgVWBdWTyF3zd7WL04xWEvxifz3ZBSvUgx bQv0nPNB919gFMZw0qBeo3PEsLWsP6yts36mf9RbMwX6AyLE4ktuDCR14Kpmmz7gpOsp zMYCBo0xzYYtE8Dec1lOfVGMhO0ZNRiuCCow1yzp5bD3JJ0iGfONgabGENINqlsBMmsi ifJbN13zrtcb8O2NyMrzUt+uW/ashkb2E9Ox4cCU+LSviRYnhOR3sRR1wscTUiJTso5C jLSfOK4C4OVL0rMMpRiNpAlciRLtS/MUANH13pFVziGHfFfGK5tN584yEfQzbIfWov5Z 4Qdg== X-Gm-Message-State: AKaTC02IZXMZiCOpic3RiTyOv03OiNRECmDe36x6S3bDTpW7XuBnth0pYjxfR3hvvHxJPKEN X-Received: by 10.194.222.202 with SMTP id qo10mr18064324wjc.115.1480332154265; Mon, 28 Nov 2016 03:22:34 -0800 (PST) Received: from xps13.localnet (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id v3sm31616390wjp.13.2016.11.28.03.22.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Nov 2016 03:22:33 -0800 (PST) From: Thomas Monjalon To: Maxime Coquelin Cc: yuanhan.liu@linux.intel.com, john.mcnamara@intel.com, zhiyong.yang@intel.com, dev@dpdk.org, fbaudin@redhat.com Date: Mon, 28 Nov 2016 12:22:32 +0100 Message-ID: <2842042.7AjAPCMeNN@xps13> User-Agent: KMail/4.14.10 (Linux/4.5.4-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <20161123210006.7113-1-maxime.coquelin@redhat.com> References: <20161123210006.7113-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH] doc: introduce PVP reference benchmark X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Nov 2016 11:22:36 -0000 2016-11-23 22:00, Maxime Coquelin: > +You can use this qmp-vcpu-pin script to pin vCPUs: > + > + .. code-block:: python > + > + #!/usr/bin/python > + # QEMU vCPU pinning tool > + # > + # Copyright (C) 2016 Red Hat Inc. > + # > + # Authors: > + # Maxime Coquelin > + # > + # This work is licensed under the terms of the GNU GPL, version 2. See > + # the COPYING file in the top-level directory > + import argparse > + import json > + import os > + > + from subprocess import call > + from qmp import QEMUMonitorProtocol > + > + pinned = [] > + > + parser = argparse.ArgumentParser(description='Pin QEMU vCPUs to physical CPUs') > + parser.add_argument('-s', '--server', type=str, required=True, > + help='QMP server path or address:port') > + parser.add_argument('cpu', type=int, nargs='+', > + help='Physical CPUs IDs') > + args = parser.parse_args() > + > + devnull = open(os.devnull, 'w') > + > + srv = QEMUMonitorProtocol(args.server) > + srv.connect() > + > + for vcpu in srv.command('query-cpus'): > + vcpuid = vcpu['CPU'] > + tid = vcpu['thread_id'] > + if tid in pinned: > + print 'vCPU{}\'s tid {} already pinned, skipping'.format(vcpuid, tid) > + continue > + > + cpuid = args.cpu[vcpuid % len(args.cpu)] > + print 'Pin vCPU {} (tid {}) to physical CPU {}'.format(vcpuid, tid, cpuid) > + try: > + call(['taskset', '-pc', str(cpuid), str(tid)], stdout=devnull) > + pinned.append(tid) > + except OSError: > + print 'Failed to pin vCPU{} to CPU{}'.format(vcpuid, cpuid) > No please do not introduce such useful script in a doc. I think it must be a separate file in the DPDK repository or in the QEMU repository.