[Qemu-devel] [PATCH] hw/s390x: Mark the "sclpquiesce" device with user_creatable = false

Thomas Huth posted 1 patch 6 years, 6 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1507193105-15627-1-git-send-email-thuth@redhat.com
Test checkpatch passed
Test docker passed
Test s390x passed
hw/s390x/sclpquiesce.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
[Qemu-devel] [PATCH] hw/s390x: Mark the "sclpquiesce" device with user_creatable = false
Posted by Thomas Huth 6 years, 6 months ago
The "sclpquiesce" device is just an internal device that should not be
created by the user directly. Though it currently does not seem to cause
any obvious trouble when the user instantiates an additional device, let's
better mark it with user_creatable = false to avoid unexpected behavior,
e.g. because the quiesce notifier gets registered multiple times.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/s390x/sclpquiesce.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/hw/s390x/sclpquiesce.c b/hw/s390x/sclpquiesce.c
index 762cb18..0241643 100644
--- a/hw/s390x/sclpquiesce.c
+++ b/hw/s390x/sclpquiesce.c
@@ -118,8 +118,13 @@ static void quiesce_class_init(ObjectClass *klass, void *data)
     dc->reset = quiesce_reset;
     dc->vmsd = &vmstate_sclpquiesce;
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
-    k->init = quiesce_init;
+    /*
+     * Reason: This is just an internal device - the notifier should
+     * not be registered multiple times in quiesce_init()
+     */
+    dc->user_creatable = false;
 
+    k->init = quiesce_init;
     k->get_send_mask = send_mask;
     k->get_receive_mask = receive_mask;
     k->can_handle_event = can_handle_event;
-- 
1.8.3.1


Re: [Qemu-devel] [PATCH] hw/s390x: Mark the "sclpquiesce" device with user_creatable = false
Posted by Halil Pasic 6 years, 6 months ago

On 10/05/2017 10:45 AM, Thomas Huth wrote:
> The "sclpquiesce" device is just an internal device that should not be
> created by the user directly. Though it currently does not seem to cause
> any obvious trouble when the user instantiates an additional device, let's
> better mark it with user_creatable = false to avoid unexpected behavior,
> e.g. because the quiesce notifier gets registered multiple times.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com>

> ---
>  hw/s390x/sclpquiesce.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/s390x/sclpquiesce.c b/hw/s390x/sclpquiesce.c
> index 762cb18..0241643 100644
> --- a/hw/s390x/sclpquiesce.c
> +++ b/hw/s390x/sclpquiesce.c
> @@ -118,8 +118,13 @@ static void quiesce_class_init(ObjectClass *klass, void *data)
>      dc->reset = quiesce_reset;
>      dc->vmsd = &vmstate_sclpquiesce;
>      set_bit(DEVICE_CATEGORY_MISC, dc->categories);
> -    k->init = quiesce_init;
> +    /*
> +     * Reason: This is just an internal device - the notifier should
> +     * not be registered multiple times in quiesce_init()
> +     */
> +    dc->user_creatable = false;
> 
> +    k->init = quiesce_init;
>      k->get_send_mask = send_mask;
>      k->get_receive_mask = receive_mask;
>      k->can_handle_event = can_handle_event;
> 


Re: [Qemu-devel] [PATCH] hw/s390x: Mark the "sclpquiesce" device with user_creatable = false
Posted by Claudio Imbrenda 6 years, 6 months ago
On Thu,  5 Oct 2017 10:45:05 +0200
Thomas Huth <thuth@redhat.com> wrote:

> The "sclpquiesce" device is just an internal device that should not be
> created by the user directly. Though it currently does not seem to
> cause any obvious trouble when the user instantiates an additional
> device, let's better mark it with user_creatable = false to avoid
> unexpected behavior, e.g. because the quiesce notifier gets
> registered multiple times.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>


Reviewed-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>

> ---
>  hw/s390x/sclpquiesce.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/s390x/sclpquiesce.c b/hw/s390x/sclpquiesce.c
> index 762cb18..0241643 100644
> --- a/hw/s390x/sclpquiesce.c
> +++ b/hw/s390x/sclpquiesce.c
> @@ -118,8 +118,13 @@ static void quiesce_class_init(ObjectClass
> *klass, void *data) dc->reset = quiesce_reset;
>      dc->vmsd = &vmstate_sclpquiesce;
>      set_bit(DEVICE_CATEGORY_MISC, dc->categories);
> -    k->init = quiesce_init;
> +    /*
> +     * Reason: This is just an internal device - the notifier should
> +     * not be registered multiple times in quiesce_init()
> +     */
> +    dc->user_creatable = false;
> 
> +    k->init = quiesce_init;
>      k->get_send_mask = send_mask;
>      k->get_receive_mask = receive_mask;
>      k->can_handle_event = can_handle_event;


Re: [Qemu-devel] [PATCH] hw/s390x: Mark the "sclpquiesce" device with user_creatable = false
Posted by Cornelia Huck 6 years, 6 months ago
On Thu,  5 Oct 2017 10:45:05 +0200
Thomas Huth <thuth@redhat.com> wrote:

> The "sclpquiesce" device is just an internal device that should not be
> created by the user directly. Though it currently does not seem to cause
> any obvious trouble when the user instantiates an additional device, let's
> better mark it with user_creatable = false to avoid unexpected behavior,
> e.g. because the quiesce notifier gets registered multiple times.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  hw/s390x/sclpquiesce.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

Thanks, applied.