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:   Thu, 4 Jan 2018 01:53:25 -0800
From:   Christoph Hellwig <hch@...radead.org>
To:     Christian König 
        <ckoenig.leichtzumerken@...il.com>
Cc:     konrad.wilk@...cle.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] swiotlb: suppress warning when __GFP_NOWARN is set v4

This seems to collide with my dma direct/swiotlb series posted recently.

> +++ b/lib/swiotlb.c
> @@ -490,11 +490,11 @@ static void swiotlb_bounce(phys_addr_t orig_addr, phys_addr_t tlb_addr,
>  	}
>  }
>  
> -phys_addr_t swiotlb_tbl_map_single(struct device *hwdev,
> -				   dma_addr_t tbl_dma_addr,
> -				   phys_addr_t orig_addr, size_t size,
> -				   enum dma_data_direction dir,
> -				   unsigned long attrs)
> +static phys_addr_t tbl_map_single(struct device *hwdev,
> +				  dma_addr_t tbl_dma_addr,
> +				  phys_addr_t orig_addr, size_t size,
> +				  enum dma_data_direction dir,
> +				  unsigned long attrs, bool warn)

We already have DMA_ATTR_NO_WARN which can be passed in attrs.  Please
use it instead of reinventing it.

>  swiotlb_alloc_coherent(struct device *hwdev, size_t size,
>  		       dma_addr_t *dma_handle, gfp_t flags)
>  {
> +	bool warn = !(flags & __GFP_NOWARN);
>  	dma_addr_t dev_addr;
>  	void *ret;
>  	int order = get_order(size);
> @@ -739,7 +750,7 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size,
>  		 * will grab memory from the lowest available address range.
>  		 */
>  		phys_addr_t paddr = map_single(hwdev, 0, size,
> -					       DMA_FROM_DEVICE, 0);
> +					       DMA_FROM_DEVICE, 0, warn);

Note: in my above series swiotlb_alloc_coherent is going away, and
replaced with a swiotlb_alloc that takes a dma_attrs argument.

Using that for passing the nowarn flag is the right way to go instead
of using __GFP_NOWARN.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