Skip to contentSkip to conversation

kvm: savevm is broken for me

Qemu-devel Luiz Capitulino 3 participants 12 messages Jul 23, 2009 – Jul 27, 2009

lore
Share & tools
lore
#0 lore raw

Hi there,

If I try to 'savevm' with latest Anthony's tree (HEAD
6f725c139ae975646c44ace77bf796318a5783da) QEMU will hang and I know it's not saving anything because vmstat shows no disk activity (which is the opposite behavior of when 'savevm' works).

According to 'git bisect' the week's winner is:

"""
commit bd8367761236cd5c435598aeb2f1b8240c09b059

Author: Alexander Graf <[email protected]>
Date:   Fri Jul 17 13:51:48 2009 +0200

Fake dirty loggin when it's not there
"""

Indeed, reverting this makes 'savevm' work for me.

#1 lore raw
Quoted 12 lines · Luiz Capitulino

Hi there,

If I try to 'savevm' with latest Anthony's tree (HEAD 6f725c139ae975646c44ace77bf796318a5783da) QEMU will hang and I know it's not saving anything because vmstat shows no disk activity (which is the opposite behavior of when 'savevm' works).

According to 'git bisect' the week's winner is:

"""
commit bd8367761236cd5c435598aeb2f1b8240c09b059

Quoted 7 lines
Author: Alexander Graf <[email protected]>
Date:   Fri Jul 17 13:51:48 2009 +0200

Fake dirty loggin when it's not there
"""

Indeed, reverting this makes 'savevm' work for me.

Yikes. I have no idea why, but just revert the patch :-). I don't really need it anymore since we now have dirty logging in PPC.

Maybe it's the if (is dirty logging really enabled?) in the beginning? The rest of the code should be functionally identical. That'd point to a bug in the resetting of the DIRTY_ENABLED flag.

Alex

#2 lore raw
Quoted 20 lines · On Fri, 24 Jul 2009 00:06:13 +0200 Alexander Graf <[email protected]> wrote:
Quoted 18 lines · Luiz Capitulino

Hi there,

If I try to 'savevm' with latest Anthony's tree (HEAD 6f725c139ae975646c44ace77bf796318a5783da) QEMU will hang and I know it's not saving anything because vmstat shows no disk activity (which is the opposite behavior of when 'savevm' works).

According to 'git bisect' the week's winner is:

"""
commit bd8367761236cd5c435598aeb2f1b8240c09b059

Author: Alexander Graf <[email protected]>
Date:   Fri Jul 17 13:51:48 2009 +0200

Fake dirty loggin when it's not there
"""

Quoted 7 lines
Quoted 1 line

Indeed, reverting this makes 'savevm' work for me.

Yikes. I have no idea why, but just revert the patch :-). I don't really need it anymore since we now have dirty logging in PPC.

Maybe it's the if (is dirty logging really enabled?) in the beginning?

Yes, it's the if. I have removed it and savevm works.

Can you submit the fix please?

#3 lore raw
Quoted 26 lines · Luiz Capitulino
Quoted 23 lines · On Fri, 24 Jul 2009 00:06:13 +0200 Alexander Graf <[email protected]> wrote:
Quoted 19 lines · Luiz Capitulino

Hi there,

If I try to 'savevm' with latest Anthony's tree (HEAD 6f725c139ae975646c44ace77bf796318a5783da) QEMU will hang and I know it's not saving anything because vmstat shows no disk activity (which is the opposite behavior of when 'savevm' works).

According to 'git bisect' the week's winner is:

"""
commit bd8367761236cd5c435598aeb2f1b8240c09b059

Author: Alexander Graf <[email protected]>
Date:   Fri Jul 17 13:51:48 2009 +0200

Fake dirty loggin when it's not there
"""

Indeed, reverting this makes 'savevm' work for me.

Quoted 8 lines
Quoted 4 lines

Yikes. I have no idea why, but just revert the patch :-). I don't really need it anymore since we now have dirty logging in PPC.

