From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 80997F94 for ; Mon, 28 Nov 2016 15:02:56 +0100 (CET) Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F19104E4D2; Mon, 28 Nov 2016 14:02:54 +0000 (UTC) Received: from [10.36.7.160] (vpn1-7-160.ams2.redhat.com [10.36.7.160]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uASE2oWb020295 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 28 Nov 2016 09:02:52 -0500 To: Thomas Monjalon References: <20161123210006.7113-1-maxime.coquelin@redhat.com> <2842042.7AjAPCMeNN@xps13> Cc: yuanhan.liu@linux.intel.com, john.mcnamara@intel.com, zhiyong.yang@intel.com, dev@dpdk.org, fbaudin@redhat.com From: Maxime Coquelin Message-ID: Date: Mon, 28 Nov 2016 15:02:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <2842042.7AjAPCMeNN@xps13> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 28 Nov 2016 14:02:55 +0000 (UTC) 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 14:02:56 -0000 On 11/28/2016 12:22 PM, Thomas Monjalon wrote: > 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. Ok. The patch is under review on Qemu ML. While it gets merged, I can add a link to its patchwork ID. Ok for you? Thanks, Maxime