From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH] doc: introduce PVP reference benchmark Date: Mon, 28 Nov 2016 15:15:30 +0100 Message-ID: <1948533.ERBNTx8Tcb@xps13> References: <20161123210006.7113-1-maxime.coquelin@redhat.com> <2842042.7AjAPCMeNN@xps13> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: yuanhan.liu@linux.intel.com, john.mcnamara@intel.com, zhiyong.yang@intel.com, dev@dpdk.org, fbaudin@redhat.com To: Maxime Coquelin Return-path: Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by dpdk.org (Postfix) with ESMTP id 49620201 for ; Mon, 28 Nov 2016 15:15:32 +0100 (CET) Received: by mail-wm0-f50.google.com with SMTP id t79so156012658wmt.0 for ; Mon, 28 Nov 2016 06:15:32 -0800 (PST) In-Reply-To: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2016-11-28 15:02, Maxime Coquelin: > > 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? Perfect, thanks