* [PATCH 0/1] KVM: MMU: Fix 64-bit paging breakage on x86_32
@ 2011-04-27 22:02 Takuya Yoshikawa
2011-04-27 22:08 ` [PATCH 1/1] " Takuya Yoshikawa
0 siblings, 1 reply; 3+ messages in thread
From: Takuya Yoshikawa @ 2011-04-27 22:02 UTC (permalink / raw)
To: avi, mtosatti; +Cc: jan.kiszka, kvm
Sorry for being late to send.
Making a PAE guest took longer than I expected.
The test was done before "unlikely" annotation was added.
But I did compile-test after adding "unlikely" on x86_32.
Thanks,
Takuya
Test conditions:
On x86_32: PAE/non-PAE Linux guest
On x86_64: Usual 64 guest
PAE guest on x86_32 tracing results:
qemu-system-x86-2042 [000] 5752.176099: funcgraph_entry: | paging64_walk_addr_generic() {
qemu-system-x86-2042 [000] 5752.176100: funcgraph_entry: 0.183 us | get_cr3();
qemu-system-x86-2042 [000] 5752.176101: funcgraph_entry: 0.182 us | get_cr3();
qemu-system-x86-2042 [000] 5752.176102: funcgraph_entry: | load_pdptrs() {
qemu-system-x86-2042 [000] 5752.176103: funcgraph_entry: | kvm_read_guest_page_mmu() {
qemu-system-x86-2042 [000] 5752.176103: funcgraph_entry: 0.171 us | translate_gpa();
qemu-system-x86-2042 [000] 5752.176105: funcgraph_entry: | kvm_read_guest_page() {
qemu-system-x86-2042 [000] 5752.176106: funcgraph_entry: 0.240 us | gfn_to_hva();
qemu-system-x86-2042 [000] 5752.176108: funcgraph_entry: | copy_from_user() {
qemu-system-x86-2042 [000] 5752.176108: funcgraph_entry: | _copy_from_user() {
qemu-system-x86-2042 [000] 5752.176109: funcgraph_entry: 0.178 us | _cond_resched();
qemu-system-x86-2042 [000] 5752.176110: funcgraph_exit: 1.423 us | }
qemu-system-x86-2042 [000] 5752.176111: funcgraph_exit: 2.613 us | }
qemu-system-x86-2042 [000] 5752.176111: funcgraph_exit: 5.148 us | }
qemu-system-x86-2042 [000] 5752.176112: funcgraph_exit: 8.573 us | }
qemu-system-x86-2042 [000] 5752.176112: funcgraph_exit: 9.832 us | }
qemu-system-x86-2042 [000] 5752.176113: funcgraph_entry: 0.181 us | translate_gpa();
qemu-system-x86-2042 [000] 5752.176114: funcgraph_entry: 0.242 us | gfn_to_hva();
qemu-system-x86-2042 [000] 5752.176115: funcgraph_entry: 0.181 us | kvm_is_error_hva();
qemu-system-x86-2042 [000] 5752.176117: funcgraph_entry: 0.182 us | _cond_resched();
qemu-system-x86-2042 [000] 5752.176118: funcgraph_entry: 0.182 us | _cond_resched();
qemu-system-x86-2042 [000] 5752.176119: funcgraph_entry: 0.176 us | translate_gpa();
qemu-system-x86-2042 [000] 5752.176121: funcgraph_entry: 0.242 us | gfn_to_hva();
qemu-system-x86-2042 [000] 5752.176122: funcgraph_entry: 0.181 us | kvm_is_error_hva();
qemu-system-x86-2042 [000] 5752.176123: funcgraph_entry: 0.183 us | _cond_resched();
qemu-system-x86-2042 [000] 5752.176124: funcgraph_entry: 0.182 us | _cond_resched();
qemu-system-x86-2042 [000] 5752.176125: funcgraph_entry: 0.181 us | translate_gpa();
qemu-system-x86-2042 [000] 5752.176127: funcgraph_exit: + 27.102 us | }
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 1/1] KVM: MMU: Fix 64-bit paging breakage on x86_32
2011-04-27 22:02 [PATCH 0/1] KVM: MMU: Fix 64-bit paging breakage on x86_32 Takuya Yoshikawa
@ 2011-04-27 22:08 ` Takuya Yoshikawa
2011-04-28 10:06 ` Avi Kivity
0 siblings, 1 reply; 3+ messages in thread
From: Takuya Yoshikawa @ 2011-04-27 22:08 UTC (permalink / raw)
To: avi, mtosatti; +Cc: jan.kiszka, kvm
From: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Fix regression introduced by
commit e30d2a170506830d5eef5e9d7990c5aedf1b0a51
KVM: MMU: Optimize guest page table walk
On x86_32, get_user() does not support 64-bit values and we fail to
build KVM at the point of 64-bit paging.
This patch fixes this by using get_user() twice for that condition.
Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Reported-by: Jan Kiszka <jan.kiszka@web.de>
---
arch/x86/kvm/paging_tmpl.h | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index 652d56c..7d36ac9 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -115,6 +115,20 @@ static unsigned FNAME(gpte_access)(struct kvm_vcpu *vcpu, pt_element_t gpte)
return access;
}
+static int FNAME(read_gpte)(pt_element_t *pte, pt_element_t __user *ptep_user)
+{
+#if defined(CONFIG_X86_32) && (PTTYPE == 64)
+ u32 *p = (u32 *)pte;
+ u32 __user *p_user = (u32 __user *)ptep_user;
+
+ if (unlikely(get_user(*p, p_user)))
+ return -EFAULT;
+ return get_user(*(p + 1), p_user + 1);
+#else
+ return get_user(*pte, ptep_user);
+#endif
+}
+
/*
* Fetch a guest pte for a guest virtual address
*/
@@ -185,7 +199,7 @@ walk:
}
ptep_user = (pt_element_t __user *)((void *)host_addr + offset);
- if (unlikely(get_user(pte, ptep_user))) {
+ if (unlikely(FNAME(read_gpte)(&pte, ptep_user))) {
present = false;
break;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 1/1] KVM: MMU: Fix 64-bit paging breakage on x86_32
2011-04-27 22:08 ` [PATCH 1/1] " Takuya Yoshikawa
@ 2011-04-28 10:06 ` Avi Kivity
0 siblings, 0 replies; 3+ messages in thread
From: Avi Kivity @ 2011-04-28 10:06 UTC (permalink / raw)
To: Takuya Yoshikawa; +Cc: mtosatti, jan.kiszka, kvm
On 04/28/2011 01:08 AM, Takuya Yoshikawa wrote:
> From: Takuya Yoshikawa<yoshikawa.takuya@oss.ntt.co.jp>
>
> Fix regression introduced by
> commit e30d2a170506830d5eef5e9d7990c5aedf1b0a51
> KVM: MMU: Optimize guest page table walk
>
> On x86_32, get_user() does not support 64-bit values and we fail to
> build KVM at the point of 64-bit paging.
>
> This patch fixes this by using get_user() twice for that condition.
>
Applied, thanks.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-04-28 10:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-27 22:02 [PATCH 0/1] KVM: MMU: Fix 64-bit paging breakage on x86_32 Takuya Yoshikawa
2011-04-27 22:08 ` [PATCH 1/1] " Takuya Yoshikawa
2011-04-28 10:06 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox