All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Hunt <david.hunt@intel.com>
To: dev@dpdk.org
Cc: david.hunt@intel.com
Subject: [dpdk-dev] [PATCH v1] examples/power: fix policy handling for fifo
Date: Tue, 16 Jul 2019 12:11:12 +0100	[thread overview]
Message-ID: <20190716111112.32427-1-david.hunt@intel.com> (raw)

While the core frequency scale-up and scale down all works fine with the
fifo-per-core functionaliry, there was a gap for policy handling. When
creating or destroying a policy, the core associated with the fifo
needs to be automatically added to the core list, so the policy is
associated with the correct core.

Fixes: 221e7026d521 ("examples/power: add FIFO per core for JSON interface")

Signed-off-by: David Hunt <david.hunt@intel.com>
---
 examples/vm_power_manager/channel_monitor.c | 24 ++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 496772f8a..fe6088a18 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -835,6 +835,8 @@ read_json_packet(struct channel_info *chan_info)
 	json_t *root;
 	json_error_t error;
 	const char *resource_name;
+	char *start, *end;
+	uint32_t n;
 
 
 	/* read opening brace to closing brace */
@@ -882,7 +884,27 @@ read_json_packet(struct channel_info *chan_info)
 					"Error validating JSON profile data\n");
 				break;
 			}
-			process_request(&pkt, chan_info);
+			start = strstr(pkt.vm_name,
+					CHANNEL_MGR_FIFO_PATTERN_NAME);
+			if (start != NULL) {
+				/* move past pattern to start of fifo id */
+				start += strlen(CHANNEL_MGR_FIFO_PATTERN_NAME);
+
+				end = start;
+				n = (uint32_t)strtoul(start, &end, 10);
+
+				if (end[0] == '\0') {
+					/* Add core id to core list */
+					pkt.num_vcpu = 1;
+					pkt.vcpu_to_control[0] = n;
+					process_request(&pkt, chan_info);
+				} else {
+					RTE_LOG(ERR, CHANNEL_MONITOR,
+						"Cannot extract core id from fifo name\n");
+				}
+			} else {
+				process_request(&pkt, chan_info);
+			}
 		} else {
 			RTE_LOG(ERR, CHANNEL_MONITOR,
 					"JSON error on line %d: %s\n",
-- 
2.17.1


             reply	other threads:[~2019-07-16 11:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-16 11:11 David Hunt [this message]
2019-07-16 13:44 ` [dpdk-dev] [PATCH v1] examples/power: fix policy handling for fifo Burakov, Anatoly
2019-07-17 20:52   ` Thomas Monjalon

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=20190716111112.32427-1-david.hunt@intel.com \
    --to=david.hunt@intel.com \
    --cc=dev@dpdk.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.