Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/29552/?format=api
https://patches.dpdk.org/api/patches/29552/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1507039737-170942-4-git-send-email-david.hunt@intel.com/", "project": { "id": 1, "url": "https://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<1507039737-170942-4-git-send-email-david.hunt@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1507039737-170942-4-git-send-email-david.hunt@intel.com", "date": "2017-10-03T14:08:51", "name": "[dpdk-dev,v3,3/9] examples/vm_power_mgr: add vcpu to pcpu mapping", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "b1a84bd99ecadee3aaeeebe7dd076f9a42fb5ff2", "submitter": { "id": 342, "url": "https://patches.dpdk.org/api/people/342/?format=api", "name": "Hunt, David", "email": "david.hunt@intel.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1507039737-170942-4-git-send-email-david.hunt@intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/29552/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/29552/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id C77F21B3B3;\n\tTue, 3 Oct 2017 16:46:43 +0200 (CEST)", "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n\tby dpdk.org (Postfix) with ESMTP id C13E01B3B0\n\tfor <dev@dpdk.org>; Tue, 3 Oct 2017 16:46:41 +0200 (CEST)", "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby orsmga105.jf.intel.com with ESMTP; 03 Oct 2017 07:46:41 -0700", "from silpixa00397898.ir.intel.com (HELO\n\tsilpixa00397898.ger.corp.intel.com) ([10.237.223.116])\n\tby orsmga003.jf.intel.com with ESMTP; 03 Oct 2017 07:46:39 -0700" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos; i=\"5.42,474,1500966000\"; d=\"scan'208\";\n\ta=\"1021087131\"", "From": "David Hunt <david.hunt@intel.com>", "To": "dev@dpdk.org", "Cc": "konstantin.ananyev@intel.com, jingjing.wu@intel.com,\n\tDavid Hunt <david.hunt@intel.com>,\n\tNemanja Marjanovic <nemanja.marjanovic@intel.com>,\n\tRory Sexton <rory.sexton@intel.com>", "Date": "Tue, 3 Oct 2017 15:08:51 +0100", "Message-Id": "<1507039737-170942-4-git-send-email-david.hunt@intel.com>", "X-Mailer": "git-send-email 2.7.4", "In-Reply-To": "<1507039737-170942-1-git-send-email-david.hunt@intel.com>", "References": "<1505299459-24135-2-git-send-email-david.hunt@intel.com>\n\t<1507039737-170942-1-git-send-email-david.hunt@intel.com>", "Subject": "[dpdk-dev] [PATCH v3 3/9] examples/vm_power_mgr: add vcpu to pcpu\n\tmapping", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic@intel.com>\nSigned-off-by: Rory Sexton <rory.sexton@intel.com>\nSigned-off-by: David Hunt <david.hunt@intel.com>\n---\n examples/vm_power_manager/channel_manager.c | 62 +++++++++++++++++++++++++++++\n examples/vm_power_manager/channel_manager.h | 25 ++++++++++++\n 2 files changed, 87 insertions(+)", "diff": "diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c\nindex e068ae2..03fa626 100644\n--- a/examples/vm_power_manager/channel_manager.c\n+++ b/examples/vm_power_manager/channel_manager.c\n@@ -574,6 +574,68 @@ set_channel_status(const char *vm_name, unsigned *channel_list,\n \treturn num_channels_changed;\n }\n \n+void\n+get_all_vm(int *num_vm, int *num_cpu)\n+{\n+\n+\tvirNodeInfo node_info;\n+\tvirDomainPtr *domptr;\n+\tuint64_t mask;\n+\tint i, ii, numVcpus[MAX_VCPUS], cpu, n_vcpus;\n+\tunsigned int jj;\n+\tconst char *vm_name;\n+\tunsigned int flags = VIR_CONNECT_LIST_DOMAINS_RUNNING |\n+\t\t\t\tVIR_CONNECT_LIST_DOMAINS_PERSISTENT;\n+\tunsigned int flag = VIR_DOMAIN_VCPU_CONFIG;\n+\n+\n+\tmemset(global_cpumaps, 0, CHANNEL_CMDS_MAX_CPUS*global_maplen);\n+\tif (virNodeGetInfo(global_vir_conn_ptr, &node_info))\n+\t\tRTE_LOG(ERR, CHANNEL_MANAGER, \"Unable to retrieve node Info\\n\");\n+\n+\t/* Returns number of pcpus */\n+\tglobal_n_host_cpus = (unsigned int)node_info.cpus;\n+\n+\t/* Returns number of active domains */\n+\t*num_vm = virConnectListAllDomains(global_vir_conn_ptr, &domptr, flags);\n+\tif (*num_vm <= 0)\n+\t\tRTE_LOG(ERR, CHANNEL_MANAGER, \"No Active Domains Running\\n\");\n+\n+\tfor (i = 0; i < *num_vm; i++) {\n+\n+\t\t/* Get Domain Names */\n+\t\tvm_name = virDomainGetName(domptr[i]);\n+\t\tlvm_info[i].vm_name = vm_name;\n+\n+\t\t/* Get Number of Vcpus */\n+\t\tnumVcpus[i] = virDomainGetVcpusFlags(domptr[i], flag);\n+\n+\t\t/* Get Number of VCpus & VcpuPinInfo */\n+\t\tn_vcpus = virDomainGetVcpuPinInfo(domptr[i],\n+\t\t\t\tnumVcpus[i], global_cpumaps,\n+\t\t\t\tglobal_maplen, flag);\n+\n+\t\tif ((int)n_vcpus > 0) {\n+\t\t\t*num_cpu = n_vcpus;\n+\t\t\tlvm_info[i].num_cpus = n_vcpus;\n+\t\t}\n+\n+\t\t/* Save pcpu in use by libvirt VMs */\n+\t\tfor (ii = 0; ii < n_vcpus; ii++) {\n+\t\t\tmask = 0;\n+\t\t\tfor (jj = 0; jj < global_n_host_cpus; jj++) {\n+\t\t\t\tif (VIR_CPU_USABLE(global_cpumaps,\n+\t\t\t\t\t\tglobal_maplen, ii, jj) > 0) {\n+\t\t\t\t\tmask |= 1ULL << jj;\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tITERATIVE_BITMASK_CHECK_64(mask, cpu) {\n+\t\t\t\tlvm_info[i].pcpus[ii] = cpu;\n+\t\t\t}\n+\t\t}\n+\t}\n+}\n+\n int\n get_info_vm(const char *vm_name, struct vm_info *info)\n {\ndiff --git a/examples/vm_power_manager/channel_manager.h b/examples/vm_power_manager/channel_manager.h\nindex 47c3b9c..788c1e6 100644\n--- a/examples/vm_power_manager/channel_manager.h\n+++ b/examples/vm_power_manager/channel_manager.h\n@@ -66,6 +66,17 @@ struct sockaddr_un _sockaddr_un;\n #define UNIX_PATH_MAX sizeof(_sockaddr_un.sun_path)\n #endif\n \n+#define MAX_VMS 4\n+#define MAX_VCPUS 20\n+\n+\n+struct libvirt_vm_info {\n+\tconst char *vm_name;\n+\tunsigned int pcpus[MAX_VCPUS];\n+\tuint8_t num_cpus;\n+};\n+\n+struct libvirt_vm_info lvm_info[MAX_VMS];\n /* Communication Channel Status */\n enum channel_status { CHANNEL_MGR_CHANNEL_DISCONNECTED = 0,\n \tCHANNEL_MGR_CHANNEL_CONNECTED,\n@@ -319,6 +330,20 @@ int set_channel_status(const char *vm_name, unsigned *channel_list,\n */\n int get_info_vm(const char *vm_name, struct vm_info *info);\n \n+/**\n+ * Populates a table with all domains running and their physical cpu.\n+ * All information is gathered through libvirt api.\n+ *\n+ * @param noVms\n+ * modified to store number of active VMs\n+ *\n+ * @param noVcpus\n+ modified to store number of vcpus active\n+ *\n+ * @return\n+ * void\n+ */\n+void get_all_vm(int *noVms, int *noVcpus);\n #ifdef __cplusplus\n }\n #endif\n", "prefixes": [ "dpdk-dev", "v3", "3/9" ] }{ "id": 29552, "url": "