From: David Hunt <david.hunt@intel.com>
To: dev@dpdk.org
Cc: lei.a.yao@intel.com, david.hunt@intel.com
Subject: [dpdk-dev] [PATCH v1 2/4] examples/power: remove mask functions
Date: Thu, 22 Nov 2018 17:02:18 +0000 [thread overview]
Message-ID: <20181122170220.55482-3-david.hunt@intel.com> (raw)
In-Reply-To: <20181122170220.55482-1-david.hunt@intel.com>
since we're moving to allowing greater than 64 cores, the mask functions
that use uint64_t to perform functions on a masked set of cores are no
longer feasable, so removing them.
Signed-off-by: David Hunt <david.hunt@intel.com>
---
examples/vm_power_manager/channel_monitor.c | 24 ----
examples/vm_power_manager/power_manager.c | 68 ---------
examples/vm_power_manager/vm_power_cli.c | 149 --------------------
3 files changed, 241 deletions(-)
diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 5da531542..4189bbf1b 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -681,30 +681,6 @@ process_request(struct channel_packet *pkt, struct channel_info *chan_info)
default:
break;
}
- } else {
- switch (pkt->unit) {
- case(CPU_POWER_SCALE_MIN):
- power_manager_scale_mask_min(core_mask);
- break;
- case(CPU_POWER_SCALE_MAX):
- power_manager_scale_mask_max(core_mask);
- break;
- case(CPU_POWER_SCALE_DOWN):
- power_manager_scale_mask_down(core_mask);
- break;
- case(CPU_POWER_SCALE_UP):
- power_manager_scale_mask_up(core_mask);
- break;
- case(CPU_POWER_ENABLE_TURBO):
- power_manager_enable_turbo_mask(core_mask);
- break;
- case(CPU_POWER_DISABLE_TURBO):
- power_manager_disable_turbo_mask(core_mask);
- break;
- default:
- break;
- }
-
}
}
diff --git a/examples/vm_power_manager/power_manager.c b/examples/vm_power_manager/power_manager.c
index f9e8c0abd..21dc3a727 100644
--- a/examples/vm_power_manager/power_manager.c
+++ b/examples/vm_power_manager/power_manager.c
@@ -33,20 +33,6 @@
rte_spinlock_unlock(&global_core_freq_info[core_num].power_sl); \
} while (0)
-#define POWER_SCALE_MASK(DIRECTION, core_mask, ret) do { \
- int i; \
- for (i = 0; core_mask; core_mask &= ~(1 << i++)) { \
- if ((core_mask >> i) & 1) { \
- if (!(ci.cd[i].global_enabled_cpus)) \
- continue; \
- rte_spinlock_lock(&global_core_freq_info[i].power_sl); \
- if (rte_power_freq_##DIRECTION(i) != 1) \
- ret = -1; \
- rte_spinlock_unlock(&global_core_freq_info[i].power_sl); \
- } \
- } \
-} while (0)
-
struct freq_info {
rte_spinlock_t power_sl;
uint32_t freqs[RTE_MAX_LCORE_FREQS];
@@ -199,60 +185,6 @@ power_manager_exit(void)
return ret;
}
-int
-power_manager_scale_mask_up(uint64_t core_mask)
-{
- int ret = 0;
-
- POWER_SCALE_MASK(up, core_mask, ret);
- return ret;
-}
-
-int
-power_manager_scale_mask_down(uint64_t core_mask)
-{
- int ret = 0;
-
- POWER_SCALE_MASK(down, core_mask, ret);
- return ret;
-}
-
-int
-power_manager_scale_mask_min(uint64_t core_mask)
-{
- int ret = 0;
-
- POWER_SCALE_MASK(min, core_mask, ret);
- return ret;
-}
-
-int
-power_manager_scale_mask_max(uint64_t core_mask)
-{
- int ret = 0;
-
- POWER_SCALE_MASK(max, core_mask, ret);
- return ret;
-}
-
-int
-power_manager_enable_turbo_mask(uint64_t core_mask)
-{
- int ret = 0;
-
- POWER_SCALE_MASK(enable_turbo, core_mask, ret);
- return ret;
-}
-
-int
-power_manager_disable_turbo_mask(uint64_t core_mask)
-{
- int ret = 0;
-
- POWER_SCALE_MASK(disable_turbo, core_mask, ret);
- return ret;
-}
-
int
power_manager_scale_core_up(unsigned core_num)
{
diff --git a/examples/vm_power_manager/vm_power_cli.c b/examples/vm_power_manager/vm_power_cli.c
index 101e67c9c..34546809a 100644
--- a/examples/vm_power_manager/vm_power_cli.c
+++ b/examples/vm_power_manager/vm_power_cli.c
@@ -124,54 +124,7 @@ cmdline_parse_inst_t cmd_show_vm_set = {
};
/* *** vCPU to pCPU mapping operations *** */
-struct cmd_set_pcpu_mask_result {
- cmdline_fixed_string_t set_pcpu_mask;
- cmdline_fixed_string_t vm_name;
- uint8_t vcpu;
- char core_mask[POWER_MGR_MAX_CPUS];
-};
-static void
-cmd_set_pcpu_mask_parsed(void *parsed_result, struct cmdline *cl,
- __attribute__((unused)) void *data)
-{
- struct cmd_set_pcpu_mask_result *res = parsed_result;
-
- if (set_pcpus_mask(res->vm_name, res->vcpu, res->core_mask) == 0)
- cmdline_printf(cl, "Pinned vCPU(%"PRId8") to pCPU core "
- "\n", res->vcpu);
- else
- cmdline_printf(cl, "Unable to pin vCPU(%"PRId8") to pCPU core "
- "\n", res->vcpu);
-}
-
-cmdline_parse_token_string_t cmd_set_pcpu_mask =
- TOKEN_STRING_INITIALIZER(struct cmd_set_pcpu_mask_result,
- set_pcpu_mask, "set_pcpu_mask");
-cmdline_parse_token_string_t cmd_set_pcpu_mask_vm_name =
- TOKEN_STRING_INITIALIZER(struct cmd_set_pcpu_mask_result,
- vm_name, NULL);
-cmdline_parse_token_num_t set_pcpu_mask_vcpu =
- TOKEN_NUM_INITIALIZER(struct cmd_set_pcpu_mask_result,
- vcpu, UINT8);
-cmdline_parse_token_num_t set_pcpu_mask_core_mask =
- TOKEN_NUM_INITIALIZER(struct cmd_set_pcpu_mask_result,
- core_mask, UINT64);
-
-
-cmdline_parse_inst_t cmd_set_pcpu_mask_set = {
- .f = cmd_set_pcpu_mask_parsed,
- .data = NULL,
- .help_str = "set_pcpu_mask <vm_name> <vcpu> <pcpu>, Set the binding "
- "of Virtual CPU on VM to the Physical CPU mask.",
- .tokens = {
- (void *)&cmd_set_pcpu_mask,
- (void *)&cmd_set_pcpu_mask_vm_name,
- (void *)&set_pcpu_mask_vcpu,
- (void *)&set_pcpu_mask_core_mask,
- NULL,
- },
-};
struct cmd_set_pcpu_result {
cmdline_fixed_string_t set_pcpu;
@@ -428,105 +381,6 @@ cmdline_parse_inst_t cmd_channels_status_op_set = {
};
/* *** CPU Frequency operations *** */
-struct cmd_show_cpu_freq_mask_result {
- cmdline_fixed_string_t show_cpu_freq_mask;
- uint64_t core_mask;
-};
-
-static void
-cmd_show_cpu_freq_mask_parsed(void *parsed_result, struct cmdline *cl,
- __attribute__((unused)) void *data)
-{
- struct cmd_show_cpu_freq_mask_result *res = parsed_result;
- unsigned i;
- uint64_t mask = res->core_mask;
- uint32_t freq;
-
- for (i = 0; mask; mask &= ~(1ULL << i++)) {
- if ((mask >> i) & 1) {
- freq = power_manager_get_current_frequency(i);
- if (freq > 0)
- cmdline_printf(cl, "Core %u: %"PRId32"\n", i, freq);
- }
- }
-}
-
-cmdline_parse_token_string_t cmd_show_cpu_freq_mask =
- TOKEN_STRING_INITIALIZER(struct cmd_show_cpu_freq_mask_result,
- show_cpu_freq_mask, "show_cpu_freq_mask");
-cmdline_parse_token_num_t cmd_show_cpu_freq_mask_core_mask =
- TOKEN_NUM_INITIALIZER(struct cmd_show_cpu_freq_mask_result,
- core_mask, UINT64);
-
-cmdline_parse_inst_t cmd_show_cpu_freq_mask_set = {
- .f = cmd_show_cpu_freq_mask_parsed,
- .data = NULL,
- .help_str = "show_cpu_freq_mask <mask>, Get the current frequency for each "
- "core specified in the mask",
- .tokens = {
- (void *)&cmd_show_cpu_freq_mask,
- (void *)&cmd_show_cpu_freq_mask_core_mask,
- NULL,
- },
-};
-
-struct cmd_set_cpu_freq_mask_result {
- cmdline_fixed_string_t set_cpu_freq_mask;
- uint64_t core_mask;
- cmdline_fixed_string_t cmd;
-};
-
-static void
-cmd_set_cpu_freq_mask_parsed(void *parsed_result, struct cmdline *cl,
- __attribute__((unused)) void *data)
-{
- struct cmd_set_cpu_freq_mask_result *res = parsed_result;
- int ret = -1;
-
- if (!strcmp(res->cmd , "up"))
- ret = power_manager_scale_mask_up(res->core_mask);
- else if (!strcmp(res->cmd , "down"))
- ret = power_manager_scale_mask_down(res->core_mask);
- else if (!strcmp(res->cmd , "min"))
- ret = power_manager_scale_mask_min(res->core_mask);
- else if (!strcmp(res->cmd , "max"))
- ret = power_manager_scale_mask_max(res->core_mask);
- else if (!strcmp(res->cmd, "enable_turbo"))
- ret = power_manager_enable_turbo_mask(res->core_mask);
- else if (!strcmp(res->cmd, "disable_turbo"))
- ret = power_manager_disable_turbo_mask(res->core_mask);
- if (ret < 0) {
- cmdline_printf(cl, "Error scaling core_mask(0x%"PRIx64") '%s' , not "
- "all cores specified have been scaled\n",
- res->core_mask, res->cmd);
- };
-}
-
-cmdline_parse_token_string_t cmd_set_cpu_freq_mask =
- TOKEN_STRING_INITIALIZER(struct cmd_set_cpu_freq_mask_result,
- set_cpu_freq_mask, "set_cpu_freq_mask");
-cmdline_parse_token_num_t cmd_set_cpu_freq_mask_core_mask =
- TOKEN_NUM_INITIALIZER(struct cmd_set_cpu_freq_mask_result,
- core_mask, UINT64);
-cmdline_parse_token_string_t cmd_set_cpu_freq_mask_result =
- TOKEN_STRING_INITIALIZER(struct cmd_set_cpu_freq_mask_result,
- cmd, "up#down#min#max#enable_turbo#disable_turbo");
-
-cmdline_parse_inst_t cmd_set_cpu_freq_mask_set = {
- .f = cmd_set_cpu_freq_mask_parsed,
- .data = NULL,
- .help_str = "set_cpu_freq <core_mask> <up|down|min|max|enable_turbo|disable_turbo>, adjust the current "
- "frequency for the cores specified in <core_mask>",
- .tokens = {
- (void *)&cmd_set_cpu_freq_mask,
- (void *)&cmd_set_cpu_freq_mask_core_mask,
- (void *)&cmd_set_cpu_freq_mask_result,
- NULL,
- },
-};
-
-
-
struct cmd_show_cpu_freq_result {
cmdline_fixed_string_t show_cpu_freq;
uint8_t core_num;
@@ -627,11 +481,8 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_channels_op_set,
(cmdline_parse_inst_t *)&cmd_channels_status_op_set,
(cmdline_parse_inst_t *)&cmd_show_vm_set,
- (cmdline_parse_inst_t *)&cmd_show_cpu_freq_mask_set,
- (cmdline_parse_inst_t *)&cmd_set_cpu_freq_mask_set,
(cmdline_parse_inst_t *)&cmd_show_cpu_freq_set,
(cmdline_parse_inst_t *)&cmd_set_cpu_freq_set,
- (cmdline_parse_inst_t *)&cmd_set_pcpu_mask_set,
(cmdline_parse_inst_t *)&cmd_set_pcpu_set,
NULL,
};
--
2.17.1
next prev parent reply other threads:[~2018-11-22 17:02 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-22 17:02 [dpdk-dev] examples/power: allow use of more than 64 cores David Hunt
2018-11-22 17:02 ` [dpdk-dev] [PATCH v1 1/4] examples/power: change 64-bit masks to arrays David Hunt
2018-12-10 12:18 ` Burakov, Anatoly
2018-12-13 12:03 ` Hunt, David
2018-12-14 11:49 ` [dpdk-dev] [PATCH v2 0/4] examples/power: allow use of more than 64 cores David Hunt
2018-12-14 11:49 ` [dpdk-dev] [PATCH v2 1/4] examples/power: change 64-bit masks to arrays David Hunt
2018-12-14 12:00 ` Burakov, Anatoly
2018-12-14 11:49 ` [dpdk-dev] [PATCH v2 2/4] examples/power: remove mask functions David Hunt
2018-12-14 12:01 ` Burakov, Anatoly
2018-12-14 11:49 ` [dpdk-dev] [PATCH v2 3/4] examples/power: allow vms to use lcores over 63 David Hunt
2018-12-14 12:08 ` Burakov, Anatoly
2018-12-14 12:29 ` Hunt, David
2018-12-14 11:49 ` [dpdk-dev] [PATCH v2 4/4] examples/power: increase max cores to 256 David Hunt
2018-12-14 13:31 ` [dpdk-dev] [PATCH v3 0/4] examples/power: allow use of more than 64 cores David Hunt
2018-12-14 13:31 ` [dpdk-dev] [PATCH v3 1/4] examples/power: change 64-bit masks to arrays David Hunt
2018-12-14 13:31 ` [dpdk-dev] [PATCH v3 2/4] examples/power: remove mask functions David Hunt
2018-12-14 13:31 ` [dpdk-dev] [PATCH v3 3/4] examples/power: allow vms to use lcores over 63 David Hunt
2018-12-14 13:31 ` [dpdk-dev] [PATCH v3 4/4] examples/power: increase max cores to 256 David Hunt
2018-12-14 13:37 ` [dpdk-dev] [PATCH v3 0/4] examples/power: allow use of more than 64 cores Burakov, Anatoly
2018-12-19 21:25 ` Thomas Monjalon
2018-11-22 17:02 ` David Hunt [this message]
2018-12-10 12:30 ` [dpdk-dev] [PATCH v1 2/4] examples/power: remove mask functions Burakov, Anatoly
2018-12-13 12:13 ` Hunt, David
2018-12-13 12:14 ` Burakov, Anatoly
2018-11-22 17:02 ` [dpdk-dev] [PATCH v1 3/4] examples/power: allow vms to use lcores over 63 David Hunt
2018-12-10 13:06 ` Burakov, Anatoly
2018-12-13 16:46 ` Hunt, David
2018-11-22 17:02 ` [dpdk-dev] [PATCH v1 4/4] examples/power: increase MAX_CPUS to 256 David Hunt
2018-12-10 12:31 ` Burakov, Anatoly
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181122170220.55482-3-david.hunt@intel.com \
--to=david.hunt@intel.com \
--cc=dev@dpdk.org \
--cc=lei.a.yao@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).