diff options
Diffstat (limited to 'arch/s390/kvm/kvm-s390.c')
-rw-r--r-- | arch/s390/kvm/kvm-s390.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 2598cf243b86..1371dff2b90d 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
@@ -769,7 +769,7 @@ static void kvm_s390_sync_request_broadcast(struct kvm *kvm, int req) | |||
769 | 769 | ||
770 | /* | 770 | /* |
771 | * Must be called with kvm->srcu held to avoid races on memslots, and with | 771 | * Must be called with kvm->srcu held to avoid races on memslots, and with |
772 | * kvm->lock to avoid races with ourselves and kvm_s390_vm_stop_migration. | 772 | * kvm->slots_lock to avoid races with ourselves and kvm_s390_vm_stop_migration. |
773 | */ | 773 | */ |
774 | static int kvm_s390_vm_start_migration(struct kvm *kvm) | 774 | static int kvm_s390_vm_start_migration(struct kvm *kvm) |
775 | { | 775 | { |
@@ -825,7 +825,7 @@ static int kvm_s390_vm_start_migration(struct kvm *kvm) | |||
825 | } | 825 | } |
826 | 826 | ||
827 | /* | 827 | /* |
828 | * Must be called with kvm->lock to avoid races with ourselves and | 828 | * Must be called with kvm->slots_lock to avoid races with ourselves and |
829 | * kvm_s390_vm_start_migration. | 829 | * kvm_s390_vm_start_migration. |
830 | */ | 830 | */ |
831 | static int kvm_s390_vm_stop_migration(struct kvm *kvm) | 831 | static int kvm_s390_vm_stop_migration(struct kvm *kvm) |
@@ -840,6 +840,8 @@ static int kvm_s390_vm_stop_migration(struct kvm *kvm) | |||
840 | 840 | ||
841 | if (kvm->arch.use_cmma) { | 841 | if (kvm->arch.use_cmma) { |
842 | kvm_s390_sync_request_broadcast(kvm, KVM_REQ_STOP_MIGRATION); | 842 | kvm_s390_sync_request_broadcast(kvm, KVM_REQ_STOP_MIGRATION); |
843 | /* We have to wait for the essa emulation to finish */ | ||
844 | synchronize_srcu(&kvm->srcu); | ||
843 | vfree(mgs->pgste_bitmap); | 845 | vfree(mgs->pgste_bitmap); |
844 | } | 846 | } |
845 | kfree(mgs); | 847 | kfree(mgs); |
@@ -849,14 +851,12 @@ static int kvm_s390_vm_stop_migration(struct kvm *kvm) | |||
849 | static int kvm_s390_vm_set_migration(struct kvm *kvm, | 851 | static int kvm_s390_vm_set_migration(struct kvm *kvm, |
850 | struct kvm_device_attr *attr) | 852 | struct kvm_device_attr *attr) |
851 | { | 853 | { |
852 | int idx, res = -ENXIO; | 854 | int res = -ENXIO; |
853 | 855 | ||
854 | mutex_lock(&kvm->lock); | 856 | mutex_lock(&kvm->slots_lock); |
855 | switch (attr->attr) { | 857 | switch (attr->attr) { |
856 | case KVM_S390_VM_MIGRATION_START: | 858 | case KVM_S390_VM_MIGRATION_START: |
857 | idx = srcu_read_lock(&kvm->srcu); | ||
858 | res = kvm_s390_vm_start_migration(kvm); | 859 | res = kvm_s390_vm_start_migration(kvm); |
859 | srcu_read_unlock(&kvm->srcu, idx); | ||
860 | break; | 860 | break; |
861 | case KVM_S390_VM_MIGRATION_STOP: | 861 | case KVM_S390_VM_MIGRATION_STOP: |
862 | res = kvm_s390_vm_stop_migration(kvm); | 862 | res = kvm_s390_vm_stop_migration(kvm); |
@@ -864,7 +864,7 @@ static int kvm_s390_vm_set_migration(struct kvm *kvm, | |||
864 | default: | 864 | default: |
865 | break; | 865 | break; |
866 | } | 866 | } |
867 | mutex_unlock(&kvm->lock); | 867 | mutex_unlock(&kvm->slots_lock); |
868 | 868 | ||
869 | return res; | 869 | return res; |
870 | } | 870 | } |
@@ -1754,7 +1754,9 @@ long kvm_arch_vm_ioctl(struct file *filp, | |||
1754 | r = -EFAULT; | 1754 | r = -EFAULT; |
1755 | if (copy_from_user(&args, argp, sizeof(args))) | 1755 | if (copy_from_user(&args, argp, sizeof(args))) |
1756 | break; | 1756 | break; |
1757 | mutex_lock(&kvm->slots_lock); | ||
1757 | r = kvm_s390_get_cmma_bits(kvm, &args); | 1758 | r = kvm_s390_get_cmma_bits(kvm, &args); |
1759 | mutex_unlock(&kvm->slots_lock); | ||
1758 | if (!r) { | 1760 | if (!r) { |
1759 | r = copy_to_user(argp, &args, sizeof(args)); | 1761 | r = copy_to_user(argp, &args, sizeof(args)); |
1760 | if (r) | 1762 | if (r) |
@@ -1768,7 +1770,9 @@ long kvm_arch_vm_ioctl(struct file *filp, | |||
1768 | r = -EFAULT; | 1770 | r = -EFAULT; |
1769 | if (copy_from_user(&args, argp, sizeof(args))) | 1771 | if (copy_from_user(&args, argp, sizeof(args))) |
1770 | break; | 1772 | break; |
1773 | mutex_lock(&kvm->slots_lock); | ||
1771 | r = kvm_s390_set_cmma_bits(kvm, &args); | 1774 | r = kvm_s390_set_cmma_bits(kvm, &args); |
1775 | mutex_unlock(&kvm->slots_lock); | ||
1772 | break; | 1776 | break; |
1773 | } | 1777 | } |
1774 | default: | 1778 | default: |