All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] drm: Remove PageReserved manipulation from drm_pci_alloc
@ 2020-02-02 17:16 ` Chris Wilson
  0 siblings, 0 replies; 42+ messages in thread
From: Chris Wilson @ 2020-02-02 17:16 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, Chris Wilson, stable

drm_pci_alloc/drm_pci_free are very thin wrappers around the core dma
facilities, and we have no special reason within the drm layer to behave
differently. In particular, since

commit de09d31dd38a50fdce106c15abd68432eebbd014
Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Date:   Fri Jan 15 16:51:42 2016 -0800

    page-flags: define PG_reserved behavior on compound pages

    As far as I can see there's no users of PG_reserved on compound pages.
    Let's use PF_NO_COMPOUND here.

it has been illegal to combine GFP_COMP with SetPageReserved, so lets
stop doing both and leave the dma layer to its own devices.

Reported-by: Taketo Kabe
Closes: https://gitlab.freedesktop.org/drm/intel/issues/1027
Fixes: de09d31dd38a ("page-flags: define PG_reserved behavior on compound pages")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: <stable@vger.kernel.org> # v4.5+
---
 drivers/gpu/drm/drm_pci.c | 23 ++---------------------
 1 file changed, 2 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index f2e43d341980..d16dac4325f9 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -51,8 +51,6 @@
 drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align)
 {
 	drm_dma_handle_t *dmah;
-	unsigned long addr;
-	size_t sz;
 
 	/* pci_alloc_consistent only guarantees alignment to the smallest
 	 * PAGE_SIZE order which is greater than or equal to the requested size.
@@ -68,20 +66,13 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t ali
 	dmah->size = size;
 	dmah->vaddr = dma_alloc_coherent(&dev->pdev->dev, size,
 					 &dmah->busaddr,
-					 GFP_KERNEL | __GFP_COMP);
+					 GFP_KERNEL);
 
 	if (dmah->vaddr == NULL) {
 		kfree(dmah);
 		return NULL;
 	}
 
-	/* XXX - Is virt_to_page() legal for consistent mem? */
-	/* Reserve */
-	for (addr = (unsigned long)dmah->vaddr, sz = size;
-	     sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) {
-		SetPageReserved(virt_to_page((void *)addr));
-	}
-
 	return dmah;
 }
 
@@ -94,19 +85,9 @@ EXPORT_SYMBOL(drm_pci_alloc);
  */
 void __drm_legacy_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah)
 {
-	unsigned long addr;
-	size_t sz;
-
-	if (dmah->vaddr) {
-		/* XXX - Is virt_to_page() legal for consistent mem? */
-		/* Unreserve */
-		for (addr = (unsigned long)dmah->vaddr, sz = dmah->size;
-		     sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) {
-			ClearPageReserved(virt_to_page((void *)addr));
-		}
+	if (dmah->vaddr)
 		dma_free_coherent(&dev->pdev->dev, dmah->size, dmah->vaddr,
 				  dmah->busaddr);
-	}
 }
 
 /**
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 42+ messages in thread

end of thread, other threads:[~2020-02-05 14:45 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-02 17:16 [PATCH 1/5] drm: Remove PageReserved manipulation from drm_pci_alloc Chris Wilson
2020-02-02 17:16 ` [Intel-gfx] " Chris Wilson
2020-02-02 17:16 ` Chris Wilson
2020-02-02 17:16 ` [PATCH 2/5] drm: Remove the dma_alloc_coherent wrapper for internal usage Chris Wilson
2020-02-02 17:16   ` [Intel-gfx] " Chris Wilson
2020-02-03 21:50   ` Alex Deucher
2020-02-03 21:50     ` [Intel-gfx] " Alex Deucher
2020-02-02 17:16 ` [PATCH 3/5] drm/r128: Wean off drm_pci_alloc Chris Wilson
2020-02-02 17:16   ` [Intel-gfx] " Chris Wilson
2020-02-03 21:53   ` Alex Deucher
2020-02-03 21:53     ` [Intel-gfx] " Alex Deucher
2020-02-04  2:29   ` kbuild test robot
2020-02-04  2:29     ` kbuild test robot
2020-02-04  2:29     ` [Intel-gfx] " kbuild test robot
2020-02-02 17:16 ` [PATCH 4/5] drm/i915: Wean off drm_pci_alloc/drm_pci_free Chris Wilson
2020-02-02 17:16   ` [Intel-gfx] " Chris Wilson
2020-02-02 17:16   ` Chris Wilson
2020-02-05 14:45   ` Sasha Levin
2020-02-05 14:45     ` [Intel-gfx] " Sasha Levin
2020-02-02 17:16 ` [PATCH 5/5] drm: Remove exports for drm_pci_alloc/drm_pci_free Chris Wilson
2020-02-02 17:16   ` [Intel-gfx] " Chris Wilson
2020-02-03 21:55   ` Alex Deucher
2020-02-03 21:55     ` [Intel-gfx] " Alex Deucher
2020-02-04  4:46   ` kbuild test robot
2020-02-04  4:46     ` kbuild test robot
2020-02-04  4:46     ` [Intel-gfx] " kbuild test robot
2020-02-04  8:34   ` kbuild test robot
2020-02-04  8:34     ` kbuild test robot
2020-02-04  8:34     ` [Intel-gfx] " kbuild test robot
2020-02-04 14:18   ` Daniel Vetter
2020-02-04 14:18     ` Daniel Vetter
2020-02-02 17:25 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/5] drm: Remove PageReserved manipulation from drm_pci_alloc Patchwork
2020-02-02 17:49 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2020-02-02 18:35 ` [PATCH 1/5] " Sam Ravnborg
2020-02-02 18:35   ` [Intel-gfx] " Sam Ravnborg
2020-02-02 18:35   ` Sam Ravnborg
2020-02-03 21:49 ` Alex Deucher
2020-02-03 21:49   ` [Intel-gfx] " Alex Deucher
2020-02-03 21:49   ` Alex Deucher
2020-02-04 22:59   ` Chris Wilson
2020-02-04 22:59     ` [Intel-gfx] " Chris Wilson
2020-02-04 22:59     ` Chris Wilson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.