[Intel-gfx] [PATCH 1/3] agp/intel-gtt: Don't leak the scratch page

Chris Wilson chris at chris-wilson.co.uk
Tue Jan 26 13:00:16 PST 2016


On Tue, Jan 26, 2016 at 07:49:54PM +0100, Daniel Vetter wrote:
> Recently discovered by enabling CONFIG_DMA_API_DEBUG in our CI. By the
> looks of it broken since forever.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93793
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> ---
>  drivers/char/agp/intel-gtt.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
> index 1341a94cc779..432ae61a8715 100644
> --- a/drivers/char/agp/intel-gtt.c
> +++ b/drivers/char/agp/intel-gtt.c
> @@ -1430,6 +1430,14 @@ void intel_gmch_remove(void)
>  	if (--intel_private.refcount)
>  		return;
>  
> +	if (intel_private.scratch_page) {

The page (for who knows what reason) is set to uc. We need to restore it
back to wb before releasing it.

> +		if (intel_private.needs_dmar)
> +			pci_unmap_page(intel_private.pcidev,
> +				       intel_private.scratch_page_dma,
> +				       PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
> +

set_pages_wb(intel_private.scratch_page, 1);

> +		__free_page(intel_private.scratch_page);
> +	}
>  	if (intel_private.pcidev)
>  		pci_dev_put(intel_private.pcidev);
>  	if (intel_private.bridge_dev)

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list