Skip to contentSkip to conversation

Migration downtime more than 5s when migrating guest with massive disks

Qemu-devel Gonglei (Arei) 3 participants 4 messages May 19, 2017 – May 22, 2017 4 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Oops, forgot to CC qemu-devel, add it.

Quoted 52 lines

-----Original Message-----
From: Gonglei (Arei)
Sent: Friday, May 19, 2017 8:17 PM
To: 'Paolo Bonzini'; yanghongyang; [email protected]
Cc: [email protected]; Dr. David Alan Gilbert; Huangzhichao
Subject: RE: Migration downtime more than 5s when migrating guest with massive disks

Quoted 6 lines

-----Original Message-----
From: Paolo Bonzini [mailto:[email protected]]
Sent: Friday, May 19, 2017 6:19 PM

Quoted 1 line · Yang Hongyang

We found that migration downtime is unacceptable when migrating guest

Quoted 9 lines

with

Quoted 6 lines

60 disks, more than 5.5 seconds.
By debugging, we find out the problem is there's too many memory_region_transaction_commit() operations during guest load, about 31w+ times.
Any idea to optimize the migration downtime in this scenario? maybe reduce the times of memory_region_transaction_commit() call, but

how?

Quoted 1 line

or we could optimize the time cost of

memory_region_transaction_commit()

Quoted 10 lines

call,

Quoted 1 line

but I think that wouldn't help much.

It would. Right now memory_region_transaction_commit() is roughly O(n^2) (n devices * n BARs), and there are n of them.

Reducing memory_region_transaction_commit to O(n) would be a large change. One idea is to share the AddressSpaceDispatch for AddressSpaces that have the same root memory region (after resolving aliases). The starting point would be to change mem_begin/mem_commit/mem_add from

a

Quoted 3 lines

MemoryListener to an loop on the FlatView, storing the AddressSpaceDispatch in the FlatView.

How about do O(1) for stopping stage of live migration? Because the cpu is stopped in this phase, it wouldn't cause side effects IMHO, right?

Thanks,
-Gonglei

Quoted 6 lines

One bandaid solution is to use virtio-scsi in the guest, with multiple disks behind one controller.

Thanks,

Paolo

A message that is not in the archive (sent off-list or not yet received): 33183CC9F5247A488A2544077AF19020DA2A0BA6@DGGEMA505-MBS.china.huawei.com

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw
Quoted 13 lines · Paolo Bonzini
Quoted 10 lines · Gonglei (Arei)
Quoted 10 lines

It would. Right now memory_region_transaction_commit() is roughly O(n^2) (n devices * n BARs), and there are n of them.

Reducing memory_region_transaction_commit to O(n) would be a large change. One idea is to share the AddressSpaceDispatch for AddressSpaces that have the same root memory region (after resolving aliases). The starting point would be to change mem_begin/mem_commit/mem_add from a MemoryListener to an loop on the FlatView, storing the AddressSpaceDispatch in the FlatView.

Quoted 6 lines
Quoted 3 lines

How about do O(1) for stopping stage of live migration? Because the cpu is stopped in this phase, it wouldn't cause side effects IMHO, right?

O(1) update is probably not quite possible, but it's possible to do one O(n) update. We tried doing that, but something in virtio broke.

How were you do that? did you put extra begin/commit before/after destination guest load, so that the destination guest only do one update(of n devs) throughout the whole migration?

Quoted 5 lines

I
don't remember the details.

Paolo

Signature · 2 lines
Thanks,
Yang
#6 lore raw
Quoted 9 lines · Yang Hongyang
Quoted 5 lines
Quoted 3 lines

How about do O(1) for stopping stage of live migration? Because the cpu is stopped in this phase, it wouldn't cause side effects IMHO, right?

O(1) update is probably not quite possible, but it's possible to do one O(n) update. We tried doing that, but something in virtio broke.

How were you do that? did you put extra begin/commit before/after destination guest load, so that the destination guest only do one update(of n devs) throughout the whole migration?

Right. However, this is a problem if post_load hooks do DMA. You need to move that DMA to a VM RunState change notifier.

Paolo

#7 lore raw
Quoted 8 lines · Paolo Bonzini
Quoted 5 lines · Yang Hongyang
Quoted 5 lines
Quoted 3 lines

How about do O(1) for stopping stage of live migration? Because the cpu is stopped in this phase, it wouldn't cause side effects IMHO, right?

O(1) update is probably not quite possible, but it's possible to do one O(n) update. We tried doing that, but something in virtio broke.

Quoted 7 lines
Quoted 4 lines

How were you do that? did you put extra begin/commit before/after destination guest load, so that the destination guest only do one update(of n devs) throughout the whole migration?

Right. However, this is a problem if post_load hooks do DMA. You need to move that DMA to a VM RunState change notifier.

Right. How about force memory_region_commit before post_load if a device has post_load hook?

Quoted 3 lines

Paolo

Signature · 2 lines
Thanks,
Yang