# Stop core
debug.verbose("Wait until core is down.")
self.console.expect("Core %s stopped." % self.core)
- self.wait_for_prompt()
+ # cannot wait for prompt here, as new cleanup routine will wait for
+ # answer from monitor on stopped core.
+ #self.wait_for_prompt()
# Make sure app is no longer running
i = self.console.expect(["On core %s" % self.core, pexpect.TIMEOUT], timeout=10)
self.console.expect("On core %s" % self.core)
- # Stop
- debug.verbose("Stopping core %s." % self.core)
- self.console.sendline("corectrl stop %s" % self.core)
- self.wait_for_prompt()
-
# Park
- debug.verbose("Transfer OSNode from %s to %s." % (self.core, self.target_core))
- self.console.sendline("corectrl give %s %s" % (self.core, self.target_core))
+ debug.verbose("Park OSNode from %s on %s." % (self.core, self.target_core))
+ self.console.sendline("corectrl park %s %s" % (self.core, self.target_core))
self.wait_for_prompt()
self.console.expect("On core %s" % self.target_core)
self.console.expect("On core %s" % self.core)
self.console.expect("On core %s" % self.core)
- # Stop
- debug.verbose("Stopping core %s." % self.core)
- self.console.sendline("corectrl stop %s" % self.core)
- self.wait_for_prompt()
-
# Park
- debug.verbose("Transfer OSNode from %s to %s." % (self.core, self.parking_core))
- self.console.sendline("corectrl give %s %s" % (self.core, self.parking_core))
+ debug.verbose("Park KCB %s on core %s." % (self.core, self.parking_core))
+ self.console.sendline("corectrl park %s %s" % (self.core, self.parking_core))
self.wait_for_prompt()
+
self.console.expect("On core %s" % self.parking_core)
self.console.expect("On core %s" % self.parking_core)
- # Remove KCB on parking core
- debug.verbose("Remove KCB on parking core %s." % (self.parking_core))
- self.console.sendline("corectrl rmkcb %s" % (self.core))
+ # Unpark
+ debug.verbose("Unpark KCB %s from core %s." % (self.core, self.parking_core))
+ self.console.sendline("corectrl unpark %s" % (self.core))
self.wait_for_prompt()
# Reboot home core with kcb
- debug.verbose("Reboot core %s." % (self.core))
- self.console.sendline("corectrl boot -m %s" % (self.core))
- self.wait_for_prompt()
self.console.expect("On core %s" % self.core)
self.console.expect("On core %s" % self.core)
done = true;
// The next line is crucial for harness test to pass
- printf("Core %"PRIuCOREID" stopped.", target_id);
+ printf("Core %"PRIuCOREID" stopped.\n", target_id);
return 0;
}
return 0;
}
+/*
+ * Do stop and then give in one call to corectrl
+ * args: <kcb_id to stop> <kcb_id to give to>
+ */
+static int park_kcb(int argc, char *argv[])
+{
+ int r;
+ assert (argc == 3);
+ printf("Stopping core %lu\n", strtol(argv[1], NULL, 0));
+ r = stop_cpu(2, argv);
+ if (r) { return r; }
+ printf("Parking KCB on core %lu\n", strtol(argv[2], NULL, 0));
+ return give_kcb(3, argv);
+}
+
+/*
+ * Do rm and boot -m in one call to corectrl
+ * args: <kcb_id to remove> <core_id to boot>
+ */
+static int unpark_kcb(int argc, char *argv[])
+{
+ int r;
+ assert (argc == 2);
+ coreid_t c = (coreid_t)strtol(argv[1], NULL, 0);
+ printf("Removing KCB %u from its core\n", c);
+ r = remove_kcb(2, argv);
+ if (r) { return r; }
+ // set nomsg_flag to emulate -m option for boot
+ nomsg_flag = true;
+ printf("Booting KCB %u on core %u\n", c,c);
+ return boot_cpu(2, argv);
+}
+
static struct cmd commands[] = {
{
"boot",
2
},
{
+ "park",
+ "Stop execution on an existing core and park KCB on another core.",
+ "park <kcb_id to stop> <recv kcb_id>",
+ park_kcb,
+ 3
+ },
+ {
+ "unpark",
+ "Reestablish parked KCB on its original core.",
+ "unpark <kcb_id to unpark>",
+ unpark_kcb,
+ 2
+ },
+ {
"lscpu",
"List current status of all cores.",
"lscpu",