qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/cpu/cluster: Mark the cpu-cluster device with user_creatable = false
@ 2019-02-05 12:58 Thomas Huth
  2019-02-05 13:09 ` Peter Maydell
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Thomas Huth @ 2019-02-05 12:58 UTC (permalink / raw)
  To: Eduardo Habkost, Marcel Apfelbaum, qemu-devel
  Cc: qemu-arm, Peter Maydell, Luc Michel, Alistair Francis,
	qemu-trivial

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.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/cpu/cluster.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/cpu/cluster.c b/hw/cpu/cluster.c
index 25f9070..6f5f037 100644
--- a/hw/cpu/cluster.c
+++ b/hw/cpu/cluster.c
@@ -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 = {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/cpu/cluster: Mark the cpu-cluster device with user_creatable = false
  2019-02-05 12:58 [Qemu-devel] [PATCH] hw/cpu/cluster: Mark the cpu-cluster device with user_creatable = false Thomas Huth
@ 2019-02-05 13:09 ` Peter Maydell
  2019-02-05 13:21   ` Thomas Huth
  2019-02-05 15:20 ` Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Peter Maydell @ 2019-02-05 13:09 UTC (permalink / raw)
  To: Thomas Huth
  Cc: Eduardo Habkost, Marcel Apfelbaum, QEMU Developers, qemu-arm,
	Luc Michel, Alistair Francis, QEMU Trivial

On Tue, 5 Feb 2019 at 12:58, Thomas Huth <thuth@redhat.com> wrote:
>
> 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.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  hw/cpu/cluster.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/hw/cpu/cluster.c b/hw/cpu/cluster.c
> index 25f9070..6f5f037 100644
> --- a/hw/cpu/cluster.c
> +++ b/hw/cpu/cluster.c
> @@ -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: Peter Maydell <peter.maydell@linaro.org>

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/cpu/cluster: Mark the cpu-cluster device with user_creatable = false
  2019-02-05 13:09 ` Peter Maydell
@ 2019-02-05 13:21   ` Thomas Huth
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Huth @ 2019-02-05 13:21 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Eduardo Habkost, Marcel Apfelbaum, QEMU Developers, qemu-arm,
	Luc Michel, Alistair Francis, QEMU Trivial

On 2019-02-05 14:09, Peter Maydell wrote:
> On Tue, 5 Feb 2019 at 12:58, Thomas Huth <thuth@redhat.com> wrote:
>>
>> 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.
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>>  hw/cpu/cluster.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/hw/cpu/cluster.c b/hw/cpu/cluster.c
>> index 25f9070..6f5f037 100644
>> --- a/hw/cpu/cluster.c
>> +++ b/hw/cpu/cluster.c
>> @@ -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: Peter Maydell <peter.maydell@linaro.org>
> 
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/cpu/cluster: Mark the cpu-cluster device with user_creatable = false
  2019-02-05 12:58 [Qemu-devel] [PATCH] hw/cpu/cluster: Mark the cpu-cluster device with user_creatable = false Thomas Huth
  2019-02-05 13:09 ` Peter Maydell
@ 2019-02-05 15:20 ` Philippe Mathieu-Daudé
  2019-02-05 15:21 ` Luc Michel
  2019-02-06 14:56 ` [Qemu-devel] [Qemu-trivial] " Laurent Vivier
  3 siblings, 0 replies; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-02-05 15:20 UTC (permalink / raw)
  To: Thomas Huth, Eduardo Habkost, Marcel Apfelbaum, qemu-devel
  Cc: qemu-trivial, Peter Maydell, qemu-arm, Alistair Francis,
	Luc Michel

