* [Qemu-devel] [PATCH 1/1] kvm_physical_sync_dirty_bitmap: ignore ENOENT from kvm_vm_ioctl
@ 2014-04-09 3:21 Serge Hallyn
2014-04-09 3:31 ` Serge E. Hallyn
2014-04-10 16:30 ` Michael Tokarev
0 siblings, 2 replies; 4+ messages in thread
From: Serge Hallyn @ 2014-04-09 3:21 UTC (permalink / raw)
To: qemu-devel; +Cc: Michael Tokarev, 1303926, Mario Smarduch
ENOENT (iiuc) means the kernel has an empty dirty bitmap for this
slot. Don't abort in that case. This appears to solve the bug
reported at
https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1303926
which first showed up with commit b533f658a98325d: fix return check for
KVM_GET_DIRTY_LOG ioctl
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
---
kvm-all.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/kvm-all.c b/kvm-all.c
index 82a9119..7b7ea8d 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -441,10 +441,13 @@ static int kvm_physical_sync_dirty_bitmap(MemoryRegionSection *section)
d.slot = mem->slot;
- if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {
+ ret = kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d);
+ if (ret < 0 && ret != -ENOENT) {
DPRINTF("ioctl failed %d\n", errno);
ret = -1;
break;
+ } else if (ret < 0) {
+ ret = 0;
}
kvm_get_dirty_pages_log_range(section, d.dirty_bitmap);
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 1/1] kvm_physical_sync_dirty_bitmap: ignore ENOENT from kvm_vm_ioctl
2014-04-09 3:21 [Qemu-devel] [PATCH 1/1] kvm_physical_sync_dirty_bitmap: ignore ENOENT from kvm_vm_ioctl Serge Hallyn
@ 2014-04-09 3:31 ` Serge E. Hallyn
2014-04-10 16:30 ` Michael Tokarev
1 sibling, 0 replies; 4+ messages in thread
From: Serge E. Hallyn @ 2014-04-09 3:31 UTC (permalink / raw)
To: Serge Hallyn; +Cc: Michael Tokarev, qemu-devel, 1303926, Mario Smarduch
D'oh, sorry. I generated that patch against my qemu tree at the bad_commit^.
That won't apply to the tree... this should.
>From 0d818e334f6db88b2770e9a1076ae1e68c41e460 Mon Sep 17 00:00:00 2001
From: Serge Hallyn <serge.hallyn@ubuntu.com>
Date: Tue, 8 Apr 2014 22:14:20 -0500
Subject: [PATCH 1/1] kvm_physical_sync_dirty_bitmap: ignore ENOENT from
kvm_vm_ioctl
ENOENT (iiuc) means the kernel has an empty dirty bitmap for this
slot. Don't abort in that case. This appears to solve the bug
reported at
https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1303926
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
---
kvm-all.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Index: qemu-2.0.0~rc1+dfsg/kvm-all.c
===================================================================
--- qemu-2.0.0~rc1+dfsg.orig/kvm-all.c 2014-04-08 22:28:38.000722081 -0500
+++ qemu-2.0.0~rc1+dfsg/kvm-all.c 2014-04-08 22:29:14.644722904 -0500
@@ -441,10 +441,13 @@ static int kvm_physical_sync_dirty_bitma
d.slot = mem->slot;
- if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) < 0) {
+ ret = kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d);
+ if (ret < 0 && ret != -ENOENT) {
DPRINTF("ioctl failed %d\n", errno);
ret = -1;
break;
+ } else if (ret < 0) {
+ ret = 0;
}
kvm_get_dirty_pages_log_range(section, d.dirty_bitmap);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 1/1] kvm_physical_sync_dirty_bitmap: ignore ENOENT from kvm_vm_ioctl
2014-04-09 3:21 [Qemu-devel] [PATCH 1/1] kvm_physical_sync_dirty_bitmap: ignore ENOENT from kvm_vm_ioctl Serge Hallyn
2014-04-09 3:31 ` Serge E. Hallyn
@ 2014-04-10 16:30 ` Michael Tokarev
2014-04-10 18:47 ` Serge Hallyn
1 sibling, 1 reply; 4+ messages in thread
From: Michael Tokarev @ 2014-04-10 16:30 UTC (permalink / raw)
To: Serge Hallyn; +Cc: qemu-devel, 1303926, Mario Smarduch
09.04.2014 07:21, Serge Hallyn wrote:
> ENOENT (iiuc) means the kernel has an empty dirty bitmap for this
> slot. Don't abort in that case. This appears to solve the bug
> reported at
>
> https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1303926
>
> which first showed up with commit b533f658a98325d: fix return check for
> KVM_GET_DIRTY_LOG ioctl
>
> Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
> ---
> kvm-all.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/kvm-all.c b/kvm-all.c
> index 82a9119..7b7ea8d 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -441,10 +441,13 @@ static int kvm_physical_sync_dirty_bitmap(MemoryRegionSection *section)
>
> d.slot = mem->slot;
>
> - if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {
> + ret = kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d);
> + if (ret < 0 && ret != -ENOENT) {
> DPRINTF("ioctl failed %d\n", errno);
> ret = -1;
> break;
> + } else if (ret < 0) {
> + ret = 0;
> }
>
> kvm_get_dirty_pages_log_range(section, d.dirty_bitmap);
Should we omit calling kvm_get_dirty_pages_log_range() if there's
no bitmap from kernel? In particular, do we trust kernel to not
touch d.dirty_bitmap when it returns ENOENT?
Thanks,
/mjt
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 1/1] kvm_physical_sync_dirty_bitmap: ignore ENOENT from kvm_vm_ioctl
2014-04-10 16:30 ` Michael Tokarev
@ 2014-04-10 18:47 ` Serge Hallyn
0 siblings, 0 replies; 4+ messages in thread
From: Serge Hallyn @ 2014-04-10 18:47 UTC (permalink / raw)
To: Michael Tokarev; +Cc: qemu-devel, 1303926, Mario Smarduch
Quoting Michael Tokarev (mjt@tls.msk.ru):
> 09.04.2014 07:21, Serge Hallyn wrote:
> > ENOENT (iiuc) means the kernel has an empty dirty bitmap for this
> > slot. Don't abort in that case. This appears to solve the bug
> > reported at
> >
> > https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1303926
> >
> > which first showed up with commit b533f658a98325d: fix return check for
> > KVM_GET_DIRTY_LOG ioctl
> >
> > Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
> > ---
> > kvm-all.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/kvm-all.c b/kvm-all.c
> > index 82a9119..7b7ea8d 100644
> > --- a/kvm-all.c
> > +++ b/kvm-all.c
> > @@ -441,10 +441,13 @@ static int kvm_physical_sync_dirty_bitmap(MemoryRegionSection *section)
> >
> > d.slot = mem->slot;
> >
> > - if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {
> > + ret = kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d);
> > + if (ret < 0 && ret != -ENOENT) {
> > DPRINTF("ioctl failed %d\n", errno);
> > ret = -1;
> > break;
> > + } else if (ret < 0) {
> > + ret = 0;
> > }
> >
> > kvm_get_dirty_pages_log_range(section, d.dirty_bitmap);
>
> Should we omit calling kvm_get_dirty_pages_log_range() if there's
> no bitmap from kernel?
If that's something we can know then certainly that'll be better.
It'll save an ioctl and copy_from_user of the whole of &d.
> In particular, do we trust kernel to not
> touch d.dirty_bitmap when it returns ENOENT?
Seems ok, kvm_vm_ioctl_get_dirty_log() doesn't change anything
in *log before returning when it finds no dirty_mapslot.
-serge
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-04-10 18:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-09 3:21 [Qemu-devel] [PATCH 1/1] kvm_physical_sync_dirty_bitmap: ignore ENOENT from kvm_vm_ioctl Serge Hallyn
2014-04-09 3:31 ` Serge E. Hallyn
2014-04-10 16:30 ` Michael Tokarev
2014-04-10 18:47 ` Serge Hallyn
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).