From: Jan Kiszka <[email protected]>

When at least one non-root cell is provided, check if the root cell is
left with at least one core. If multiple non-root cells are listed, test
the those do not overlap in their CPU set. This ensures that the given
cell set can be instantiated at the same time.

Signed-off-by: Jan Kiszka <[email protected]>
---
 tools/jailhouse-config-check | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/tools/jailhouse-config-check b/tools/jailhouse-config-check
index 95de6fd4..ebfe97a8 100755
--- a/tools/jailhouse-config-check
+++ b/tools/jailhouse-config-check
@@ -187,4 +187,30 @@ for cell in cells:
                 ret=1
 print("\n" if found else " None")
 
+if len(cells) > 1:
+    print("Root cell CPU starvation:", end='')
+    remaining_root_core=root_cell.cpus
+    for cell in cells[1:]:
+        remaining_root_core -= cell.cpus
+    if len(remaining_root_core) == 0:
+        print("\n\n"
+              "No root cell CPUs left when all non-root cells are started\n")
+        ret=1
+    else:
+        print(" None")
+
+if len(cells) > 2:
+    print("Overlapping cores between non-root cells:", end='')
+    found=False
+    for cell in cells[1:len(cells)-1]:
+        for other_cell in cells[cells.index(cell)+1:]:
+            overlap=cell.cpus & other_cell.cpus
+            if overlap:
+                print("\n\nCells '%s' and '%s' share CPUs:" %
+                      (cell.name, other_cell.name))
+                print(str(overlap).strip('{}'), end='')
+                found=True
+                ret=1
+    print("\n" if found else " None")
+
 exit(ret)
-- 
2.35.3

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/d77a509484ad7cea7d9b72f35086492ca7f5046b.1674415741.git.jan.kiszka%40siemens.com.

Reply via email to