All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/3] remoteproc: free carveout memories only after unmapping them
@ 2013-05-31 21:16 Suman Anna
  2013-07-01 14:06 ` Ohad Ben-Cohen
  0 siblings, 1 reply; 2+ messages in thread
From: Suman Anna @ 2013-05-31 21:16 UTC (permalink / raw)
  To: Ohad Ben-Cohen; +Cc: linux-kernel, Suman Anna

It is not preferable to have the allocated pages for carveout
memories freed before they are unmapped. The code that deals
with the cleanup of carveout memories is therefore moved after
the corresponding mapping entries were cleaned up.

This is mostly a no-op since the remote processors are already
stopped when the cleanup function is called, but this will make
the cleanup code follow the exact reverse path of allocation.

Signed-off-by: Suman Anna <s-anna@ti.com>
---
 drivers/remoteproc/remoteproc_core.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index bc078c0..1ea7460 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -762,14 +762,6 @@ static void rproc_resource_cleanup(struct rproc *rproc)
 		kfree(entry);
 	}
 
-	/* clean up carveout allocations */
-	list_for_each_entry_safe(entry, tmp, &rproc->carveouts, node) {
-		dma_free_coherent(dev->parent, entry->len, entry->va,
-								entry->dma);
-		list_del(&entry->node);
-		kfree(entry);
-	}
-
 	/* clean up iommu mapping entries */
 	list_for_each_entry_safe(entry, tmp, &rproc->mappings, node) {
 		size_t unmapped;
@@ -784,6 +776,14 @@ static void rproc_resource_cleanup(struct rproc *rproc)
 		list_del(&entry->node);
 		kfree(entry);
 	}
+
+	/* clean up carveout allocations */
+	list_for_each_entry_safe(entry, tmp, &rproc->carveouts, node) {
+		dma_free_coherent(dev->parent, entry->len, entry->va,
+								entry->dma);
+		list_del(&entry->node);
+		kfree(entry);
+	}
 }
 
 /*
-- 
1.8.2


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

* Re: [PATCH 3/3] remoteproc: free carveout memories only after unmapping them
  2013-05-31 21:16 [PATCH 3/3] remoteproc: free carveout memories only after unmapping them Suman Anna
@ 2013-07-01 14:06 ` Ohad Ben-Cohen
  0 siblings, 0 replies; 2+ messages in thread
From: Ohad Ben-Cohen @ 2013-07-01 14:06 UTC (permalink / raw)
  To: Suman Anna; +Cc: linux-kernel

On Sat, Jun 1, 2013 at 12:16 AM, Suman Anna <s-anna@ti.com> wrote:
> It is not preferable to have the allocated pages for carveout
> memories freed before they are unmapped. The code that deals
> with the cleanup of carveout memories is therefore moved after
> the corresponding mapping entries were cleaned up.
>
> This is mostly a no-op since the remote processors are already
> stopped when the cleanup function is called, but this will make
> the cleanup code follow the exact reverse path of allocation.
>
> Signed-off-by: Suman Anna <s-anna@ti.com>

Applied, thanks.

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

end of thread, other threads:[~2013-07-01 14:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-31 21:16 [PATCH 3/3] remoteproc: free carveout memories only after unmapping them Suman Anna
2013-07-01 14:06 ` Ohad Ben-Cohen

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.