Skip to contentSkip to conversation

hw/cpu/cluster: Mark the cpu-cluster device with user_creatable = false

PATCH Applied Thomas Huth 6 participants 7 messages Feb 5, 2019 – Feb 6, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/cpu/cluster: Mark the cpu-cluster device with user_creatable = false

The device can not be instantiated by the user and QEMU currently aborts when you try to use it:

$ x86_64-softmmu/qemu-system-x86_64 -device cpu-cluster
qemu-system-x86_64: hw/cpu/cluster.c:73: cpu_cluster_realize:
 Assertion `cbdata.cpu_count > 0' failed.
Aborted (core dumped)

Since this is an internal device only, mark it with user_creatable = false.

---
 hw/cpu/cluster.c | 3 +++
 1 file changed, 3 insertions(+)
hw/cpu/cluster.c +3 -0
index 25f9070..6f5f037 100644
@@ -79,6 +79,9 @@ static void cpu_cluster_class_init(ObjectClass *klass, void *data)
 
     dc->props = cpu_cluster_properties;
     dc->realize = cpu_cluster_realize;
+
+    /* This is not directly for users, CPU children must be attached by code */
+    dc->user_creatable = false;
 }
 
 static const TypeInfo cpu_cluster_type_info = {
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 21 lines · Thomas Huth

The device can not be instantiated by the user and QEMU currently aborts when you try to use it:

$ x86_64-softmmu/qemu-system-x86_64 -device cpu-cluster
qemu-system-x86_64: hw/cpu/cluster.c:73: cpu_cluster_realize:
 Assertion `cbdata.cpu_count > 0' failed.
Aborted (core dumped)

Since this is an internal device only, mark it with user_creatable = false.

---
 hw/cpu/cluster.c | 3 +++
 1 file changed, 3 insertions(+)
hw/cpu/cluster.c +0 -0
index 25f9070..6f5f037 100644

hw/cpu/cluster.c static void cpu_cluster_class_init(ObjectClass *klass, void *data)

Quoted 10 lines
hw/cpu/cluster.c +3 -1
@@ -79,6 +79,9 @@ static void cpu_cluster_class_init(ObjectClass *klass, void *data)
 
     dc->props = cpu_cluster_properties;
     dc->realize = cpu_cluster_realize;
