This patchset fixes the migration of storage attributes. Each memory slot has a bitmap, with 2 bits per page, used to keep track of dirty pages during migration. We only use one bit, the other would be wasted. With this patch, the second bit is now used to keep track of dirty storage attributes. This means that we do not need anymore to allocate and manage the additional bitmap, and no extra work is needed to keep track of memory slots. The code does get a little bit more complicated when accounting for the memory slots, but overall it should be more robust. The first patch simply introduces two auxiliary functions, while the second patch does the actual job. v2 -> v3 * rebased on master * fix comment for gfn_to_memslot_approx * cmma_bitmap renamed to kvm_shadow_dirty_bitmap and easier to read * kvm->arch.migration_mode is not atomic any longer * renamed some local variables for more consistency v1 -> v2 * renamed _cmma_bitmap to cmma_bitmap and moved it to kvm-s390.h * renamed and/or removed some variables to improve readability * added some comments inline * simplified the code flow to improve readability Claudio Imbrenda (2): KVM: s390x: some utility functions for migration KVM: s390: Fix storage attributes migration with memory slots arch/s390/include/asm/kvm_host.h | 9 +- arch/s390/kvm/kvm-s390.c | 303 +++++++++++++++++++++++---------------- arch/s390/kvm/kvm-s390.h | 7 + arch/s390/kvm/priv.c | 28 ++-- include/linux/kvm_host.h | 7 + virt/kvm/kvm_main.c | 2 +- 6 files changed, 219 insertions(+), 137 deletions(-) -- 2.7.4