Re: [PATCH 3/6] KVM: MMU: introduce gfn_to_page_atomic() and gfn_to_pfn_atomic()

2010-06-17 Thread Xiao Guangrong
Avi Kivity wrote: On 06/15/2010 05:46 AM, Xiao Guangrong wrote: Introduce gfn_to_page_atomic() and gfn_to_pfn_atomic(), those functions is fast path and can used in atomic context, the later patch will use those @@ -942,6 +942,41 @@ unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn)

Re: [PATCH 3/6] KVM: MMU: introduce gfn_to_page_atomic() and gfn_to_pfn_atomic()

2010-06-16 Thread Andi Kleen
On Tue, Jun 15, 2010 at 02:22:06PM +0300, Avi Kivity wrote: Too much duplication. How about putting the tail end of the function in a common helper (with an inatomic flag)? btw, is_hwpoison_address() is racy. While it looks up the address, some other task can unmap the page tables under

Re: [PATCH 3/6] KVM: MMU: introduce gfn_to_page_atomic() and gfn_to_pfn_atomic()

2010-06-16 Thread Avi Kivity
On 06/16/2010 10:59 AM, Andi Kleen wrote: On Tue, Jun 15, 2010 at 02:22:06PM +0300, Avi Kivity wrote: Too much duplication. How about putting the tail end of the function in a common helper (with an inatomic flag)? btw, is_hwpoison_address() is racy. While it looks up the address, some

Re: [PATCH 3/6] KVM: MMU: introduce gfn_to_page_atomic() and gfn_to_pfn_atomic()

2010-06-16 Thread Andi Kleen
The page is fine, the page tables are not. Another task can munmap() the thing while is_hwpoison_address() is running. Ok that boils down to me not seeing that source. If it accesses the page tables yes then it's racy. But whoever looked up the page tables in the first place should have

Re: [PATCH 3/6] KVM: MMU: introduce gfn_to_page_atomic() and gfn_to_pfn_atomic()

2010-06-16 Thread Avi Kivity
On 06/16/2010 11:49 AM, Andi Kleen wrote: The page is fine, the page tables are not. Another task can munmap() the thing while is_hwpoison_address() is running. Ok that boils down to me not seeing that source. If it accesses the page tables yes then it's racy. But whoever looked up the

Re: [PATCH 3/6] KVM: MMU: introduce gfn_to_page_atomic() and gfn_to_pfn_atomic()

2010-06-16 Thread huang ying
On Tue, Jun 15, 2010 at 7:22 PM, Avi Kivity a...@redhat.com wrote: btw, is_hwpoison_address() is racy.  While it looks up the address, some other task can unmap the page tables under us. Andi/Huang? One way of fixing it is get_user_pages_ptes_fast(), which also returns the pte, also

Re: [PATCH 3/6] KVM: MMU: introduce gfn_to_page_atomic() and gfn_to_pfn_atomic()

2010-06-16 Thread Avi Kivity
On 06/16/2010 01:51 PM, huang ying wrote: On Tue, Jun 15, 2010 at 7:22 PM, Avi Kivitya...@redhat.com wrote: btw, is_hwpoison_address() is racy. While it looks up the address, some other task can unmap the page tables under us. Andi/Huang? One way of fixing it is

Re: [PATCH 3/6] KVM: MMU: introduce gfn_to_page_atomic() and gfn_to_pfn_atomic()

2010-06-15 Thread Avi Kivity
On 06/15/2010 05:46 AM, Xiao Guangrong wrote: Introduce gfn_to_page_atomic() and gfn_to_pfn_atomic(), those functions is fast path and can used in atomic context, the later patch will use those @@ -942,6 +942,41 @@ unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn) }

[PATCH 3/6] KVM: MMU: introduce gfn_to_page_atomic() and gfn_to_pfn_atomic()

2010-06-14 Thread Xiao Guangrong
Introduce gfn_to_page_atomic() and gfn_to_pfn_atomic(), those functions is fast path and can used in atomic context, the later patch will use those Signed-off-by: Xiao Guangrong xiaoguangr...@cn.fujitsu.com --- arch/x86/mm/gup.c|2 + include/linux/kvm_host.h |2 +