Maybe it's the if (is dirty logging really enabled?) in the beginning?

Yes, it's the if. I have removed it and savevm works.

Can you submit the fix please?

Eh - what fix? You found that something doesn't set or evaluate the flags right. That still doesn't tell us who behaves incorrectly.

Alex

#4 lore raw
Quoted 36 lines · On Fri, 24 Jul 2009 16:18:02 +0200 Alexander Graf <[email protected]> wrote:
Quoted 33 lines · Luiz Capitulino
Quoted 29 lines · On Fri, 24 Jul 2009 00:06:13 +0200 Alexander Graf <[email protected]> wrote:
Quoted 13 lines · Luiz Capitulino

Hi there,

If I try to 'savevm' with latest Anthony's tree (HEAD 6f725c139ae975646c44ace77bf796318a5783da) QEMU will hang and I know it's not saving anything because vmstat shows no disk activity (which
is the opposite behavior of when 'savevm' works).

According to 'git bisect' the week's winner is:

"""
commit bd8367761236cd5c435598aeb2f1b8240c09b059

Quoted 7 lines
Author: Alexander Graf <[email protected]>
Date:   Fri Jul 17 13:51:48 2009 +0200

Fake dirty loggin when it's not there
"""

Indeed, reverting this makes 'savevm' work for me.

Yikes. I have no idea why, but just revert the patch :-). I don't really need it anymore since we now have dirty logging in PPC.

Maybe it's the if (is dirty logging really enabled?) in the beginning?

Quoted 6 lines
Quoted 3 lines

Yes, it's the if. I have removed it and savevm works.

Can you submit the fix please?

Eh - what fix? You found that something doesn't set or evaluate the flags right. That still doesn't tell us who behaves incorrectly.

Ah, okay. I thought you meant the 'if' _was_ the bug.

Better to revert then?

#5 lore raw
Quoted 41 lines · Luiz Capitulino
Quoted 38 lines · On Fri, 24 Jul 2009 16:18:02 +0200 Alexander Graf <[email protected]> wrote:
Quoted 35 lines · Luiz Capitulino
Quoted 21 lines · On Fri, 24 Jul 2009 00:06:13 +0200 Alexander Graf <[email protected]> wrote:
Quoted 19 lines · Luiz Capitulino

Hi there,

If I try to 'savevm' with latest Anthony's tree (HEAD 6f725c139ae975646c44ace77bf796318a5783da) QEMU will hang and I know it's not saving anything because vmstat shows no disk activity (which
is the opposite behavior of when 'savevm' works).

According to 'git bisect' the week's winner is:

"""
commit bd8367761236cd5c435598aeb2f1b8240c09b059

Author: Alexander Graf <[email protected]>
Date:   Fri Jul 17 13:51:48 2009 +0200

Fake dirty loggin when it's not there
"""

Quoted 8 lines
Quoted 1 line

Indeed, reverting this makes 'savevm' work for me.

Yikes. I have no idea why, but just revert the patch :-). I don't really need it anymore since we now have dirty logging in PPC.

Maybe it's the if (is dirty logging really enabled?) in the beginning?

Yes, it's the if. I have removed it and savevm works.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Can you submit the fix please?

Eh - what fix? You found that something doesn't set or evaluate the flags right. That still doesn't tell us who behaves incorrectly.

Ah, okay. I thought you meant the 'if' _was_ the bug.

Better to revert then?

Even better yet to find out who's doing something wrong :-).

Alex

#6 lore raw
Quoted 47 lines · Alexander Graf
Quoted 44 lines · Luiz Capitulino
Quoted 41 lines · On Fri, 24 Jul 2009 16:18:02 +0200 Alexander Graf <[email protected]> wrote:
Quoted 37 lines · Luiz Capitulino
Quoted 22 lines · On Fri, 24 Jul 2009 00:06:13 +0200 Alexander Graf <[email protected]> wrote:
Quoted 20 lines · Luiz Capitulino

Hi there,

If I try to 'savevm' with latest Anthony's tree (HEAD 6f725c139ae975646c44ace77bf796318a5783da) QEMU will hang and I know
it's not saving anything because vmstat shows no disk activity (which
is the opposite behavior of when 'savevm' works).

According to 'git bisect' the week's winner is:

"""
commit bd8367761236cd5c435598aeb2f1b8240c09b059

Author: Alexander Graf <[email protected]>
Date:   Fri Jul 17 13:51:48 2009 +0200

Fake dirty loggin when it's not there
"""

Quoted 8 lines
Quoted 1 line

Indeed, reverting this makes 'savevm' work for me.

Yikes. I have no idea why, but just revert the patch :-). I don't really need it anymore since we now have dirty logging in PPC.

Maybe it's the if (is dirty logging really enabled?) in the beginning?

Yes, it's the if. I have removed it and savevm works.

Can you submit the fix please?

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Eh - what fix? You found that something doesn't set or evaluate the flags right. That still doesn't tell us who behaves incorrectly.

Ah, okay. I thought you meant the 'if' _was_ the bug.

Better to revert then?

Even better yet to find out who's doing something wrong :-).

It's actually quite simple.
you continue'd instead of break'ing during the dirty log loop, which would put us in an infinite loop

Patch follows:

Quoted 1 line

From d249467b75dea5fad2c305d88edd447e8745494f Mon Sep 17 00:00:00 2001

From: Glauber Costa <[email protected]>
Date: Fri, 24 Jul 2009 15:32:46 -0400
Subject: [PATCH] remove infinite loop for migration

Linux is so good, that it can finish an endless loop in 5 seconds. Unfortunately, not everybody uses Linux, and while kvm is still linux-only, this is likely to change. So remove an endless loop in migration code recently introduced.

---
 kvm-all.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kvm-all.c +1 -1
index 824bb4c..b8b9539 100644
@@ -333,7 +333,7 @@ int kvm_physical_sync_dirty_bitmap(target_phys_addr_t start_addr,
 
         /* We didn't activate dirty logging? Don't care then. */
         if(!(mem->flags & KVM_MEM_LOG_DIRTY_PAGES)) {
-            continue;
+            break;
         }
 
         size = ((mem->memory_size >> TARGET_PAGE_BITS) + 7) / 8;
Signature · 1 line
1.6.2.2
#7 lore raw
Quoted 55 lines · Glauber Costa
Quoted 54 lines · Alexander Graf
Quoted 50 lines · Luiz Capitulino
Quoted 37 lines · On Fri, 24 Jul 2009 16:18:02 +0200 Alexander Graf <[email protected]> wrote:
Quoted 34 lines · Luiz Capitulino
Quoted 30 lines · On Fri, 24 Jul 2009 00:06:13 +0200 Alexander Graf <[email protected]> wrote:
Quoted 14 lines · Luiz Capitulino

Hi there,

If I try to 'savevm' with latest Anthony's tree (HEAD 6f725c139ae975646c44ace77bf796318a5783da) QEMU will hang and I know
it's not saving anything because vmstat shows no disk activity (which
is the opposite behavior of when 'savevm' works).

According to 'git bisect' the week's winner is:

"""
commit bd8367761236cd5c435598aeb2f1b8240c09b059

Quoted 7 lines
Author: Alexander Graf <[email protected]>
Date:   Fri Jul 17 13:51:48 2009 +0200

Fake dirty loggin when it's not there
"""

Indeed, reverting this makes 'savevm' work for me.

Yikes. I have no idea why, but just revert the patch :-). I don't really need it anymore since we now have dirty logging in PPC.

Maybe it's the if (is dirty logging really enabled?) in the beginning?

Quoted 6 lines
Quoted 3 lines

Yes, it's the if. I have removed it and savevm works.

Can you submit the fix please?

Eh - what fix? You found that something doesn't set or evaluate the flags right. That still doesn't tell us who behaves incorrectly.

Ah, okay. I thought you meant the 'if' _was_ the bug.

Better to revert then?

Quoted 7 lines
Quoted 1 line

Even better yet to find out who's doing something wrong :-).

It's actually quite simple.
you continue'd instead of break'ing during the dirty log loop, which would put us in an infinite loop

Patch follows:

But who calls kvm_physical_sync_dirty_bitmap with !(mem->flags & KVM_MEM_LOG_DIRTY_PAGES)? Sounds rather wrong to me.

Alex

#8 lore raw
Quoted 60 lines · Alexander Graf
Quoted 57 lines · Glauber Costa
Quoted 55 lines · Alexander Graf
Quoted 42 lines · Luiz Capitulino
Quoted 39 lines · On Fri, 24 Jul 2009 16:18:02 +0200 Alexander Graf <[email protected]> wrote:
Quoted 36 lines · Luiz Capitulino
Quoted 22 lines · On Fri, 24 Jul 2009 00:06:13 +0200 Alexander Graf <[email protected]> wrote:
Quoted 20 lines · Luiz Capitulino

Hi there,

If I try to 'savevm' with latest Anthony's tree (HEAD 6f725c139ae975646c44ace77bf796318a5783da) QEMU will hang and I know
it's not saving anything because vmstat shows no disk activity (which
is the opposite behavior of when 'savevm' works).

According to 'git bisect' the week's winner is:

"""
commit bd8367761236cd5c435598aeb2f1b8240c09b059

Author: Alexander Graf <[email protected]>
Date:   Fri Jul 17 13:51:48 2009 +0200

Fake dirty loggin when it's not there
"""

Quoted 8 lines
Quoted 1 line

Indeed, reverting this makes 'savevm' work for me.

Yikes. I have no idea why, but just revert the patch :-). I don't really need it anymore since we now have dirty logging in PPC.

Maybe it's the if (is dirty logging really enabled?) in the beginning?

Yes, it's the if. I have removed it and savevm works.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Can you submit the fix please?

Eh - what fix? You found that something doesn't set or evaluate the flags right. That still doesn't tell us who behaves incorrectly.

Ah, okay. I thought you meant the 'if' _was_ the bug.

Better to revert then?

Even better yet to find out who's doing something wrong :-).

Quoted 8 lines
Quoted 5 lines

It's actually quite simple.
you continue'd instead of break'ing during the dirty log loop, which would put us in an infinite loop

Patch follows:

But who calls kvm_physical_sync_dirty_bitmap with !(mem->flags & KVM_MEM_LOG_DIRTY_PAGES)? Sounds rather wrong to me.

I'd have to dig, but from code inspection,
it seems that ram_save_live does it, in its first interaction.

This can probably be improved, but I don't think it is wrong semantics anyway. We can sync dirty bitmaps without having mem->flags & KVM_MEM_LOG_DIRTY_PAGES, and just got nothing written to qemu dirty bitmap.

Anyway, even if we decide to fix ram_save_live to not do it, getting into an endless loop in that case is buggy. So it is really orthogonal.

#9 lore raw
Quoted 72 lines · Glauber Costa
Quoted 60 lines · Alexander Graf
Quoted 57 lines · Glauber Costa
Quoted 55 lines · Alexander Graf
Quoted 42 lines · Luiz Capitulino
Quoted 39 lines · On Fri, 24 Jul 2009 16:18:02 +0200 Alexander Graf <[email protected]> wrote:
Quoted 36 lines · Luiz Capitulino
Quoted 22 lines · On Fri, 24 Jul 2009 00:06:13 +0200 Alexander Graf <[email protected]> wrote:
Quoted 20 lines · Luiz Capitulino

Hi there,

If I try to 'savevm' with latest Anthony's tree (HEAD 6f725c139ae975646c44ace77bf796318a5783da) QEMU will hang and I know
it's not saving anything because vmstat shows no disk activity (which
is the opposite behavior of when 'savevm' works).

According to 'git bisect' the week's winner is:

"""
commit bd8367761236cd5c435598aeb2f1b8240c09b059

Author: Alexander Graf <[email protected]>
Date:   Fri Jul 17 13:51:48 2009 +0200

Fake dirty loggin when it's not there
"""

Quoted 8 lines
Quoted 1 line

Indeed, reverting this makes 'savevm' work for me.

Yikes. I have no idea why, but just revert the patch :-). I don't really need it anymore since we now have dirty logging in PPC.

Maybe it's the if (is dirty logging really enabled?) in the beginning?

Yes, it's the if. I have removed it and savevm works.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Can you submit the fix please?

Eh - what fix? You found that something doesn't set or evaluate the flags right. That still doesn't tell us who behaves incorrectly.

Ah, okay. I thought you meant the 'if' _was_ the bug.

Better to revert then?

Even better yet to find out who's doing something wrong :-).

Quoted 8 lines
Quoted 5 lines

It's actually quite simple.
you continue'd instead of break'ing during the dirty log loop, which would put us in an infinite loop

Patch follows:

But who calls kvm_physical_sync_dirty_bitmap with !(mem->flags & KVM_MEM_LOG_DIRTY_PAGES)? Sounds rather wrong to me.

I'd have to dig, but from code inspection,
it seems that ram_save_live does it, in its first interaction.

Quoted 6 lines

This can probably be improved, but I don't think it is wrong semantics anyway. We can sync dirty bitmaps without having mem->flags & KVM_MEM_LOG_DIRTY_PAGES, and just got nothing written to qemu dirty bitmap.

Anyway, even if we decide to fix ram_save_live to not do it, getting into an endless loop in that case is buggy. So it is really orthogonal.

Looking at the code again it's probably best to remove the if(). Doing a break isn't exactly right either because it could hide dirty logs in later slots.

Alex

#10 lore raw
Quoted 82 lines · Alexander Graf
Quoted 79 lines · Glauber Costa
Quoted 62 lines · Alexander Graf
Quoted 59 lines · Glauber Costa
Quoted 57 lines · Alexander Graf
Quoted 45 lines · Luiz Capitulino
Quoted 42 lines · On Fri, 24 Jul 2009 16:18:02 +0200 Alexander Graf <[email protected]> wrote:
Quoted 38 lines · Luiz Capitulino
Quoted 25 lines · On Fri, 24 Jul 2009 00:06:13 +0200 Alexander Graf <[email protected]> wrote:
Quoted 14 lines · Luiz Capitulino

Hi there,

If I try to 'savevm' with latest Anthony's tree (HEAD 6f725c139ae975646c44ace77bf796318a5783da) QEMU will hang and I know
it's not saving anything because vmstat shows no disk activity (which
is the opposite behavior of when 'savevm' works).

According to 'git bisect' the week's winner is:

"""
commit bd8367761236cd5c435598aeb2f1b8240c09b059

Quoted 7 lines
Author: Alexander Graf <[email protected]>
Date:   Fri Jul 17 13:51:48 2009 +0200

Fake dirty loggin when it's not there
"""

Indeed, reverting this makes 'savevm' work for me.

Quoted 6 lines

Yikes. I have no idea why, but just revert the patch :-). I don't
really need it anymore since we now have dirty logging in PPC.

Maybe it's the if (is dirty logging really enabled?) in the beginning?

Yes, it's the if. I have removed it and savevm works.

Can you submit the fix please?

Quoted 7 lines
Quoted 3 lines

Eh - what fix? You found that something doesn't set or evaluate the
flags right. That still doesn't tell us who behaves incorrectly.

Ah, okay. I thought you meant the 'if' _was_ the bug.

Better to revert then?

Even better yet to find out who's doing something wrong :-).

Quoted 8 lines
Quoted 5 lines

It's actually quite simple.
you continue'd instead of break'ing during the dirty log loop, which would put us in an infinite loop

Patch follows:

But who calls kvm_physical_sync_dirty_bitmap with !(mem->flags & KVM_MEM_LOG_DIRTY_PAGES)? Sounds rather wrong to me.