+
+    /* This is not directly for users, CPU children must be attached by code */
+    dc->user_creatable = false;
 }
 
 static const TypeInfo cpu_cluster_type_info = {
--

Would it be possible to add a 'make check' test that every device we claim to be user-creatable can be created without crashing ?

thanks
-- PMM

#2 lore raw
Quoted 30 lines · Peter Maydell
Quoted 29 lines · Thomas Huth

The device can not be instantiated by the user and QEMU currently aborts when you try to use it:

$ x86_64-softmmu/qemu-system-x86_64 -device cpu-cluster
qemu-system-x86_64: hw/cpu/cluster.c:73: cpu_cluster_realize:
 Assertion `cbdata.cpu_count > 0' failed.
Aborted (core dumped)

Since this is an internal device only, mark it with user_creatable = false.

---
 hw/cpu/cluster.c | 3 +++
 1 file changed, 3 insertions(+)
hw/cpu/cluster.c +3 -0
index 25f9070..6f5f037 100644
@@ -79,6 +79,9 @@ static void cpu_cluster_class_init(ObjectClass *klass, void *data)
 
     dc->props = cpu_cluster_properties;
     dc->realize = cpu_cluster_realize;
+
+    /* This is not directly for users, CPU children must be attached by code */
+    dc->user_creatable = false;
 }
 
Quoted 8 lines

hw/cpu/cluster.c static void cpu_cluster_class_init(ObjectClass *klass, void *data)

Quoted 2 lines
hw/cpu/cluster.c +0 -1
 static const TypeInfo cpu_cluster_type_info = {
--

Would it be possible to add a 'make check' test that every device we claim to be user-creatable can be created without crashing ?

That's what Eduardo's scripts/device-crash-test is good for. It's just too slow to run during "make check" currently, since it checks each device with each machine type... But IIRC Eduardo once had ideas to improve this...?

Thomas

Reviewed-by on v1 1/1
#3 lore raw
In reply to Thomas Huth
Quoted 11 lines · Thomas Huth

The device can not be instantiated by the user and QEMU currently aborts when you try to use it:

$ x86_64-softmmu/qemu-system-x86_64 -device cpu-cluster
qemu-system-x86_64: hw/cpu/cluster.c:73: cpu_cluster_realize:
 Assertion `cbdata.cpu_count > 0' failed.
Aborted (core dumped)

Since this is an internal device only, mark it with user_creatable = false.

Quoted 19 lines
---
 hw/cpu/cluster.c | 3 +++
 1 file changed, 3 insertions(+)
hw/cpu/cluster.c +3 -0
index 25f9070..6f5f037 100644
@@ -79,6 +79,9 @@ static void cpu_cluster_class_init(ObjectClass *klass, void *data)
 
     dc->props = cpu_cluster_properties;
     dc->realize = cpu_cluster_realize;
+
+    /* This is not directly for users, CPU children must be attached by code */
+    dc->user_creatable = false;
 }
 
 static const TypeInfo cpu_cluster_type_info = {
Reviewed-by on v1 1/1
#4 lore raw
In reply to Thomas Huth
Quoted 11 lines · Thomas Huth

The device can not be instantiated by the user and QEMU currently aborts when you try to use it:

$ x86_64-softmmu/qemu-system-x86_64 -device cpu-cluster
qemu-system-x86_64: hw/cpu/cluster.c:73: cpu_cluster_realize:
 Assertion `cbdata.cpu_count > 0' failed.
Aborted (core dumped)

Since this is an internal device only, mark it with user_creatable = false.

Quoted 19 lines
---
 hw/cpu/cluster.c | 3 +++
 1 file changed, 3 insertions(+)
hw/cpu/cluster.c +3 -0
index 25f9070..6f5f037 100644
@@ -79,6 +79,9 @@ static void cpu_cluster_class_init(ObjectClass *klass, void *data)
 
     dc->props = cpu_cluster_properties;
     dc->realize = cpu_cluster_realize;
+
+    /* This is not directly for users, CPU children must be attached by code */
+    dc->user_creatable = false;
 }
 
 static const TypeInfo cpu_cluster_type_info = {
Reviewed-by
#5 lore raw
Quoted 12 lines · Luc Michel
Quoted 8 lines · Thomas Huth

The device can not be instantiated by the user and QEMU currently aborts when you try to use it:

$ x86_64-softmmu/qemu-system-x86_64 -device cpu-cluster
qemu-system-x86_64: hw/cpu/cluster.c:73: cpu_cluster_realize:
 Assertion `cbdata.cpu_count > 0' failed.
Aborted (core dumped)
Quoted 4 lines
Quoted 3 lines

Since this is an internal device only, mark it with user_creatable = false.

Alistair

Quoted 21 lines
Quoted 20 lines
---
 hw/cpu/cluster.c | 3 +++
 1 file changed, 3 insertions(+)
hw/cpu/cluster.c +3 -0
index 25f9070..6f5f037 100644
@@ -79,6 +79,9 @@ static void cpu_cluster_class_init(ObjectClass *klass, void *data)
 
     dc->props = cpu_cluster_properties;
     dc->realize = cpu_cluster_realize;
+
+    /* This is not directly for users, CPU children must be attached by code */
+    dc->user_creatable = false;
 }
 
 static const TypeInfo cpu_cluster_type_info = {
#6 lore raw
In reply to Thomas Huth
Quoted 21 lines · Thomas Huth

The device can not be instantiated by the user and QEMU currently aborts when you try to use it:

$ x86_64-softmmu/qemu-system-x86_64 -device cpu-cluster
qemu-system-x86_64: hw/cpu/cluster.c:73: cpu_cluster_realize:
 Assertion `cbdata.cpu_count > 0' failed.
Aborted (core dumped)

Since this is an internal device only, mark it with user_creatable = false.

---
 hw/cpu/cluster.c | 3 +++
 1 file changed, 3 insertions(+)
hw/cpu/cluster.c +0 -0
index 25f9070..6f5f037 100644

hw/cpu/cluster.c static void cpu_cluster_class_init(ObjectClass *klass, void *data) · line 87

Quoted 9 lines
hw/cpu/cluster.c +3 -0
@@ -79,6 +79,9 @@ static void cpu_cluster_class_init(ObjectClass *klass, void *data)
 
     dc->props = cpu_cluster_properties;
     dc->realize = cpu_cluster_realize;
+
+    /* This is not directly for users, CPU children must be attached by code */
+    dc->user_creatable = false;
 }
 
 static const TypeInfo cpu_cluster_type_info = {

Applied to my trivial-patches branch.

Thanks,
Laurent