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:   Tue, 3 Aug 2021 10:11:31 +0200
From:   Hans Verkuil <hverkuil-cisco@...all.nl>
To:     Sergey Senozhatsky <senozhatsky@...omium.org>,
        Tomasz Figa <tfiga@...omium.org>
Cc:     Dafna Hirschfeld <dafna.hirschfeld@...labora.com>,
        Ricardo Ribalda <ribalda@...omium.org>,
        Christoph Hellwig <hch@....de>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCHv4 4/8] videobuf2: move cache_hints handling to allocators

On 27/07/2021 09:05, Sergey Senozhatsky wrote:
> This moves cache hints handling from videobuf2 core down

from -> from the

> to allocators level, because allocators do the sync/flush

to allocators -> to the allocator's

> caches eventually and may take better decisions. Besides,
> allocators already decide whether cache sync/flush should
> be done or can be skipped. This patch moves the scattered
> buffer cache sync logic to one common place.

Regards,

	Hans

> 
> Signed-off-by: Sergey Senozhatsky <senozhatsky@...omium.org>
> ---
>  drivers/media/common/videobuf2/videobuf2-core.c       | 6 ------
>  drivers/media/common/videobuf2/videobuf2-dma-contig.c | 6 ++++++
>  drivers/media/common/videobuf2/videobuf2-dma-sg.c     | 6 ++++++
>  3 files changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c
> index 76210c006958..55af63d54f23 100644
> --- a/drivers/media/common/videobuf2/videobuf2-core.c
> +++ b/drivers/media/common/videobuf2/videobuf2-core.c
> @@ -328,9 +328,6 @@ static void __vb2_buf_mem_prepare(struct vb2_buffer *vb)
>  		return;
>  
>  	vb->synced = 1;
> -	if (vb->skip_cache_sync_on_prepare)
> -		return;
> -
>  	for (plane = 0; plane < vb->num_planes; ++plane)
>  		call_void_memop(vb, prepare, vb->planes[plane].mem_priv);
>  }
> @@ -347,9 +344,6 @@ static void __vb2_buf_mem_finish(struct vb2_buffer *vb)
>  		return;
>  
>  	vb->synced = 0;
> -	if (vb->skip_cache_sync_on_finish)
> -		return;
> -
>  	for (plane = 0; plane < vb->num_planes; ++plane)
>  		call_void_memop(vb, finish, vb->planes[plane].mem_priv);
>  }
> diff --git a/drivers/media/common/videobuf2/videobuf2-dma-contig.c b/drivers/media/common/videobuf2/videobuf2-dma-contig.c
> index 019c3843dc6d..1e218bc440c6 100644
> --- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c
> +++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c
> @@ -101,6 +101,9 @@ static void vb2_dc_prepare(void *buf_priv)
>  	struct vb2_dc_buf *buf = buf_priv;
>  	struct sg_table *sgt = buf->dma_sgt;
>  
> +	if (buf->vb->skip_cache_sync_on_prepare)
> +		return;
> +
>  	if (!sgt)
>  		return;
>  
> @@ -112,6 +115,9 @@ static void vb2_dc_finish(void *buf_priv)
>  	struct vb2_dc_buf *buf = buf_priv;
>  	struct sg_table *sgt = buf->dma_sgt;
>  
> +	if (buf->vb->skip_cache_sync_on_finish)
> +		return;
> +
>  	if (!sgt)
>  		return;
>  
> diff --git a/drivers/media/common/videobuf2/videobuf2-dma-sg.c b/drivers/media/common/videobuf2/videobuf2-dma-sg.c
> index 50265080cfc8..33ee63a99139 100644
> --- a/drivers/media/common/videobuf2/videobuf2-dma-sg.c
> +++ b/drivers/media/common/videobuf2/videobuf2-dma-sg.c
> @@ -204,6 +204,9 @@ static void vb2_dma_sg_prepare(void *buf_priv)
>  	struct vb2_dma_sg_buf *buf = buf_priv;
>  	struct sg_table *sgt = buf->dma_sgt;
>  
> +	if (buf->vb->skip_cache_sync_on_prepare)
> +		return;
> +
>  	dma_sync_sgtable_for_device(buf->dev, sgt, buf->dma_dir);
>  }
>  
> @@ -212,6 +215,9 @@ static void vb2_dma_sg_finish(void *buf_priv)
>  	struct vb2_dma_sg_buf *buf = buf_priv;
>  	struct sg_table *sgt = buf->dma_sgt;
>  
> +	if (buf->vb->skip_cache_sync_on_finish)
> +		return;
> +
>  	dma_sync_sgtable_for_cpu(buf->dev, sgt, buf->dma_dir);
>  }
>  
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