On 2/5/19 1:58 PM, Thomas Huth wrote:
> 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.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  hw/cpu/cluster.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/hw/cpu/cluster.c b/hw/cpu/cluster.c
> index 25f9070..6f5f037 100644
> --- a/hw/cpu/cluster.c
> +++ b/hw/cpu/cluster.c
> @@ -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 = {
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/cpu/cluster: Mark the cpu-cluster device with user_creatable = false
  2019-02-05 12:58 [Qemu-devel] [PATCH] hw/cpu/cluster: Mark the cpu-cluster device with user_creatable = false Thomas Huth
  2019-02-05 13:09 ` Peter Maydell
  2019-02-05 15:20 ` Philippe Mathieu-Daudé
@ 2019-02-05 15:21 ` Luc Michel
  2019-02-05 19:16   ` Alistair Francis
  2019-02-06 14:56 ` [Qemu-devel] [Qemu-trivial] " Laurent Vivier
  3 siblings, 1 reply; 7+ messages in thread
From: Luc Michel @ 2019-02-05 15:21 UTC (permalink / raw)
  To: Thomas Huth, Eduardo Habkost, Marcel Apfelbaum, qemu-devel
  Cc: qemu-arm, Peter Maydell, Alistair Francis, qemu-trivial

[-- Attachment #1: Type: text/plain, Size: 1121 bytes --]



On 2/5/19 1:58 PM, Thomas Huth wrote:
> 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.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>

> ---
>  hw/cpu/cluster.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/hw/cpu/cluster.c b/hw/cpu/cluster.c
> index 25f9070..6f5f037 100644
> --- a/hw/cpu/cluster.c
> +++ b/hw/cpu/cluster.c
> @@ -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 = {
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/cpu/cluster: Mark the cpu-cluster device with user_creatable = false
  2019-02-05 15:21 ` Luc Michel
@ 2019-02-05 19:16   ` Alistair Francis
  0 siblings, 0 replies; 7+ messages in thread
From: Alistair Francis @ 2019-02-05 19:16 UTC (permalink / raw)
  To: Luc Michel
  Cc: Thomas Huth, Eduardo Habkost, Marcel Apfelbaum,
	qemu-devel@nongnu.org Developers, QEMU Trivial, Peter Maydell,
	qemu-arm, Alistair Francis

On Tue, Feb 5, 2019 at 7:22 AM Luc Michel <luc.michel@greensocs.com> wrote:
>
>
>
> On 2/5/19 1:58 PM, Thomas Huth wrote:
> > 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.
> >
> > Signed-off-by: Thomas Huth <thuth@redhat.com>
> Reviewed-by: Luc Michel <luc.michel@greensocs.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

>
> > ---
> >  hw/cpu/cluster.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/hw/cpu/cluster.c b/hw/cpu/cluster.c
> > index 25f9070..6f5f037 100644
> > --- a/hw/cpu/cluster.c
> > +++ b/hw/cpu/cluster.c
> > @@ -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 = {
> >
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] hw/cpu/cluster: Mark the cpu-cluster device with user_creatable = false
  2019-02-05 12:58 [Qemu-devel] [PATCH] hw/cpu/cluster: Mark the cpu-cluster device with user_creatable = false Thomas Huth
                   ` (2 preceding siblings ...)
  2019-02-05 15:21 ` Luc Michel
@ 2019-02-06 14:56 ` Laurent Vivier
  3 siblings, 0 replies; 7+ messages in thread
From: Laurent Vivier @ 2019-02-06 14:56 UTC (permalink / raw)
  To: Thomas Huth, Eduardo Habkost, Marcel Apfelbaum, qemu-devel
  Cc: qemu-trivial, Peter Maydell, qemu-arm, Alistair Francis,
	Luc Michel

On 05/02/2019 13:58, Thomas Huth wrote:
> 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.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  hw/cpu/cluster.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/hw/cpu/cluster.c b/hw/cpu/cluster.c
> index 25f9070..6f5f037 100644
> --- a/hw/cpu/cluster.c
> +++ b/hw/cpu/cluster.c
> @@ -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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-02-06 14:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-05 12:58 [Qemu-devel] [PATCH] hw/cpu/cluster: Mark the cpu-cluster device with user_creatable = false Thomas Huth
2019-02-05 13:09 ` Peter Maydell
2019-02-05 13:21   ` Thomas Huth
2019-02-05 15:20 ` Philippe Mathieu-Daudé
2019-02-05 15:21 ` Luc Michel
2019-02-05 19:16   ` Alistair Francis
2019-02-06 14:56 ` [Qemu-devel] [Qemu-trivial] " Laurent Vivier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).