Add human readable nodes for cpus_assigned and cpus_failed and let
jailhouse-cell-list use those nodes.

Signed-off-by: Ralf Ramsauer <[email protected]>
---
 Documentation/sysfs-entries.txt |  3 +++
 driver/sysfs.c                  | 22 ++++++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/Documentation/sysfs-entries.txt b/Documentation/sysfs-entries.txt
index 0fc315a..6b483bb 100644
--- a/Documentation/sysfs-entries.txt
+++ b/Documentation/sysfs-entries.txt
@@ -16,7 +16,10 @@ can be used for monitoring the state of the hypervisor and 
its cells.
    |  |- state                  - "running", "running/locked", "shut down", or
    |  |                           "failed"
    |  |- cpus_assigned          - bitmask of assigned logical CPUs
+   |  |- cpus_assigned_list     - human readable list of assigned logical CPUs
    |  |- cpus_failed            - bitmask of logical CPUs that caused a failure
+   |  |- cpus_failed_list       - human readable list of logical CPUs that
+   |  |                           caused a failure
    |  `- statistics
    |     |- vmexits_total       - Total number of VM exits
    |     `- vmexits_<reason>    - VM exits due to <reason>
diff --git a/driver/sysfs.c b/driver/sysfs.c
index b6bf545..ce4dba7 100644
--- a/driver/sysfs.c
+++ b/driver/sysfs.c
@@ -218,6 +218,14 @@ static ssize_t cpus_assigned_show(struct kobject *kobj,
        return print_cpumask(buf, PAGE_SIZE, &cell->cpus_assigned, false);
 }
 
+static ssize_t cpus_assigned_list_show(struct kobject *kobj,
+                                 struct kobj_attribute *attr, char *buf)
+{
+       struct cell *cell = container_of(kobj, struct cell, kobj);
+
+       return print_cpumask(buf, PAGE_SIZE, &cell->cpus_assigned, true);
+}
+
 static ssize_t cpus_failed_show(struct kobject *kobj,
                                struct kobj_attribute *attr, char *buf)
 {
@@ -226,17 +234,31 @@ static ssize_t cpus_failed_show(struct kobject *kobj,
        return print_failed_cpus(buf, PAGE_SIZE, cell, false);
 }
 
+static ssize_t cpus_failed_list_show(struct kobject *kobj,
+                                 struct kobj_attribute *attr, char *buf)
+{
+       struct cell *cell = container_of(kobj, struct cell, kobj);
+
+       return print_failed_cpus(buf, PAGE_SIZE, cell, true);
+}
+
 static struct kobj_attribute cell_name_attr = __ATTR_RO(name);
 static struct kobj_attribute cell_state_attr = __ATTR_RO(state);
 static struct kobj_attribute cell_cpus_assigned_attr =
        __ATTR_RO(cpus_assigned);
+static struct kobj_attribute cell_cpus_assigned_list_attr =
+       __ATTR_RO(cpus_assigned_list);
 static struct kobj_attribute cell_cpus_failed_attr = __ATTR_RO(cpus_failed);
+static struct kobj_attribute cell_cpus_failed_list_attr =
+       __ATTR_RO(cpus_failed_list);
 
 static struct attribute *cell_attrs[] = {
        &cell_name_attr.attr,
        &cell_state_attr.attr,
        &cell_cpus_assigned_attr.attr,
+       &cell_cpus_assigned_list_attr.attr,
        &cell_cpus_failed_attr.attr,
+       &cell_cpus_failed_list_attr.attr,
        NULL,
 };
 
-- 
2.9.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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to