stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] drm: Remove PageReserved manipulation from drm_pci_alloc" failed to apply to 4.19-stable tree
@ 2020-04-15 11:32 gregkh
  2020-04-16  2:31 ` Sasha Levin
  0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2020-04-15 11:32 UTC (permalink / raw)
  To: chris, alexander.deucher, kirill.shutemov, stable; +Cc: stable


The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From ea36ec8623f56791c6ff6738d0509b7920f85220 Mon Sep 17 00:00:00 2001
From: Chris Wilson <chris@chris-wilson.co.uk>
Date: Sun, 2 Feb 2020 17:16:31 +0000
Subject: [PATCH] drm: Remove PageReserved manipulation from drm_pci_alloc

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
Bug: 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+
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200202171635.4039044-1-chris@chris-wilson.co.uk

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);
-	}
 }
 
 /**


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

* Re: FAILED: patch "[PATCH] drm: Remove PageReserved manipulation from drm_pci_alloc" failed to apply to 4.19-stable tree
  2020-04-15 11:32 FAILED: patch "[PATCH] drm: Remove PageReserved manipulation from drm_pci_alloc" failed to apply to 4.19-stable tree gregkh
@ 2020-04-16  2:31 ` Sasha Levin
  2020-04-16  7:07   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2020-04-16  2:31 UTC (permalink / raw)
  To: gregkh; +Cc: chris, alexander.deucher, kirill.shutemov, stable

On Wed, Apr 15, 2020 at 01:32:50PM +0200, gregkh@linuxfoundation.org wrote:
>
>The patch below does not apply to the 4.19-stable tree.
>If someone wants it applied there, or to any other stable or longterm
>tree, then please email the backport, including the original git commit
>id to <stable@vger.kernel.org>.
>
>thanks,
>
>greg k-h
>
>------------------ original commit in Linus's tree ------------------
>
>From ea36ec8623f56791c6ff6738d0509b7920f85220 Mon Sep 17 00:00:00 2001
>From: Chris Wilson <chris@chris-wilson.co.uk>
>Date: Sun, 2 Feb 2020 17:16:31 +0000
>Subject: [PATCH] drm: Remove PageReserved manipulation from drm_pci_alloc
>
>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
>Bug: 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+
>Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
>Link: https://patchwork.freedesktop.org/patch/msgid/20200202171635.4039044-1-chris@chris-wilson.co.uk

We didn't have 750afb08ca71 ("cross-tree: phase out
dma_zalloc_coherent()") on older kernels. Fixed and queued up.

-- 
Thanks,
Sasha

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

* Re: FAILED: patch "[PATCH] drm: Remove PageReserved manipulation from drm_pci_alloc" failed to apply to 4.19-stable tree
  2020-04-16  2:31 ` Sasha Levin
@ 2020-04-16  7:07   ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2020-04-16  7:07 UTC (permalink / raw)
  To: Sasha Levin; +Cc: chris, alexander.deucher, kirill.shutemov, stable

On Wed, Apr 15, 2020 at 10:31:21PM -0400, Sasha Levin wrote:
> On Wed, Apr 15, 2020 at 01:32:50PM +0200, gregkh@linuxfoundation.org wrote:
> > 
> > The patch below does not apply to the 4.19-stable tree.
> > If someone wants it applied there, or to any other stable or longterm
> > tree, then please email the backport, including the original git commit
> > id to <stable@vger.kernel.org>.
> > 
> > thanks,
> > 
> > greg k-h
> > 
> > ------------------ original commit in Linus's tree ------------------
> > 
> > > From ea36ec8623f56791c6ff6738d0509b7920f85220 Mon Sep 17 00:00:00 2001
> > From: Chris Wilson <chris@chris-wilson.co.uk>
> > Date: Sun, 2 Feb 2020 17:16:31 +0000
> > Subject: [PATCH] drm: Remove PageReserved manipulation from drm_pci_alloc
> > 
> > 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
> > Bug: 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+
> > Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> > Link: https://patchwork.freedesktop.org/patch/msgid/20200202171635.4039044-1-chris@chris-wilson.co.uk
> 
> We didn't have 750afb08ca71 ("cross-tree: phase out
> dma_zalloc_coherent()") on older kernels. Fixed and queued up.

Thanks for this, and all the other FAILED: fixes as well.

greg k-h

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

end of thread, other threads:[~2020-04-16  7:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-15 11:32 FAILED: patch "[PATCH] drm: Remove PageReserved manipulation from drm_pci_alloc" failed to apply to 4.19-stable tree gregkh
2020-04-16  2:31 ` Sasha Levin
2020-04-16  7:07   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).