Re: [PATCH] aio: fix D-cache aliasing issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2013-11-15 at 23:05 +0100, Helge Deller wrote:
> When a user page mapping is released via kunmap*() functions, the D-cache needs
> to be flushed via flush_dcache_page() to avoid D-cache aliasing issues.
> 
> This patch fixes aio on the parisc platform (and probably others).

This should be flush_kernel_dcache_page().  flush_dcache_page() is for
full coherency but for unmap, we know the page was coherent going in and
may have been modified by the kernel, so only the kernel view needs to
be sync'd.  Technically, by the kernel API, the flush should be done
*before* unmapping.  This would have mattered on parisc until we did
flush via tmpalias which means we no-longer care if the mapping for the
flush exists or not because we always recreate it via the tmpalias
pages.

James

> Signed-off-by: Helge Deller <deller@xxxxxx>
> To: Benjamin LaHaise <bcrl@xxxxxxxxx>
> To: linux-aio@xxxxxxxxx
> Cc: stable@xxxxxxxxxxxxxxx    # 3.12+
> 
> diff --git a/fs/aio.c b/fs/aio.c
> index 823efcb..2181821 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -514,6 +514,7 @@ static void free_ioctx(struct work_struct *work)
>  		atomic_add(avail, &ctx->reqs_available);
>  		ring->head = ring->tail;
>  		kunmap_atomic(ring);
> +		flush_dcache_page(ctx->ring_pages[0]);
>  
>  		if (atomic_read(&ctx->reqs_available) >= ctx->nr_events - 1)
>  			break;
> @@ -568,6 +569,7 @@ static int ioctx_add_table(struct kioctx *ctx, struct mm_struct *mm)
>  					ring = kmap_atomic(ctx->ring_pages[0]);
>  					ring->id = ctx->id;
>  					kunmap_atomic(ring);
> +					flush_dcache_page(ctx->ring_pages[0]);
>  					return 0;
>  				}
>  
> @@ -1032,6 +1034,7 @@ static long aio_read_events_ring(struct kioctx *ctx,
>  	head = ring->head;
>  	tail = ring->tail;
>  	kunmap_atomic(ring);
> +	flush_dcache_page(ctx->ring_pages[0]);
>  
>  	pr_debug("h%u t%u m%u\n", head, tail, ctx->nr_events);
>  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SoC]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux