Skip to contentSkip to conversation

Live migration fails under heavy network use

DISCUSSION John Levon 4 participants 17 messages Feb 20, 2007 – Feb 23, 2007

lore
Share & tools
lore

John Levon

author
#0 lore raw

I've observed this with both a Solaris and a FC6 domU (up to date as of last week or so) in 64-bit. If you place the domU under reasonable networking stress (such as a 'find /nfs/path >/dev/null'), live migration usually, but not always fails:

bash-3.00# while xm migrate --live fedora64 localhost ; do echo done ; done
(XEN) memory.c:188:d2 Dom2 freeing in-use page 9f40f (pseudophys 1d007): count=2 type=e8000000
(XEN) memory.c:188:d2 Dom2 freeing in-use page 9f409 (pseudophys 1d00b): count=2 type=e8000000
(XEN) /export/johnlev/xen/xen-work/xen.hg/xen/include/asm/mm.h:184:d0 Error pfn 9f738: rd=ffff830000fe0100, od=ffff830000000002, caf=00000000, taf=0000000000000002 (XEN) mm.c:590:d0 Error getting mfn 9f738 (pfn 12026) from L1 entry 000000009f738705 for dom2
Error: /usr/lib/xen/bin/xc_save 27 2 0 0 1 failed

Some experimentation has revealed that this only happens if a vif is configured and used, which seems like it's related to giving away pages (as rd != od would indicate too...). Anybody else seeing this? I've only tested on a Solaris dom0 so far, though I can't think of anything that would affect this.

thanks
john

#1 lore raw
Quoted 1 line

I've observed this with both a Solaris and a FC6 domU (up to date as

of

Quoted 1 line

bash-3.00# while xm migrate --live fedora64 localhost ; do echo done ;

done

Quoted 1 line

(XEN) memory.c:188:d2 Dom2 freeing in-use page 9f40f (pseudophys

1d007):

Quoted 2 lines

count=2 type=e8000000
(XEN) memory.c:188:d2 Dom2 freeing in-use page 9f409 (pseudophys

1d00b):

Quoted 2 lines

count=2 type=e8000000
(XEN) /export/johnlev/xen/xen-work/xen.hg/xen/include/asm/mm.h:184:d0

Error

Quoted 9 lines

pfn 9f738: rd=ffff830000fe0100, od=ffff830000000002, caf=00000000, taf=0000000000000002
(XEN) mm.c:590:d0 Error getting mfn 9f738 (pfn 12026) from L1 entry 000000009f738705 for dom2
Error: /usr/lib/xen/bin/xc_save 27 2 0 0 1 failed

Some experimentation has revealed that this only happens if a vif is configured
and used, which seems like it's related to giving away pages (as rd !=

od

Quoted 2 lines

would
indicate too...). Anybody else seeing this? I've only tested on a

Solaris

Quoted 2 lines

dom0
so far, though I can't think of anything that would affect this.

These guests are using rx-flip rather than rx-copy, right? This has certainly worked reliably in the past (e.g. 3.0.3), but is now getting little testing as current guests use rx-copy by default.

The freeing in-use page messages may be unrelated to the actual problem -- AFAIK that's a relatively new printk that could occur benignly during a live migrate of an rx-flip guest.

Even get_page can fail benignly under certain circumstances during a live migrate. It's worth finding out where the actual error in xc_linux_save is.

Ian

#2 lore raw
Quoted 11 lines · Ian Pratt

These guests are using rx-flip rather than rx-copy, right? This has certainly worked reliably in the past (e.g. 3.0.3), but is now getting little testing as current guests use rx-copy by default.

The freeing in-use page messages may be unrelated to the actual problem -- AFAIK that's a relatively new printk that could occur benignly during a live migrate of an rx-flip guest.

Even get_page can fail benignly under certain circumstances during a live migrate. It's worth finding out where the actual error in xc_linux_save is.

Also, apart from the fact that save/restore *should* still work with old-style netfront, there are other legitimate reasons for pages to disappear from a guest's allocation (e.g., running the balloon driver during save/restore). It might be worth seeing if you can provoke similar xc_save errors under balloon load.

-- Keir

author
#3 lore raw
In reply to Ian Pratt
Quoted 1 line · Ian Pratt

These guests are using rx-flip rather than rx-copy, right?

Solaris is, and presumably FC6 too.

Quoted 1 line

This has certainly worked reliably in the past (e.g. 3.0.3), but is now

I forget to mention that this is 3.0.4-based.

Quoted 3 lines

The freeing in-use page messages may be unrelated to the actual problem -- AFAIK that's a relatively new printk that could occur benignly during a live migrate of an rx-flip guest.

We're failing here:

[2007-02-20 13:39:50 xend 100401] INFO (XendCheckpoint:247) Saving memory pages: iter 2 0%ERROR Internal error: Error when writing to state file (5) (errno 14)
[2007-02-20 13:39:50 xend 100401] INFO (XendCheckpoint:247) Save exit rc=1 [2007-02-20 13:39:50 xend 100401] ERROR (XendCheckpoint:111) Save failed on domain fedora64 (2).

1049 /* We have a normal page: just write it directly. */
1050 if (ratewrite(io_fd, spage, PAGE_SIZE) != PAGE_SIZE) {
1051 ERROR("Error when writing to state file (5)"

IOW, we're faulting (EFAULT) on the domain's MFN due to the above error.

regards
john

#4 lore raw

* [email protected] [2007-02-20 23:04:47]

Quoted 4 lines · Ian Pratt
Quoted 1 line

These guests are using rx-flip rather than rx-copy, right?

Solaris is, and presumably FC6 too.

Solaris dom0 supports only rx-flip at this point, so all guests running alongside a Solaris dom0 are forced to use it.

dme.

Signature · 1 line
David Edmondson, http://www.dme.org
#5 lore raw
In reply to John Levon
Quoted 1 line
Quoted 1 line

The freeing in-use page messages may be unrelated to the actual

problem

Quoted 1 line
Quoted 1 line

-- AFAIK that's a relatively new printk that could occur benignly

during

Quoted 5 lines
Quoted 1 line

a live migrate of an rx-flip guest.

We're failing here:

[2007-02-20 13:39:50 xend 100401] INFO (XendCheckpoint:247) Saving

memory

Quoted 1 line

pages: iter 2 0%ERROR Internal error: Error when writing to state

file

Quoted 2 lines

(5) (errno 14)
[2007-02-20 13:39:50 xend 100401] INFO (XendCheckpoint:247) Save exit

rc=1

Quoted 1 line

[2007-02-20 13:39:50 xend 100401] ERROR (XendCheckpoint:111) Save

failed on

Quoted 3 lines

domain fedora64 (2).

1049 /* We have a normal page: just write it

directly.

Quoted 4 lines

*/
1050 if (ratewrite(io_fd, spage, PAGE_SIZE) !=
PAGE_SIZE) {
1051 ERROR("Error when writing to state file

(5)"

Quoted 2 lines

IOW, we're faulting (EFAULT) on the domain's MFN due to the above

error.

Urk. Checkout line 204 of privcmd.c
That doesn't look too 64b clean to me....

The top nibble is supposed to be set if its not possible to map the frame correctly. This will be propagated through the xc_get_pfn_type_batch call, hence skipping the frame.

Ian

#6 lore raw
Quoted 2 lines · Ian Pratt

Urk. Checkout line 204 of privcmd.c
That doesn't look too 64b clean to me....

Should be good for 1TB of memory. Also the subsequent get_pfn_type_batch hypercall takes an array of 32-bit values, so the type/error nibble has to be at the top of 32 bits rather than 64 bits.

Quoted 3 lines

The top nibble is supposed to be set if its not possible to map the frame correctly. This will be propagated through the xc_get_pfn_type_batch call, hence skipping the frame.

That's the theory. :-)

-- Keir

author
#7 lore raw
Quoted 2 lines · Keir Fraser
Quoted 2 lines

Urk. Checkout line 204 of privcmd.c
That doesn't look too 64b clean to me....

Hmm, I never looked at the Linux privcmd driver before. It seems like you're prefaulting all the pages in the ioctl() in on the ioctl. Currently on Solaris we're demand-faulting each page in the mmap() ...

It looks like we're not checking that we ca actually map the page at the time of the ioctl(), thus it's not ending up as marked with that bit.

Looks like our bug...

thanks,
john

#8 lore raw
Quoted 5 lines · John Levon
Quoted 2 lines · Keir Fraser
Quoted 2 lines

Urk. Checkout line 204 of privcmd.c
That doesn't look too 64b clean to me....

Quoted 8 lines

Hmm, I never looked at the Linux privcmd driver before. It seems like you're prefaulting all the pages in the ioctl() in on the ioctl. Currently on Solaris we're demand-faulting each page in the mmap() ...

It looks like we're not checking that we ca actually map the page at the time of the ioctl(), thus it's not ending up as marked with that bit.

Looks like our bug...

If you check then you may as well map at the same time. I think it would actually be hard to defer the mapping in a race-free manner.

-- Keir

author
#9 lore raw
Quoted 7 lines · Keir Fraser
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

Urk. Checkout line 204 of privcmd.c
That doesn't look too 64b clean to me....

Hmm, I never looked at the Linux privcmd driver before. It seems like you're prefaulting all the pages in the ioctl() in on the ioctl. Currently on Solaris we're demand-faulting each page in the mmap() ...

Quoted 7 lines
Quoted 4 lines

It looks like we're not checking that we ca actually map the page at the time of the ioctl(), thus it's not ending up as marked with that bit.

Looks like our bug...

If you check then you may as well map at the same time. I think it would actually be hard to defer the mapping in a race-free manner.

I've modified the segment driver to prefault the MFNs and things seem a lot better for both Solaris and Linux domUs:

(XEN) /export/johnlev/xen/xen-work/xen.hg/xen/include/asm/mm.h:184:d0 Error pfn 5512: rd=ffff830000f92100, od=0000000000000000, caf=00000000, taf=0000000000000002 (XEN) mm.c:590:d0 Error getting mfn 5512 (pfn 47fa) from L1 entry 0000000005512705 for dom52
(XEN) mm.c:566:d0 Non-privileged (53) attempt to map I/O space 00000000 done
done

Not quite sure why the new domain is trying to map 00000000 though.

I also see a fair amount of:

Dom48 freeing in-use page 2991 (pseudophys 100a4): count=2 type=e8000000

Ian mentioned that these could be harmless. Is this because dom0 has mapped the page for suspending? And if so, why is the count two not one?

Should xc_core.c really be using MMAPBATCH? I suppose it's convenient but it does mean that the frame lists have to be locked in memory.

regards,
john

#10 lore raw
Quoted 6 lines · John Levon

I also see a fair amount of:

Dom48 freeing in-use page 2991 (pseudophys 100a4): count=2 type=e8000000

Ian mentioned that these could be harmless. Is this because dom0 has mapped the page for suspending? And if so, why is the count two not one?

Yes, it's because of the extra dom0 mapping. The count is 2 because one reference is held at this point by the freeing function in Xen.

The comment above that warning in the Xen source is a bit strong. I don't think we can change the semantics of the existing command but we may add a new one to let the caller know whether the page(s) could immediately be freed.

-- Keir

author
#11 lore raw
Quoted 7 lines · Keir Fraser

Yes, it's because of the extra dom0 mapping. The count is 2 because one reference is held at this point by the freeing function in Xen.

The comment above that warning in the Xen source is a bit strong. I don't think we can change the semantics of the existing command but we may add a new one to let the caller know whether the page(s) could immediately be freed.

Hmm. This debug message has caught one real bug in our balloon code recently. I presume it's not trivial to distinguish between that case (where the domain really did have its own mapping) and the live-migration one though.

regards
john

#12 lore raw
In reply to John Levon
Quoted 1 line

I've modified the segment driver to prefault the MFNs and things seem

a

Quoted 3 lines

lot better for both Solaris and Linux domUs:

(XEN) /export/johnlev/xen/xen-work/xen.hg/xen/include/asm/mm.h:184:d0

Error

Quoted 5 lines

pfn 5512: rd=ffff830000f92100, od=0000000000000000, caf=00000000, taf=0000000000000002
(XEN) mm.c:590:d0 Error getting mfn 5512 (pfn 47fa) from L1 entry 0000000005512705 for dom52
(XEN) mm.c:566:d0 Non-privileged (53) attempt to map I/O space

00000000

Quoted 4 lines

done
done

Not quite sure why the new domain is trying to map 00000000 though.

The messages from the save side are expected. Is the message from the restored domain triggered by the restore code i.e. before the domain is un-paused?

I expect if you change the 'pfn=0' in canonicalize_pagetable:539 to 'deadb000' you'll see that propagated through to the restore message. In which case, its ugly, but benign.

Quoted 3 lines

I also see a fair amount of:

Dom48 freeing in-use page 2991 (pseudophys 100a4): count=2

type=e8000000

That's fine. Debug builds are a bit chatty for live migration...

Ian

author
#13 lore raw
Quoted 5 lines · Ian Pratt
Quoted 1 line

Not quite sure why the new domain is trying to map 00000000 though.

The messages from the save side are expected. Is the message from the restored domain triggered by the restore code i.e. before the domain is un-paused?

I suspect so but haven't proved that.

Quoted 3 lines

I expect if you change the 'pfn=0' in canonicalize_pagetable:539 to 'deadb000' you'll see that propagated through to the restore message. In which case, its ugly, but benign.

Wouldn't that pfn of 0 be an MFN other than 0 though? I do not see any change when setting pfn as above. Any further ideas? I can try adding some back traces. I suppose you're not seeing it with a Linux dom0?

Quoted 6 lines
Quoted 3 lines

I also see a fair amount of:

Dom48 freeing in-use page 2991 (pseudophys 100a4): count=2

type=e8000000

That's fine. Debug builds are a bit chatty for live migration...

Both of these:

(XEN) mm.c:590:d0 Error getting mfn a005e (pfn 4c35) from L1 entry 00000000a005e705 for dom2 (XEN) mm.c:566:d0 Non-privileged (3) attempt to map I/O space 00000000

are also present in a non-debug build. Would you take a patch to make both of them be XENLOG_INFO? It's not good that we get console noise for normal operation (presuming the I/O space one /is/ normal operation!).

regards
john

#14 lore raw
Quoted 3 lines · Ian Pratt
Quoted 2 lines
Quoted 2 lines

Not quite sure why the new domain is trying to map 00000000

though.

Quoted 2 lines
Quoted 2 lines

The messages from the save side are expected. Is the message from

the

Quoted 1 line
Quoted 1 line

restored domain triggered by the restore code i.e. before the domain

is

Quoted 3 lines
Quoted 1 line

un-paused?

I suspect so but haven't proved that.

That would be a good test.

Quoted 2 lines
Quoted 2 lines

I expect if you change the 'pfn=0' in canonicalize_pagetable:539 to 'deadb000' you'll see that propagated through to the restore

message. In

Quoted 3 lines
Quoted 1 line

which case, its ugly, but benign.

Wouldn't that pfn of 0 be an MFN other than 0 though?

Fair point. Thinking about it, that should be patched up by the next iteration anyhow.

Quoted 2 lines

I do not see any change
when setting pfn as above. Any further ideas? I can try adding some

back

Quoted 1 line

traces. I suppose you're not seeing it with a Linux dom0?

I don't think so, but I couldn't swear to it. It did used to come out during Linux domain boot at one point, can't remember whether it still does.

I presume the domain itself seems to suffer no ill effects?

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

I also see a fair amount of:

Dom48 freeing in-use page 2991 (pseudophys 100a4): count=2

type=e8000000

That's fine. Debug builds are a bit chatty for live migration...

Quoted 7 lines

Both of these:

(XEN) mm.c:590:d0 Error getting mfn a005e (pfn 4c35) from L1 entry 00000000a005e705 for dom2
(XEN) mm.c:566:d0 Non-privileged (3) attempt to map I/O space 00000000

are also present in a non-debug build. Would you take a patch to make

both

Quoted 2 lines

of
them be XENLOG_INFO? It's not good that we get console noise for

normal

Quoted 2 lines

operation
(presuming the I/O space one /is/ normal operation!).

I think we need to understand this one first.

Thanks,
Ian

author
#15 lore raw
Quoted 5 lines · Ian Pratt

I don't think so, but I couldn't swear to it. It did used to come out during Linux domain boot at one point, can't remember whether it still does.

I presume the domain itself seems to suffer no ill effects?

Right, it seems fine. I'll add some more debug to try and figure out where it's coming from soon.

thanks
john

#16 lore raw
In reply to John Levon
Quoted 6 lines · John Levon

Some experimentation has revealed that this only happens if a vif is configured
and used, which seems like it's related to giving away pages (as rd != od would
indicate too...). Anybody else seeing this? I've only tested on a Solaris dom0 so far, though I can't think of anything that would affect this.

Do you know if it's the case that both netfronts are using the 'old-style' page-flipping receive mechanism, rather than the copying mechanism?

-- Keir