diff mbox

[v2,12/23] vl: run "late" notifiers immediately

Message ID 1433351328-23326-13-git-send-email-pbonzini@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini June 3, 2015, 5:08 p.m. UTC
If a machine_init_done notifier is added late, as part of a hot-plugged
device, run it immediately.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 vl.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Peter Crosthwaite June 4, 2015, 6:39 a.m. UTC | #1
On Wed, Jun 3, 2015 at 10:08 AM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> If a machine_init_done notifier is added late, as part of a hot-plugged
> device, run it immediately.

Blank line?

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

> ---
>  vl.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/vl.c b/vl.c
> index 0707cfa..00def69 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2498,14 +2498,20 @@ static void qemu_run_exit_notifiers(void)
>      notifier_list_notify(&exit_notifiers, NULL);
>  }
>
> +static bool machine_init_done;
> +
>  void qemu_add_machine_init_done_notifier(Notifier *notify)
>  {
>      notifier_list_add(&machine_init_done_notifiers, notify);
> +    if (machine_init_done) {
> +        notify->notify(notify, NULL);
> +    }
>  }
>
>  static void qemu_run_machine_init_done_notifiers(void)
>  {
>      notifier_list_notify(&machine_init_done_notifiers, NULL);
> +    machine_init_done = true;
>  }
>
>  static const QEMUOption *lookup_opt(int argc, char **argv,
> --
> 2.4.1
>
>
>
Paolo Bonzini June 4, 2015, 8:03 a.m. UTC | #2
On 04/06/2015 08:39, Peter Crosthwaite wrote:
> On Wed, Jun 3, 2015 at 10:08 AM, Paolo Bonzini <pbonzini@redhat.com> wrote:
>> If a machine_init_done notifier is added late, as part of a hot-plugged
>> device, run it immediately.
> 
> Blank line?

Yes, thanks.

Paolo

>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> 
> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> 
>> ---
>>  vl.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/vl.c b/vl.c
>> index 0707cfa..00def69 100644
>> --- a/vl.c
>> +++ b/vl.c
>> @@ -2498,14 +2498,20 @@ static void qemu_run_exit_notifiers(void)
>>      notifier_list_notify(&exit_notifiers, NULL);
>>  }
>>
>> +static bool machine_init_done;
>> +
>>  void qemu_add_machine_init_done_notifier(Notifier *notify)
>>  {
>>      notifier_list_add(&machine_init_done_notifiers, notify);
>> +    if (machine_init_done) {
>> +        notify->notify(notify, NULL);
>> +    }
>>  }
>>
>>  static void qemu_run_machine_init_done_notifiers(void)
>>  {
>>      notifier_list_notify(&machine_init_done_notifiers, NULL);
>> +    machine_init_done = true;
>>  }
>>
>>  static const QEMUOption *lookup_opt(int argc, char **argv,
>> --
>> 2.4.1
>>
>>
>>
diff mbox

Patch

diff --git a/vl.c b/vl.c
index 0707cfa..00def69 100644
--- a/vl.c
+++ b/vl.c
@@ -2498,14 +2498,20 @@  static void qemu_run_exit_notifiers(void)
     notifier_list_notify(&exit_notifiers, NULL);
 }
 
+static bool machine_init_done;
+
 void qemu_add_machine_init_done_notifier(Notifier *notify)
 {
     notifier_list_add(&machine_init_done_notifiers, notify);
+    if (machine_init_done) {
+        notify->notify(notify, NULL);
+    }
 }
 
 static void qemu_run_machine_init_done_notifiers(void)
 {
     notifier_list_notify(&machine_init_done_notifiers, NULL);
+    machine_init_done = true;
 }
 
 static const QEMUOption *lookup_opt(int argc, char **argv,