From: Leonardo Bras <leonardo@linux.ibm.com>
To: kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org
Cc: Leonardo Bras <leonardo@linux.ibm.com>,
Paul Mackerras <paulus@ozlabs.org>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Michael Ellerman <mpe@ellerman.id.au>
Subject: [PATCH v2 3/4] powerpc/kvm/book3e: Replace current->mm by kvm->mm
Date: Thu, 07 Nov 2019 17:02:57 +0000 [thread overview]
Message-ID: <20191107170258.36379-4-leonardo@linux.ibm.com> (raw)
In-Reply-To: <20191107170258.36379-1-leonardo@linux.ibm.com>
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>
---
arch/powerpc/kvm/booke.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index be9a45874194..fd7bdb4f8f87 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -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);
--
2.23.0
WARNING: multiple messages have this Message-ID (diff)
From: Leonardo Bras <leonardo@linux.ibm.com>
To: kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org
Cc: Leonardo Bras <leonardo@linux.ibm.com>
Subject: [PATCH v2 3/4] powerpc/kvm/book3e: Replace current->mm by kvm->mm
Date: Thu, 7 Nov 2019 14:02:57 -0300 [thread overview]
Message-ID: <20191107170258.36379-4-leonardo@linux.ibm.com> (raw)
In-Reply-To: <20191107170258.36379-1-leonardo@linux.ibm.com>
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>
---
arch/powerpc/kvm/booke.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index be9a45874194..fd7bdb4f8f87 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -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);
--
2.23.0
WARNING: multiple messages have this Message-ID (diff)
From: Leonardo Bras <leonardo@linux.ibm.com>
To: kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org
Cc: Leonardo Bras <leonardo@linux.ibm.com>,
Paul Mackerras <paulus@ozlabs.org>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Michael Ellerman <mpe@ellerman.id.au>
Subject: [PATCH v2 3/4] powerpc/kvm/book3e: Replace current->mm by kvm->mm
Date: Thu, 7 Nov 2019 14:02:57 -0300 [thread overview]
Message-ID: <20191107170258.36379-4-leonardo@linux.ibm.com> (raw)
In-Reply-To: <20191107170258.36379-1-leonardo@linux.ibm.com>
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>
---
arch/powerpc/kvm/booke.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index be9a45874194..fd7bdb4f8f87 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -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);
--
2.23.0
next prev parent reply other threads:[~2019-11-07 17:02 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-07 17:02 [PATCH v2 0/4] Replace current->mm by kvm->mm on powerpc/kvm Leonardo Bras
2019-11-07 17:02 ` Leonardo Bras
2019-11-07 17:02 ` Leonardo Bras
2019-11-07 17:02 ` [PATCH v2 1/4] powerpc/kvm/book3s: Fixes possible 'use after release' of kvm Leonardo Bras
2019-11-07 17:02 ` Leonardo Bras
2019-11-07 17:02 ` Leonardo Bras
2019-11-12 4:57 ` Michael Ellerman
2019-11-12 4:57 ` Michael Ellerman
2019-11-12 4:57 ` Michael Ellerman
2019-11-14 18:43 ` Leonardo Bras
2019-11-14 18:43 ` Leonardo Bras
2019-11-14 18:43 ` Leonardo Bras
2019-11-21 13:24 ` Leonardo Bras
2019-11-21 13:24 ` Leonardo Bras
2019-11-21 13:24 ` Leonardo Bras
2019-11-07 17:02 ` [PATCH v2 2/4] powerpc/kvm/book3s: Replace current->mm by kvm->mm Leonardo Bras
2019-11-07 17:02 ` Leonardo Bras
2019-11-07 17:02 ` Leonardo Bras
2019-11-07 17:02 ` Leonardo Bras [this message]
2019-11-07 17:02 ` [PATCH v2 3/4] powerpc/kvm/book3e: " Leonardo Bras
2019-11-07 17:02 ` Leonardo Bras
2019-11-07 17:02 ` [PATCH v2 4/4] powerpc/kvm/e500: " Leonardo Bras
2019-11-07 17:02 ` Leonardo Bras
2019-11-07 17:02 ` Leonardo Bras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191107170258.36379-4-leonardo@linux.ibm.com \
--to=leonardo@linux.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=kvm-ppc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.