All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-trivial] [Qemu-devel][PATCH] fix return check for KVM_GET_DIRTY_LOG ioctl
@ 2014-03-19 17:24 ` Mario Smarduch
  0 siblings, 0 replies; 6+ messages in thread
From: Mario Smarduch @ 2014-03-19 17:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial


Fix return condition check from kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) to
handle internal failures or no support for memory slot dirty bitmap.
Otherwise the ioctl succeeds and continues with migration.
Addresses BUG# 1294227

Signed-off-by: Mario Smarduch <m.smarduch@samsung.com>
---
 kvm-all.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kvm-all.c b/kvm-all.c
index 82a9119..cd4111d 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -441,7 +441,7 @@ static int kvm_physical_sync_dirty_bitmap(MemoryRegionSection *section)
 
         d.slot = mem->slot;
 
-        if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {
+        if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) < 0) {
             DPRINTF("ioctl failed %d\n", errno);
             ret = -1;
             break;
-- 
1.7.9.5





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

* [Qemu-devel] [PATCH] fix return check for KVM_GET_DIRTY_LOG ioctl
@ 2014-03-19 17:24 ` Mario Smarduch
  0 siblings, 0 replies; 6+ messages in thread
From: Mario Smarduch @ 2014-03-19 17:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial


Fix return condition check from kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) to
handle internal failures or no support for memory slot dirty bitmap.
Otherwise the ioctl succeeds and continues with migration.
Addresses BUG# 1294227

Signed-off-by: Mario Smarduch <m.smarduch@samsung.com>
---
 kvm-all.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kvm-all.c b/kvm-all.c
index 82a9119..cd4111d 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -441,7 +441,7 @@ static int kvm_physical_sync_dirty_bitmap(MemoryRegionSection *section)
 
         d.slot = mem->slot;
 
-        if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {
+        if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) < 0) {
             DPRINTF("ioctl failed %d\n", errno);
             ret = -1;
             break;
-- 
1.7.9.5

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

* Re: [Qemu-trivial] [Qemu-devel][PATCH] fix return check for KVM_GET_DIRTY_LOG ioctl
  2014-03-19 17:24 ` [Qemu-devel] [PATCH] " Mario Smarduch
@ 2014-03-20 15:45   ` Michael Tokarev
  -1 siblings, 0 replies; 6+ messages in thread
From: Michael Tokarev @ 2014-03-20 15:45 UTC (permalink / raw)
  To: Mario Smarduch; +Cc: qemu-trivial, qemu-devel

19.03.2014 21:24, Mario Smarduch wrote:
> 
> Fix return condition check from kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) to
> handle internal failures or no support for memory slot dirty bitmap.
> Otherwise the ioctl succeeds and continues with migration.
> Addresses BUG# 1294227

Thanks, applied to -trivial.

[]
> -        if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {
> +        if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) < 0) {

Actually I'd make all error checks like this.  Many checks compares
return value with -1 for some reason, while actually, any <0 value
should be treated as error in many many places...  At the same time,
comparison with 0 is cheaper than comparison with -1 ;)

/mjt


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

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] fix return check for KVM_GET_DIRTY_LOG ioctl
@ 2014-03-20 15:45   ` Michael Tokarev
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Tokarev @ 2014-03-20 15:45 UTC (permalink / raw)
  To: Mario Smarduch; +Cc: qemu-trivial, qemu-devel

19.03.2014 21:24, Mario Smarduch wrote:
> 
> Fix return condition check from kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) to
> handle internal failures or no support for memory slot dirty bitmap.
> Otherwise the ioctl succeeds and continues with migration.
> Addresses BUG# 1294227

Thanks, applied to -trivial.

[]
> -        if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {
> +        if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) < 0) {

Actually I'd make all error checks like this.  Many checks compares
return value with -1 for some reason, while actually, any <0 value
should be treated as error in many many places...  At the same time,
comparison with 0 is cheaper than comparison with -1 ;)

/mjt

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

* Re: [Qemu-trivial] [Qemu-devel][PATCH] fix return check for KVM_GET_DIRTY_LOG ioctl
  2014-03-20 15:45   ` [Qemu-devel] [Qemu-trivial] [PATCH] " Michael Tokarev
@ 2014-03-20 16:38     ` Mario Smarduch
  -1 siblings, 0 replies; 6+ messages in thread
From: Mario Smarduch @ 2014-03-20 16:38 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: qemu-trivial, qemu-devel


I agree. One thing I forgot to mention andother side effect
of this bug was virtio VRing used, avail index error 
the Guest was 1,2,..  less then host.

I looked up that bug it happend on some architectures. 
This may or may not be related. Obviously if the dirty
bitmap is not processed properly you may see issues like that.

- Mario 

On 03/20/2014 08:45 AM, Michael Tokarev wrote:
> 19.03.2014 21:24, Mario Smarduch wrote:
>>
>> Fix return condition check from kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) to
>> handle internal failures or no support for memory slot dirty bitmap.
>> Otherwise the ioctl succeeds and continues with migration.
>> Addresses BUG# 1294227
> 
> Thanks, applied to -trivial.
> 
> []
>> -        if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {
>> +        if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) < 0) {
> 
> Actually I'd make all error checks like this.  Many checks compares
> return value with -1 for some reason, while actually, any <0 value
> should be treated as error in many many places...  At the same time,
> comparison with 0 is cheaper than comparison with -1 ;)
> 
> /mjt
> 



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

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] fix return check for KVM_GET_DIRTY_LOG ioctl
@ 2014-03-20 16:38     ` Mario Smarduch
  0 siblings, 0 replies; 6+ messages in thread
From: Mario Smarduch @ 2014-03-20 16:38 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: qemu-trivial, qemu-devel


I agree. One thing I forgot to mention andother side effect
of this bug was virtio VRing used, avail index error 
the Guest was 1,2,..  less then host.

I looked up that bug it happend on some architectures. 
This may or may not be related. Obviously if the dirty
bitmap is not processed properly you may see issues like that.

- Mario 

On 03/20/2014 08:45 AM, Michael Tokarev wrote:
> 19.03.2014 21:24, Mario Smarduch wrote:
>>
>> Fix return condition check from kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) to
>> handle internal failures or no support for memory slot dirty bitmap.
>> Otherwise the ioctl succeeds and continues with migration.
>> Addresses BUG# 1294227
> 
> Thanks, applied to -trivial.
> 
> []
>> -        if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {
>> +        if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) < 0) {
> 
> Actually I'd make all error checks like this.  Many checks compares
> return value with -1 for some reason, while actually, any <0 value
> should be treated as error in many many places...  At the same time,
> comparison with 0 is cheaper than comparison with -1 ;)
> 
> /mjt
> 

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

end of thread, other threads:[~2014-03-20 16:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-19 17:24 [Qemu-trivial] [Qemu-devel][PATCH] fix return check for KVM_GET_DIRTY_LOG ioctl Mario Smarduch
2014-03-19 17:24 ` [Qemu-devel] [PATCH] " Mario Smarduch
2014-03-20 15:45 ` [Qemu-trivial] [Qemu-devel][PATCH] " Michael Tokarev
2014-03-20 15:45   ` [Qemu-devel] [Qemu-trivial] [PATCH] " Michael Tokarev
2014-03-20 16:38   ` [Qemu-trivial] [Qemu-devel][PATCH] " Mario Smarduch
2014-03-20 16:38     ` [Qemu-devel] [Qemu-trivial] [PATCH] " Mario Smarduch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.