diff mbox

vl: chanage runstate only if new state is different from current state

Message ID 1460539671-11326-1-git-send-email-lizhijian@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Li Zhijian April 13, 2016, 9:27 a.m. UTC
Previously, qemu will abort at following scenario:
(qemu) stop
(qemu) system_reset
(qemu) system_reset
(qemu) 2016-04-13T20:54:38.979158Z qemu-system-x86_64: invalid runstate transition: 'prelaunch' -> 'prelaunch'

Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
---
 vl.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Paolo Bonzini April 13, 2016, 11:57 a.m. UTC | #1
On 13/04/2016 11:27, Li Zhijian wrote:
> Previously, qemu will abort at following scenario:
> (qemu) stop
> (qemu) system_reset
> (qemu) system_reset
> (qemu) 2016-04-13T20:54:38.979158Z qemu-system-x86_64: invalid runstate transition: 'prelaunch' -> 'prelaunch'
> 
> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>

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

Can someone I've CCed help this patch, since I won't be able to send a
pull request?

Paolo

>  vl.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/vl.c b/vl.c
> index 9df534f..039a353 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -692,6 +692,10 @@ void runstate_set(RunState new_state)
>  {
>      assert(new_state < RUN_STATE__MAX);
>  
> +    if (current_run_state == new_state) {
> +        return ;
> +    }
> +
>      if (!runstate_valid_transitions[current_run_state][new_state]) {
>          error_report("invalid runstate transition: '%s' -> '%s'",
>                       RunState_lookup[current_run_state],
>
Li Zhijian April 14, 2016, 3:28 a.m. UTC | #2
I send V2 with minor fix
- fix patch title typo 'chanage' -> 'change'
- coding sytle: 'return ;' -> 'return;'
- add Acked tag

pls review the V2.

Best regards
Li Zhijian


On 04/13/2016 07:57 PM, Paolo Bonzini wrote:
> On 13/04/2016 11:27, Li Zhijian wrote:
>> Previously, qemu will abort at following scenario:
>> (qemu) stop
>> (qemu) system_reset
>> (qemu) system_reset
>> (qemu) 2016-04-13T20:54:38.979158Z qemu-system-x86_64: invalid runstate transition: 'prelaunch' -> 'prelaunch'
>>
>> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
>
> Acked-by: Paolo Bonzini <pbonzini@redhat.com>
>
> Can someone I've CCed help this patch, since I won't be able to send a
> pull request?
>
> Paolo
>
>>   vl.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/vl.c b/vl.c
>> index 9df534f..039a353 100644
>> --- a/vl.c
>> +++ b/vl.c
>> @@ -692,6 +692,10 @@ void runstate_set(RunState new_state)
>>   {
>>       assert(new_state < RUN_STATE__MAX);
>>
>> +    if (current_run_state == new_state) {
>> +        return ;
>> +    }
>> +
>>       if (!runstate_valid_transitions[current_run_state][new_state]) {
>>           error_report("invalid runstate transition: '%s' -> '%s'",
>>                        RunState_lookup[current_run_state],
>>
>
>
>
diff mbox

Patch

diff --git a/vl.c b/vl.c
index 9df534f..039a353 100644
--- a/vl.c
+++ b/vl.c
@@ -692,6 +692,10 @@  void runstate_set(RunState new_state)
 {
     assert(new_state < RUN_STATE__MAX);
 
+    if (current_run_state == new_state) {
+        return ;
+    }
+
     if (!runstate_valid_transitions[current_run_state][new_state]) {
         error_report("invalid runstate transition: '%s' -> '%s'",
                      RunState_lookup[current_run_state],