Re: [PATCH 1/1 v2] KVM: MMU: Optimize guest page table walk

2011-04-26 Thread Jan Kiszka
On 2011-04-26 06:50, Takuya Yoshikawa wrote: On Mon, 25 Apr 2011 11:15:20 +0200 Jan Kiszka jan.kis...@web.de wrote: Sorry, I did not test on x86_32. Introducing a wrapper function with ifdef would be the best way? Maybe you could also add the missing 64-bit get_user for x86-32. Given

Re: [PATCH 1/1 v2] KVM: MMU: Optimize guest page table walk

2011-04-26 Thread Avi Kivity
On 04/25/2011 11:04 AM, Jan Kiszka wrote: + + ptep_user = (pt_element_t __user *)((void *)host_addr + offset); + if (get_user(pte, ptep_user)) { This doesn't work for x86-32: pte is 64 bit, but get_user is only defined up to 32 bit on that

Re: [PATCH 1/1 v2] KVM: MMU: Optimize guest page table walk

2011-04-26 Thread Avi Kivity
On 04/26/2011 10:45 AM, Jan Kiszka wrote: On 2011-04-26 09:42, Avi Kivity wrote: On 04/25/2011 11:04 AM, Jan Kiszka wrote: + +ptep_user = (pt_element_t __user *)((void *)host_addr + offset); +if (get_user(pte, ptep_user)) {

Re: [PATCH 1/1 v2] KVM: MMU: Optimize guest page table walk

2011-04-26 Thread Takuya Yoshikawa
On Tue, 26 Apr 2011 08:34:57 +0200 Jan Kiszka jan.kis...@web.de wrote: Google said that there was a similar talk on LKML in 2004. On that threads, Linus explained how to tackle on the 64-bit get_user implementation. But I could not see what happened after that. Mmh, maybe the kernel

Re: [PATCH 1/1 v2] KVM: MMU: Optimize guest page table walk

2011-04-26 Thread Avi Kivity
On 04/26/2011 05:40 PM, Takuya Yoshikawa wrote: On Tue, 26 Apr 2011 08:34:57 +0200 Jan Kiszkajan.kis...@web.de wrote: Google said that there was a similar talk on LKML in 2004. On that threads, Linus explained how to tackle on the 64-bit get_user implementation. But I could not

Re: [PATCH 1/1 v2] KVM: MMU: Optimize guest page table walk

2011-04-26 Thread Takuya Yoshikawa
Please post a simple patch that uses two get_user()s for that case (64-bit pte on 32-bit host). Then work with the x86 tree to see if they'll accept 64-bit get_user(), and once they do, we can go back to a simple get_user() again. btw, I think we can use __get_user() here since the

Re: [PATCH 1/1 v2] KVM: MMU: Optimize guest page table walk

2011-04-26 Thread Takuya Yoshikawa
On Tue, 26 Apr 2011 17:54:24 +0300 Avi Kivity a...@redhat.com wrote: Please post a simple patch that uses two get_user()s for that case (64-bit pte on 32-bit host). Then work with the x86 tree to see if they'll accept 64-bit get_user(), and once they do, we can go back to a simple

Re: [PATCH 1/1 v2] KVM: MMU: Optimize guest page table walk

2011-04-26 Thread Avi Kivity
On 04/26/2011 06:13 PM, Takuya Yoshikawa wrote: Please post a simple patch that uses two get_user()s for that case (64-bit pte on 32-bit host). Then work with the x86 tree to see if they'll accept 64-bit get_user(), and once they do, we can go back to a simple get_user() again. btw,

Re: [PATCH 1/1 v2] KVM: MMU: Optimize guest page table walk

2011-04-26 Thread Avi Kivity
On 04/26/2011 07:26 PM, Takuya Yoshikawa wrote: On Tue, 26 Apr 2011 17:54:24 +0300 Avi Kivitya...@redhat.com wrote: Please post a simple patch that uses two get_user()s for that case (64-bit pte on 32-bit host). Then work with the x86 tree to see if they'll accept 64-bit get_user(), and

Re: [PATCH 1/1 v2] KVM: MMU: Optimize guest page table walk

2011-04-25 Thread Jan Kiszka
On 2011-04-21 17:34, Takuya Yoshikawa wrote: From: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp This patch optimizes the guest page table walk by using get_user() instead of copy_from_user(). With this patch applied, paging64_walk_addr_generic() has become about 0.5us to 1.0us faster

Re: [PATCH 1/1 v2] KVM: MMU: Optimize guest page table walk

2011-04-25 Thread Takuya Yoshikawa
On Mon, 25 Apr 2011 10:04:43 +0200 Jan Kiszka jan.kis...@web.de wrote: + + ptep_user = (pt_element_t __user *)((void *)host_addr + offset); + if (get_user(pte, ptep_user)) { This doesn't work for x86-32: pte is 64 bit, but get_user is

Re: [PATCH 1/1 v2] KVM: MMU: Optimize guest page table walk

2011-04-25 Thread Jan Kiszka
On 2011-04-25 10:32, Takuya Yoshikawa wrote: On Mon, 25 Apr 2011 10:04:43 +0200 Jan Kiszka jan.kis...@web.de wrote: + + ptep_user = (pt_element_t __user *)((void *)host_addr + offset); + if (get_user(pte, ptep_user)) { This doesn't work

Re: [PATCH 1/1 v2] KVM: MMU: Optimize guest page table walk

2011-04-25 Thread Takuya Yoshikawa
On Mon, 25 Apr 2011 11:15:20 +0200 Jan Kiszka jan.kis...@web.de wrote: Sorry, I did not test on x86_32. Introducing a wrapper function with ifdef would be the best way? Maybe you could also add the missing 64-bit get_user for x86-32. Given that we have a corresponding put_user, I

Re: [PATCH 1/1 v2] KVM: MMU: Optimize guest page table walk

2011-04-24 Thread Avi Kivity
On 04/21/2011 06:34 PM, Takuya Yoshikawa wrote: From: Takuya Yoshikawayoshikawa.tak...@oss.ntt.co.jp This patch optimizes the guest page table walk by using get_user() instead of copy_from_user(). With this patch applied, paging64_walk_addr_generic() has become about 0.5us to 1.0us faster on