From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id AAE172C23 for ; Fri, 13 Jul 2018 16:23:24 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jul 2018 07:23:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,347,1526367600"; d="scan'208";a="56278211" Received: from silpixa00399952.ir.intel.com (HELO silpixa00399952.ger.corp.intel.com) ([10.237.223.64]) by orsmga007.jf.intel.com with ESMTP; 13 Jul 2018 07:23:23 -0700 From: David Hunt To: dev@dpdk.org Cc: david.hunt@intel.com, thomas@monjalon.net Date: Fri, 13 Jul 2018 15:22:58 +0100 Message-Id: <20180713142302.34576-6-david.hunt@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180713142302.34576-1-david.hunt@intel.com> References: <20180626092317.11031-2-david.hunt@intel.com> <20180713142302.34576-1-david.hunt@intel.com> Subject: [dpdk-dev] [PATCH v4 5/9] examples/vm_power: add thread for oob core monitor 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: Fri, 13 Jul 2018 14:23:25 -0000 Change the app to now require three cores, as the third core will be used to run the oob montoring thread. Signed-off-by: David Hunt Acked-by: Radu Nicolau --- examples/vm_power_manager/main.c | 37 +++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c index 613a40af0..aef97b9ae 100644 --- a/examples/vm_power_manager/main.c +++ b/examples/vm_power_manager/main.c @@ -29,6 +29,7 @@ #include "channel_monitor.h" #include "power_manager.h" #include "vm_power_cli.h" +#include "oob_monitor.h" #include "parse.h" #include #include @@ -267,6 +268,17 @@ run_monitor(__attribute__((unused)) void *arg) return 0; } +static int +run_core_monitor(__attribute__((unused)) void *arg) +{ + if (branch_monitor_init() < 0) { + printf("Unable to initialize core monitor\n"); + return -1; + } + run_branch_monitor(); + return 0; +} + static void sig_handler(int signo) { @@ -285,12 +297,15 @@ main(int argc, char **argv) unsigned int nb_ports; struct rte_mempool *mbuf_pool; uint16_t portid; + struct core_info *ci; ret = core_info_init(); if (ret < 0) rte_panic("Cannot allocate core info\n"); + ci = get_core_info(); + ret = rte_eal_init(argc, argv); if (ret < 0) rte_panic("Cannot init EAL\n"); @@ -365,16 +380,23 @@ main(int argc, char **argv) } } + check_all_ports_link_status(enabled_port_mask); + lcore_id = rte_get_next_lcore(-1, 1, 0); if (lcore_id == RTE_MAX_LCORE) { - RTE_LOG(ERR, EAL, "A minimum of two cores are required to run " + RTE_LOG(ERR, EAL, "A minimum of three cores are required to run " "application\n"); return 0; } - - check_all_ports_link_status(enabled_port_mask); + printf("Running channel monitor on lcore id %d\n", lcore_id); rte_eal_remote_launch(run_monitor, NULL, lcore_id); + lcore_id = rte_get_next_lcore(lcore_id, 1, 0); + if (lcore_id == RTE_MAX_LCORE) { + RTE_LOG(ERR, EAL, "A minimum of three cores are required to run " + "application\n"); + return 0; + } if (power_manager_init() < 0) { printf("Unable to initialize power manager\n"); return -1; @@ -383,8 +405,17 @@ main(int argc, char **argv) printf("Unable to initialize channel manager\n"); return -1; } + + printf("Running core monitor on lcore id %d\n", lcore_id); + rte_eal_remote_launch(run_core_monitor, NULL, lcore_id); + run_cli(NULL); + branch_monitor_exit(); + rte_eal_mp_wait_lcore(); + + free(ci->cd); + return 0; } -- 2.17.1