From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0063.outbound.protection.outlook.com [104.47.37.63]) by dpdk.org (Postfix) with ESMTP id 015B51B698 for ; Wed, 4 Oct 2017 17:59:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Dwt59Rh4ilRnrMAat741OJRZhAcrhD1gf6+HfEAzZ4Y=; b=jiDfVgq25/xWLszGcLOoWf5jpp2E3TOWrqf00z10ta+1fnWtav1KMJ54wvZa7fMRFpsqBIGBILv5uWW+MF14P8pa7JzaMrq2cNJr7WRIN9eOni0Qh4Up8+/Vy6yyBt+EK2aODqQ8IgmTbud/SVZB4iILy2btRNEehqQqamjbDdY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from [192.168.0.105] (103.76.56.167) by DM5PR07MB3098.namprd07.prod.outlook.com (10.172.85.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Wed, 4 Oct 2017 15:59:03 +0000 To: David Hunt , dev@dpdk.org References: <1507108515-186477-1-git-send-email-david.hunt@intel.com> <1507130720-48891-1-git-send-email-david.hunt@intel.com> <1507130720-48891-4-git-send-email-david.hunt@intel.com> Cc: konstantin.ananyev@intel.com, jingjing.wu@intel.com, Nemanja Marjanovic , Rory Sexton From: santosh Message-ID: Date: Wed, 4 Oct 2017 21:28:53 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <1507130720-48891-4-git-send-email-david.hunt@intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Originating-IP: [103.76.56.167] X-ClientProxiedBy: SG2PR06CA0098.apcprd06.prod.outlook.com (10.170.138.24) To DM5PR07MB3098.namprd07.prod.outlook.com (10.172.85.8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4c302386-7589-4f6a-3368-08d50b40d73d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:DM5PR07MB3098; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3098; 3:LLO7HNWM0MtBFwOXUrPj24IHqPXMRtRd4j96CoFaB+XWfNSsVSrY8LHvPVsW/phEta3DzzPeEU4q1p379YC5Agw/LR+6XTSYDSYWRFLn021zCQgIpHLTGD1Oguvux8O/x/lP52qag/bjXTwQZH16n6reQUVr7QNLwJXYg5enpal5x7PVsvitgEpZXS2uJFQZcYdO1WNk5W7g+b35mXtCWjRNLlP72LcCjED4H50tyNUQsHwYm2JegGqS9J92mP/l; 25:A1RWMbCt/YyAPGRhJPYSUdPXkZpwYEbbLMfi2ycVpYXnQoER4uX+rV+20OMDo+dMBDjKqRYHhMxJHHAaeSTb5TafeDzJukju97GvtlxWMTOycTgrG1qcUU7BqbbHXMa2xcjR/a+1wbrMg2v4wdQlQDp9pTW+IyYhrnbrLSnpedz2FYeene9lc22f2A4+HwnZZmoKaJafvry99PXtD5jyGsBhG16U6drhV1HFfLTiDih3Mvjjbkkobu5XIUBhhH90kpv6y82PzN5IucZYpqLaZ+bSWtdEjA/tu7o4H0ioPyzNzkrWC9+l4dC4MpEq+U0synENh2K365K2s+efl2suVQ==; 31:8RGt2Ax6XdSBbFPjwDMFJcjWhfhz6SZT+DbkeKv5m7Jpv+5ejB36jX/iJUGU5IAuckMGKB2VwpU8pj1WhG7EXwd9lrwhnGrWZfrM+Tn0zznO61KSAWAJ8zWldiwkI25r4ZKdsN6UKTLZ0HFZXFRTszWpuSix9/qPETViG/H3HcG3dGvZo1OUUI+OwM2v5o0xvPfLn22goDmBBZRg/uXQOCnbkGWD73zCYx4XI4VSv+8= X-MS-TrafficTypeDiagnostic: DM5PR07MB3098: X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3098; 20:JMbcjYLmQY+MpE7niXD45EQ1Bt5AXJa7m0bYpKESYqnEPCuFakz0y/ZparpAC76gpiMSm20+rcWrjoNE/D7zGBrQk0jTX8sDDuNYSNAll2rwVtadlEZmqphxy8QkImY+LFl5TXhQc+QaMcXSJBBIiRSEO4DAtbs6oWNehL+YKYesVuaxvgN/VckQe+aYvRkISpUNntOfy7K6BvUxg/tGoYTMiq/Ntzs311rZHFgGjRf+g4GWEzbK1Xq9L2GsJy5VABlOE8KtBeLWzFd2HNxK8irK0yNDM+DvUaNgqEsbb3Nzvri2qHVIxsTGUarkR12Lif9dq1Johrt0HXUYA8c/FJiUsUWA6pntJ/6sNMEsb1QeOzzotX2z0IiD/lrOHVq2LGA+cun+zCeznDb4xKvD9HkWeaWpKXmEVThKetHUgDaaqTTChxq2cZ+KBzi5f18KsmKW0dWlhvf+cgFyW57WRPD4VRtjPiJFXHhGGjWzLts8yqtNlxxQv/Nlf/a9g4NAY91+9C9x2a2OBrcyueNlbwAHEPwImylZbmOqTJNTx3AQXaDlk42qa5IZ48dti9pPIIyohkmnriAqK450m45QOcQD628x6D7iLiWuaJ1V/0I=; 4:YxYPtNJT2dvGSC7PqqrU4yCYj/r/xKQGV3Ym9yFG2wfBnHm75MEJUAVwVLcEPEyIci9bJBDvFxvEfCjgo/BC76GuVyjk4waA8uNEvpr3iVWV1WTDuK3anTYQ9uWyBrA/ci2fUtGjlNlyosJYZoAsfqN5uifHitILlUv/QzyrI8Vsbtjj8oWgPEUmPEzeg9tyECW71qVlEgf1jbuw3xjIFxNhT2iwM4xpBwA6JmO8px+QcYmeWI5JbDlc+T9opKkYe7iCbRBrT7vrlFyrthia/zUNLrTVFTseu90rdeZgiu8= X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(93006095)(3002001)(100000703101)(100105400095)(10201501046)(6041248)(20161123560025)(20161123555025)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR07MB3098; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR07MB3098; X-Forefront-PRVS: 0450A714CB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(6009001)(376002)(346002)(24454002)(377454003)(189002)(199003)(6666003)(65826007)(54906003)(230700001)(72206003)(106356001)(189998001)(47776003)(77096006)(105586002)(65806001)(16526018)(64126003)(83506001)(50466002)(229853002)(66066001)(76176999)(50986999)(65956001)(90366009)(6486002)(478600001)(54356999)(6246003)(4326008)(58126008)(117156002)(5660300001)(68736007)(2950100002)(42882006)(316002)(2906002)(25786009)(36756003)(6116002)(3846002)(8936002)(23746002)(86152003)(8676002)(97736004)(81166006)(101416001)(81156014)(33646002)(31686004)(7736002)(31696002)(53936002)(305945005)(16576012); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3098; H:[192.168.0.105]; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; DM5PR07MB3098; 23:KqBDWOQvkAulRwl746Xzds/G4I35zQSmOH3Dn?= =?Windows-1252?Q?m00v2wxYvwd7aGPCEQVqr/AoAKJZAbyjkCXDr+vpTLxx7Rmt7re7uTK9?= =?Windows-1252?Q?tEM99XGrm90pFLkoYpLNXuqfplMqKJNHtF30IJsAHlPhH15v8c/Nnwsr?= =?Windows-1252?Q?QukkAnZkF4WKDFNA0q8GxlsracuqVYlyqpjzxWFszeTvV/B+pNOuuWVz?= =?Windows-1252?Q?n0L/9jVb/6csbcNzlc7ATcHdSYfeEoxV7/08aeq+x1B47ivrsbMSqDZs?= =?Windows-1252?Q?MgiJajLbyk5wKdhUoRey0rYFXYksVQplhCNwqv2xowl2jdnMK5ILJilW?= =?Windows-1252?Q?H1xG2VOnkbLG3XZqwtaLXKHwLrs454AkczS5vXrSTdsPHMDAup5vpFAc?= =?Windows-1252?Q?oP4H/oOgm1NMOCEgFEzmIP5i/tOimVE8HWYBphS3WPPcePDgS/4DyLUH?= =?Windows-1252?Q?YuqVcP2qN5MkVSLBJRsRLmhN2f//OP62Vku6LxFzyaFycIw0KSxNsS7G?= =?Windows-1252?Q?ZG7j34ZK6v+sY+GzvAkXQAJXbaNUvBjWoj5DQFjsv5h6bXOBvxyxldZR?= =?Windows-1252?Q?m5Oe0n7dToFIBQpYuErPDq9ZpvWeXUjUtTn0v5YgFBDLwGqY0XJm41qu?= =?Windows-1252?Q?CR/Ra276tcyCkcFb4BR1aVTynK7y+cPzMOpSrgN0A1slzomrXgEsPCLi?= =?Windows-1252?Q?T1127gxwdqIvGJ9bLkAF4m1tGrRPuGvZVniNP2pFiefQL1tYmq3MVG9H?= =?Windows-1252?Q?xba8rY8E1xJrCCCqeAl8MWPJTKI0QjMDQ+E3c07qQQtTP8LUrZpRbVDE?= =?Windows-1252?Q?dWFE+KVRIDf3Xfl+GJ5bMAu30s6G9u1GWUmmmq3FHC8ZBD9rC6YzMl2p?= =?Windows-1252?Q?gsLetB5SjkNGjz6vniZQ9xY2A1blFv1QT703rI1yZBe90N64YFJJI69B?= =?Windows-1252?Q?vMZge70dhQ8BChP/oapnN5+5kGKu+cNa1vdfgq+BFRUCLZcXvBmVH9m8?= =?Windows-1252?Q?GzKqvkWFawzHypyBEC5S2I13OOfdq4bnvI+f0QtNG5eX6v1CJHllWfS3?= =?Wind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rIWR/g==; 24:u7DG53Vszc7ANaXB0ysy0TtBPINdOaU4lM63Qt/cQgSyQhxBEbmcsudHmZkvj071e8p3H5hKGN0n5WWZUfLwEwZJdrTnhdG8B9DFzdYovkk=; 7:AISrrvbKZamLFgfBwCzmXqPMBn63hDWCjHX3olxQ4MXvUYG1mPblsC7AIRhuHmbHcGr32vvrmbv6sPfQ827Vvax2w02m7B1ZFtjR2Qrt4KDrv3rDsVW1eWDlBp869pBHYqHwtQqMn9DCKaKTjCvg/OQftAC28+hnx1bWdRLjL2eiiZrYE64iy+rUjVoKiyKVcUoTWmHq3cOkU3fkgbmsDred4n9G212AxxKtC9FSjdg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2017 15:59:03.5811 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3098 Subject: Re: [dpdk-dev] [PATCH v5 3/9] examples/vm_power_mgr: add vcpu to pcpu mapping X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Oct 2017 15:59:08 -0000 Hi David, On Wednesday 04 October 2017 08:55 PM, David Hunt wrote: > Signed-off-by: Nemanja Marjanovic > Signed-off-by: Rory Sexton > Signed-off-by: David Hunt > --- > examples/vm_power_manager/channel_manager.c | 62 +++++++++++++++++++++++++++++ > examples/vm_power_manager/channel_manager.h | 25 ++++++++++++ > 2 files changed, 87 insertions(+) > > diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c > index e068ae2..03fa626 100644 > --- a/examples/vm_power_manager/channel_manager.c > +++ b/examples/vm_power_manager/channel_manager.c > @@ -574,6 +574,68 @@ set_channel_status(const char *vm_name, unsigned *channel_list, > return num_channels_changed; > } > > +void > +get_all_vm(int *num_vm, int *num_cpu) > +{ nits: s/*num_cpu/*num_vcpu > + > + virNodeInfo node_info; > + virDomainPtr *domptr; > + uint64_t mask; > + int i, ii, numVcpus[MAX_VCPUS], cpu, n_vcpus; > + unsigned int jj; > + const char *vm_name; > + unsigned int flags = VIR_CONNECT_LIST_DOMAINS_RUNNING | > + VIR_CONNECT_LIST_DOMAINS_PERSISTENT; > + unsigned int flag = VIR_DOMAIN_VCPU_CONFIG; > + nits: Perhaps add more clear name example: s/flags/conn_flags s/flag/domain_flags > + > + memset(global_cpumaps, 0, CHANNEL_CMDS_MAX_CPUS*global_maplen); > + if (virNodeGetInfo(global_vir_conn_ptr, &node_info)) > + RTE_LOG(ERR, CHANNEL_MANAGER, "Unable to retrieve node Info\n"); > + Should return from here.. since node info not retrieve ops errored out. > + /* Returns number of pcpus */ > + global_n_host_cpus = (unsigned int)node_info.cpus; > + > + /* Returns number of active domains */ > + *num_vm = virConnectListAllDomains(global_vir_conn_ptr, &domptr, flags); > + if (*num_vm <= 0) > + RTE_LOG(ERR, CHANNEL_MANAGER, "No Active Domains Running\n"); > + ditto.. > + for (i = 0; i < *num_vm; i++) { > + > + /* Get Domain Names */ > + vm_name = virDomainGetName(domptr[i]); > + lvm_info[i].vm_name = vm_name; > + > + /* Get Number of Vcpus */ > + numVcpus[i] = virDomainGetVcpusFlags(domptr[i], flag); > + > + /* Get Number of VCpus & VcpuPinInfo */ > + n_vcpus = virDomainGetVcpuPinInfo(domptr[i], > + numVcpus[i], global_cpumaps, > + global_maplen, flag); > + > + if ((int)n_vcpus > 0) { > + *num_cpu = n_vcpus; > + lvm_info[i].num_cpus = n_vcpus; > + } > + > + /* Save pcpu in use by libvirt VMs */ > + for (ii = 0; ii < n_vcpus; ii++) { > + mask = 0; > + for (jj = 0; jj < global_n_host_cpus; jj++) { > + if (VIR_CPU_USABLE(global_cpumaps, > + global_maplen, ii, jj) > 0) { > + mask |= 1ULL << jj; > + } > + } > + ITERATIVE_BITMASK_CHECK_64(mask, cpu) { > + lvm_info[i].pcpus[ii] = cpu; > + } > + } > + } > +} > + > int > get_info_vm(const char *vm_name, struct vm_info *info) > { > diff --git a/examples/vm_power_manager/channel_manager.h b/examples/vm_power_manager/channel_manager.h > index 47c3b9c..788c1e6 100644 > --- a/examples/vm_power_manager/channel_manager.h > +++ b/examples/vm_power_manager/channel_manager.h > @@ -66,6 +66,17 @@ struct sockaddr_un _sockaddr_un; > #define UNIX_PATH_MAX sizeof(_sockaddr_un.sun_path) > #endif > > +#define MAX_VMS 4 > +#define MAX_VCPUS 20 > + > + > +struct libvirt_vm_info { > + const char *vm_name; > + unsigned int pcpus[MAX_VCPUS]; > + uint8_t num_cpus; > +}; > + > +struct libvirt_vm_info lvm_info[MAX_VMS]; > /* Communication Channel Status */ > enum channel_status { CHANNEL_MGR_CHANNEL_DISCONNECTED = 0, > CHANNEL_MGR_CHANNEL_CONNECTED, > @@ -319,6 +330,20 @@ int set_channel_status(const char *vm_name, unsigned *channel_list, > */ > int get_info_vm(const char *vm_name, struct vm_info *info); > > +/** > + * Populates a table with all domains running and their physical cpu. > + * All information is gathered through libvirt api. > + * > + * @param noVms > + * modified to store number of active VMs > + * > + * @param noVcpus > + modified to store number of vcpus active > + * > + * @return > + * void > + */ > +void get_all_vm(int *noVms, int *noVcpus); nits: perhaps, void get_all_vm(int *num_vm, int *num_vcpu) Thanks. > #ifdef __cplusplus > } > #endif