KVM: PPC: Book3E: Replace current->mm by kvm->mm
authorLeonardo Bras <leonardo@linux.ibm.com>
Tue, 26 Nov 2019 22:36:31 +0000 (19:36 -0300)
committerPaul Mackerras <paulus@ozlabs.org>
Fri, 17 Jan 2020 04:08:28 +0000 (15:08 +1100)
Given that in kvm_create_vm() there is:
kvm->mm = current->mm;

And that on every kvm_*_ioctl we have:
if (kvm->mm != current->mm)
return -EIO;

I see no reason to keep using current->mm instead of kvm->mm.

By doing so, we would reduce the use of 'global' variables on code, relying
more in the contents of kvm struct.

Signed-off-by: Leonardo Bras <leonardo@linux.ibm.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
arch/powerpc/kvm/booke.c

index be9a45874194f3b49c99417cffc00dea0be6e1ba..fd7bdb4f8f87728aa8a761e71c57cb638393e5d6 100644 (file)
@@ -775,7 +775,7 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
        debug = current->thread.debug;
        current->thread.debug = vcpu->arch.dbg_reg;
 
-       vcpu->arch.pgdir = current->mm->pgd;
+       vcpu->arch.pgdir = vcpu->kvm->mm->pgd;
        kvmppc_fix_ee_before_entry();
 
        ret = __kvmppc_vcpu_run(kvm_run, vcpu);