I'd have to dig, but from code inspection,
it seems that ram_save_live does it, in its first interaction.

This can probably be improved, but I don't think it is wrong semantics anyway. We can sync dirty bitmaps without having mem->flags & KVM_MEM_LOG_DIRTY_PAGES,
and just got nothing written to qemu dirty bitmap.

Quoted 7 lines
Quoted 3 lines

Anyway, even if we decide to fix ram_save_live to not do it, getting into an endless loop in that case is buggy. So it is really orthogonal.

Looking at the code again it's probably best to remove the if(). Doing a break isn't exactly right either because it could hide dirty logs in later slots.

It's up to you.

As an alternative, we could do start_addr = mem->phys_addr + mem->len, or something like it, therefore skipping the whole slot.

#11 lore raw
Quoted 87 lines · Glauber Costa
Quoted 86 lines · Alexander Graf
Quoted 82 lines · Glauber Costa
Quoted 62 lines · Alexander Graf
Quoted 59 lines · Glauber Costa
Quoted 57 lines · Alexander Graf
Quoted 45 lines · Luiz Capitulino
Quoted 42 lines · On Fri, 24 Jul 2009 16:18:02 +0200 Alexander Graf <[email protected]> wrote:
Quoted 38 lines · Luiz Capitulino
Quoted 25 lines · On Fri, 24 Jul 2009 00:06:13 +0200 Alexander Graf <[email protected]> wrote:
Quoted 14 lines · Luiz Capitulino

Hi there,

If I try to 'savevm' with latest Anthony's tree (HEAD 6f725c139ae975646c44ace77bf796318a5783da) QEMU will hang and I know
it's not saving anything because vmstat shows no disk activity (which
is the opposite behavior of when 'savevm' works).

According to 'git bisect' the week's winner is:

"""
commit bd8367761236cd5c435598aeb2f1b8240c09b059

Quoted 7 lines
Author: Alexander Graf <[email protected]>
Date:   Fri Jul 17 13:51:48 2009 +0200

Fake dirty loggin when it's not there
"""

Indeed, reverting this makes 'savevm' work for me.

Quoted 6 lines

Yikes. I have no idea why, but just revert the patch :-). I don't
really need it anymore since we now have dirty logging in PPC.

Maybe it's the if (is dirty logging really enabled?) in the beginning?

Yes, it's the if. I have removed it and savevm works.

Can you submit the fix please?

Quoted 7 lines
Quoted 3 lines

Eh - what fix? You found that something doesn't set or evaluate the
flags right. That still doesn't tell us who behaves incorrectly.

Ah, okay. I thought you meant the 'if' _was_ the bug.

Better to revert then?

Even better yet to find out who's doing something wrong :-).

Quoted 8 lines
Quoted 5 lines

It's actually quite simple.
you continue'd instead of break'ing during the dirty log loop, which would put us in an infinite loop

Patch follows:

But who calls kvm_physical_sync_dirty_bitmap with !(mem->flags & KVM_MEM_LOG_DIRTY_PAGES)? Sounds rather wrong to me.

I'd have to dig, but from code inspection,
it seems that ram_save_live does it, in its first interaction.

This can probably be improved, but I don't think it is wrong semantics anyway. We can sync dirty bitmaps without having mem->flags & KVM_MEM_LOG_DIRTY_PAGES,
and just got nothing written to qemu dirty bitmap.

Anyway, even if we decide to fix ram_save_live to not do it, getting into an endless loop in that case is buggy. So it is really orthogonal.

Quoted 7 lines
Quoted 3 lines

Looking at the code again it's probably best to remove the if(). Doing a break isn't exactly right either because it could hide dirty logs in later slots.

It's up to you.

As an alternative, we could do start_addr = mem->phys_addr + mem->len, or something like it, therefore skipping the whole slot.

The obvious thing would be a goto, but that's kinda icky. I guess removing the if() is fine for now.

Alex