* [Qemu-devel] [PATCH] migration: equation is more proper than and to check LOADVM_QUIT
@ 2019-07-18 6:42 Wei Yang
2019-07-19 18:41 ` Dr. David Alan Gilbert
2019-08-07 17:50 ` Dr. David Alan Gilbert
0 siblings, 2 replies; 4+ messages in thread
From: Wei Yang @ 2019-07-18 6:42 UTC (permalink / raw)
To: qemu-devel; +Cc: Wei Yang, dgilbert, quintela
LOADVM_QUIT allows a command to quit all layers of nested loadvm loops,
while current return value check is not that proper even it works now.
Current return value check "ret & LOADVM_QUIT" would return true if
bit[0] is 1. This would be true when ret is -1 which is used to indicate
an error of handling a command.
Since there is only one place return LOADVM_QUIT and no other
combination of return value, use "ret == LOADVM_QUIT" would be more
proper.
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
---
migration/savevm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/migration/savevm.c b/migration/savevm.c
index 1a9b1f411e..25fe7ea05a 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2429,7 +2429,7 @@ retry:
case QEMU_VM_COMMAND:
ret = loadvm_process_command(f);
trace_qemu_loadvm_state_section_command(ret);
- if ((ret < 0) || (ret & LOADVM_QUIT)) {
+ if ((ret < 0) || (ret == LOADVM_QUIT)) {
goto out;
}
break;
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] migration: equation is more proper than and to check LOADVM_QUIT
2019-07-18 6:42 [Qemu-devel] [PATCH] migration: equation is more proper than and to check LOADVM_QUIT Wei Yang
@ 2019-07-19 18:41 ` Dr. David Alan Gilbert
2019-07-20 1:52 ` Wei Yang
2019-08-07 17:50 ` Dr. David Alan Gilbert
1 sibling, 1 reply; 4+ messages in thread
From: Dr. David Alan Gilbert @ 2019-07-19 18:41 UTC (permalink / raw)
To: Wei Yang; +Cc: qemu-devel, quintela
* Wei Yang (richardw.yang@linux.intel.com) wrote:
> LOADVM_QUIT allows a command to quit all layers of nested loadvm loops,
> while current return value check is not that proper even it works now.
>
> Current return value check "ret & LOADVM_QUIT" would return true if
> bit[0] is 1. This would be true when ret is -1 which is used to indicate
> an error of handling a command.
>
> Since there is only one place return LOADVM_QUIT and no other
> combination of return value, use "ret == LOADVM_QUIT" would be more
> proper.
Yes, when I first wrote this it was more complex with a few flags, and
they all got removed.
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> migration/savevm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 1a9b1f411e..25fe7ea05a 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -2429,7 +2429,7 @@ retry:
> case QEMU_VM_COMMAND:
> ret = loadvm_process_command(f);
> trace_qemu_loadvm_state_section_command(ret);
> - if ((ret < 0) || (ret & LOADVM_QUIT)) {
> + if ((ret < 0) || (ret == LOADVM_QUIT)) {
> goto out;
> }
> break;
> --
> 2.17.1
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] migration: equation is more proper than and to check LOADVM_QUIT
2019-07-19 18:41 ` Dr. David Alan Gilbert
@ 2019-07-20 1:52 ` Wei Yang
0 siblings, 0 replies; 4+ messages in thread
From: Wei Yang @ 2019-07-20 1:52 UTC (permalink / raw)
To: Dr. David Alan Gilbert; +Cc: quintela, Wei Yang, qemu-devel
On Fri, Jul 19, 2019 at 07:41:28PM +0100, Dr. David Alan Gilbert wrote:
>* Wei Yang (richardw.yang@linux.intel.com) wrote:
>> LOADVM_QUIT allows a command to quit all layers of nested loadvm loops,
>> while current return value check is not that proper even it works now.
>>
>> Current return value check "ret & LOADVM_QUIT" would return true if
>> bit[0] is 1. This would be true when ret is -1 which is used to indicate
>> an error of handling a command.
>>
>> Since there is only one place return LOADVM_QUIT and no other
>> combination of return value, use "ret == LOADVM_QUIT" would be more
>> proper.
>
>Yes, when I first wrote this it was more complex with a few flags, and
>they all got removed.
>
Ah, life is much easier now :-)
>> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
>
>Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>
>> ---
>> migration/savevm.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/migration/savevm.c b/migration/savevm.c
>> index 1a9b1f411e..25fe7ea05a 100644
>> --- a/migration/savevm.c
>> +++ b/migration/savevm.c
>> @@ -2429,7 +2429,7 @@ retry:
>> case QEMU_VM_COMMAND:
>> ret = loadvm_process_command(f);
>> trace_qemu_loadvm_state_section_command(ret);
>> - if ((ret < 0) || (ret & LOADVM_QUIT)) {
>> + if ((ret < 0) || (ret == LOADVM_QUIT)) {
>> goto out;
>> }
>> break;
>> --
>> 2.17.1
>>
>--
>Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
--
Wei Yang
Help you, Help me
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] migration: equation is more proper than and to check LOADVM_QUIT
2019-07-18 6:42 [Qemu-devel] [PATCH] migration: equation is more proper than and to check LOADVM_QUIT Wei Yang
2019-07-19 18:41 ` Dr. David Alan Gilbert
@ 2019-08-07 17:50 ` Dr. David Alan Gilbert
1 sibling, 0 replies; 4+ messages in thread
From: Dr. David Alan Gilbert @ 2019-08-07 17:50 UTC (permalink / raw)
To: Wei Yang; +Cc: qemu-devel, quintela
* Wei Yang (richardw.yang@linux.intel.com) wrote:
> LOADVM_QUIT allows a command to quit all layers of nested loadvm loops,
> while current return value check is not that proper even it works now.
>
> Current return value check "ret & LOADVM_QUIT" would return true if
> bit[0] is 1. This would be true when ret is -1 which is used to indicate
> an error of handling a command.
>
> Since there is only one place return LOADVM_QUIT and no other
> combination of return value, use "ret == LOADVM_QUIT" would be more
> proper.
>
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Queued
> ---
> migration/savevm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 1a9b1f411e..25fe7ea05a 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -2429,7 +2429,7 @@ retry:
> case QEMU_VM_COMMAND:
> ret = loadvm_process_command(f);
> trace_qemu_loadvm_state_section_command(ret);
> - if ((ret < 0) || (ret & LOADVM_QUIT)) {
> + if ((ret < 0) || (ret == LOADVM_QUIT)) {
> goto out;
> }
> break;
> --
> 2.17.1
>
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-08-07 17:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-18 6:42 [Qemu-devel] [PATCH] migration: equation is more proper than and to check LOADVM_QUIT Wei Yang
2019-07-19 18:41 ` Dr. David Alan Gilbert
2019-07-20 1:52 ` Wei Yang
2019-08-07 17:50 ` Dr. David Alan Gilbert
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).