lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 23 Oct 2013 10:01:50 -0400
From:	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
To:	Stefano Stabellini <stefano.stabellini@...citrix.com>
Cc:	xen-devel@...ts.xensource.com, linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org, Ian.Campbell@...rix.com
Subject: Re: [PATCH v8 18/19] swiotlb-xen: no need to do execute two
 bus_to_phys translations in a row

On Thu, Oct 17, 2013 at 06:43:33PM +0100, Stefano Stabellini wrote:
> xen_unmap_single calls xen_bus_to_phys, then passes dev_addr to
> is_xen_swiotlb_buffer that calls xen_bus_to_phys again.

It does?

I see it call mfn_to_local_pfn which calls pfn_to_mfn and
get_phys_to_machine (which I presume is going to be a slow
operation on ARM).

> xen_bus_to_phys is potentially a slow operation that might involve
> walking a tree.
> We can avoid calling xen_bus_to_phys twice by removing the
> is_xen_swiotlb_buffer call and doing the check directly in
> xen_unmap_single using the physical address.
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@...citrix.com>

Have you tested this with a PFN that is in a foreign domain?

I am bit uncomfortable with this - I recall when developing this
that I had hit some odd cases of doing DMA of a page to a guest
and it not always working. It was the case of not detecting whether
the pfn was foreign or not. Sadly I can't recall the details.

I would think that this problem would also be present with ARM?
But perhaps all the new changes in the pfn_to_mfn that had lately
been done have fixed this?

> ---
>  drivers/xen/swiotlb-xen.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
> index 4d50058..6d9ca61 100644
> --- a/drivers/xen/swiotlb-xen.c
> +++ b/drivers/xen/swiotlb-xen.c
> @@ -426,8 +426,8 @@ static void xen_unmap_single(struct device *hwdev, dma_addr_t dev_addr,
>  
>  	xen_dma_unmap_page(hwdev, paddr, size, dir, attrs);
>  
> -	/* NOTE: We use dev_addr here, not paddr! */
> -	if (is_xen_swiotlb_buffer(dev_addr)) {
> +	if (paddr >= virt_to_phys(xen_io_tlb_start) &&
> +		paddr < virt_to_phys(xen_io_tlb_end)) {
>  		swiotlb_tbl_unmap_single(hwdev, paddr, size, dir);
>  		return;
>  	}
> -- 
> 1.7.2.5
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