From: James Hogan <james.hogan@imgtec.com>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: "Paul Burton" <paul.burton@imgtec.com>,
"James Hogan" <james.hogan@imgtec.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
linux-mips@linux-mips.org, kvm@vger.kernel.org
Subject: [PATCH 1/7] MIPS: KVM/locore.S: Don't preserve host ASID around vcpu_run
Date: Fri, 6 May 2016 14:36:18 +0100 [thread overview]
Message-ID: <1462541784-22128-2-git-send-email-james.hogan@imgtec.com> (raw)
In-Reply-To: <1462541784-22128-1-git-send-email-james.hogan@imgtec.com>
MIPS KVM uses different ASIDs for guest execution than for the host.
The host ASID is saved on the stack when entering the guest with
__kvm_mips_vcpu_run(), and restored again before returning back to the
caller (exit to userland).
- This does not take into account that pre-emption may have taken place
during that time, which may have started a new ASID cycle and resulted
in that process' ASID being invalidated and reused.
- This does not take into account that the process may have migrated to
a different CPU during that time, with a different ASID assignment
since they are managed per-CPU.
- It is actually redundant, since the host ASID will be restored
correctly by kvm_arch_vcpu_put(), which is called almost immediately
after kvm_arch_vcpu_ioctl_run() returns.
Therefore drop this code from locore.S
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: linux-mips@linux-mips.org
Cc: kvm@vger.kernel.org
---
arch/mips/kvm/locore.S | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/arch/mips/kvm/locore.S b/arch/mips/kvm/locore.S
index 81687ab1b523..c24facc85357 100644
--- a/arch/mips/kvm/locore.S
+++ b/arch/mips/kvm/locore.S
@@ -32,7 +32,6 @@
EXPORT(x);
/* Overload, Danger Will Robinson!! */
-#define PT_HOST_ASID PT_BVADDR
#define PT_HOST_USERLOCAL PT_EPC
#define CP0_DDATA_LO $28,3
@@ -104,11 +103,6 @@ FEXPORT(__kvm_mips_vcpu_run)
mfc0 v0, CP0_STATUS
LONG_S v0, PT_STATUS(k1)
- /* Save host ASID, shove it into the BVADDR location */
- mfc0 v1, CP0_ENTRYHI
- andi v1, 0xff
- LONG_S v1, PT_HOST_ASID(k1)
-
/* Save DDATA_LO, will be used to store pointer to vcpu */
mfc0 v1, CP0_DDATA_LO
LONG_S v1, PT_HOST_USERLOCAL(k1)
@@ -551,12 +545,6 @@ __kvm_mips_return_to_host:
LONG_L k0, PT_HOST_USERLOCAL(k1)
mtc0 k0, CP0_DDATA_LO
- /* Restore host ASID */
- LONG_L k0, PT_HOST_ASID(sp)
- andi k0, 0xff
- mtc0 k0,CP0_ENTRYHI
- ehb
-
/* Load context saved on the host stack */
LONG_L $0, PT_R0(k1)
LONG_L $1, PT_R1(k1)
--
2.4.10
next prev parent reply other threads:[~2016-05-06 13:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-06 13:36 [PATCH 0/7] MIPS: Add extended ASID support James Hogan
2016-05-06 13:36 ` James Hogan [this message]
2016-05-09 14:22 ` [PATCH 1/7] MIPS: KVM/locore.S: Don't preserve host ASID around vcpu_run Paolo Bonzini
2016-05-09 15:30 ` Ralf Baechle
2016-05-09 19:42 ` James Hogan
2016-05-06 13:36 ` [PATCH 2/7] MIPS: Add & use CP0_EntryHi ASID definitions James Hogan
2016-05-06 13:36 ` [PATCH 3/7] MIPS: KVM: Abstract guest ASID mask James Hogan
2016-05-06 13:36 ` [PATCH 4/7] MIPS: KVM/locore.S: Only preserve callee saved registers James Hogan
2016-05-06 13:36 ` [PATCH 5/7] MIPS: KVM/locore.S: Relax noat James Hogan
2016-05-06 13:36 ` [PATCH 6/7] MIPS: Retrieve ASID masks using function accepting struct cpuinfo_mips James Hogan
2016-05-06 13:36 ` [PATCH 7/7] MIPS: Support extended ASIDs James Hogan
2016-05-09 13:23 ` [PATCH 0/7] MIPS: Add extended ASID support Ralf Baechle
2016-05-09 17:01 ` Maciej W. Rozycki
2016-05-09 19:04 ` James Hogan
2016-05-09 19:56 ` Maciej W. Rozycki
2016-05-09 19:59 ` James Hogan
2016-05-10 7:34 ` Ralf Baechle
2016-05-10 8:55 ` Maciej W. Rozycki
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=1462541784-22128-2-git-send-email-james.hogan@imgtec.com \
--to=james.hogan@imgtec.com \
--cc=kvm@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=paul.burton@imgtec.com \
--cc=pbonzini@redhat.com \
--cc=ralf@linux-mips.org \
--cc=rkrcmar@redhat.com \
/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.