ia64/linux-2.6.18-xen.hg

changeset 893:f994bfe9b93b

linux/blktap2: reduce TLB flush scope

c/s 885 added very coarse TLB flushing. Since these flushes always
follow single page updates, single page flushes (when available) are
sufficient.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jun 04 10:32:57 2009 +0100 (2009-06-04)
parents 485fe5efa4ff
children 4e5cd2fc45a7
files arch/i386/mm/hypervisor.c drivers/xen/blktap2/device.c
line diff
     1.1 --- a/arch/i386/mm/hypervisor.c	Thu Jun 04 10:32:34 2009 +0100
     1.2 +++ b/arch/i386/mm/hypervisor.c	Thu Jun 04 10:32:57 2009 +0100
     1.3 @@ -142,6 +142,7 @@ void xen_invlpg_all(unsigned long ptr)
     1.4  	op.arg1.linear_addr = ptr & PAGE_MASK;
     1.5  	BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
     1.6  }
     1.7 +EXPORT_SYMBOL_GPL(xen_invlpg_all);
     1.8  
     1.9  void xen_invlpg_mask(cpumask_t *mask, unsigned long ptr)
    1.10  {
    1.11 @@ -153,6 +154,7 @@ void xen_invlpg_mask(cpumask_t *mask, un
    1.12  	set_xen_guest_handle(op.arg2.vcpumask, mask->bits);
    1.13  	BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
    1.14  }
    1.15 +EXPORT_SYMBOL_GPL(xen_invlpg_mask);
    1.16  
    1.17  #endif /* CONFIG_SMP */
    1.18  
     2.1 --- a/drivers/xen/blktap2/device.c	Thu Jun 04 10:32:34 2009 +0100
     2.2 +++ b/drivers/xen/blktap2/device.c	Thu Jun 04 10:32:57 2009 +0100
     2.3 @@ -193,6 +193,16 @@ blktap_umap_uaddr(struct mm_struct *mm, 
     2.4  				   PAGE_SIZE, blktap_umap_uaddr_fn, mm);
     2.5  }
     2.6  
     2.7 +static inline void
     2.8 +flush_tlb_kernel_page(unsigned long kvaddr)
     2.9 +{
    2.10 +#ifdef CONFIG_X86
    2.11 +	xen_invlpg_all(kvaddr);
    2.12 +#else
    2.13 +	flush_tlb_kernel_range(kvaddr, kvaddr + PAGE_SIZE);
    2.14 +#endif
    2.15 +}
    2.16 +
    2.17  static void
    2.18  blktap_device_end_dequeued_request(struct blktap_device *dev,
    2.19  				   struct request *req, int uptodate)
    2.20 @@ -322,7 +332,7 @@ blktap_unmap(struct blktap *tap, struct 
    2.21  		if (request->handles[i].kernel == INVALID_GRANT_HANDLE) {
    2.22  			kvaddr = request_to_kaddr(request, i);
    2.23  			blktap_umap_uaddr(&init_mm, kvaddr);
    2.24 -			flush_tlb_kernel_range(kvaddr, kvaddr + PAGE_SIZE);
    2.25 +			flush_tlb_kernel_page(kvaddr);
    2.26  			set_phys_to_machine(__pa(kvaddr) >> PAGE_SHIFT,
    2.27  					    INVALID_P2M_ENTRY);
    2.28  		}
    2.29 @@ -552,9 +562,9 @@ blktap_map(struct blktap *tap,
    2.30  
    2.31  	pte = mk_pte(page, ring->vma->vm_page_prot);
    2.32  	blktap_map_uaddr(ring->vma->vm_mm, uvaddr, pte_mkwrite(pte));
    2.33 -	flush_tlb_mm(ring->vma->vm_mm);
    2.34 +	flush_tlb_page(ring->vma, uvaddr);
    2.35  	blktap_map_uaddr(&init_mm, kvaddr, mk_pte(page, PAGE_KERNEL));
    2.36 -	flush_tlb_kernel_range(kvaddr, kvaddr + PAGE_SIZE);
    2.37 +	flush_tlb_kernel_page(kvaddr);
    2.38  
    2.39  	set_phys_to_machine(__pa(kvaddr) >> PAGE_SHIFT, pte_mfn(pte));
    2.40  	request->handles[seg].kernel = INVALID_GRANT_HANDLE;