Skip to contentSkip to conversation

Misc. rproc fixes around fixed memory region support

PATCH Applied Suman Anna 6 participants 10 messages Apr 20, 2020 – May 13, 2020 Remote processor (remoteproc)

lore
Share & tools
lore

Suman Anna

author
#0 lore raw

v3 cover Misc. rproc fixes around fixed memory region support

Hi Bjorn,

This is another minor revision of the fixes around fixed memory region support [1] series. Patch 1 is revised to go back to the logic used in v1 after a long discussion on the v2 version [2]. The other suggestions can be future improvments as they would require corresponding platform driver changes. Please look through the discussion there and let us know your preference. Patches are based on v5.7-rc1.

I really appreciate it if you can target the series for the current 5.7 -rc's. The fixes would apply for all 5.1+ kernels.

Please see the v1 cover-letter [1] for the details on the issues.

regards
Suman

[1] https://patchwork.kernel.org/cover/11422723/
[2] https://patchwork.kernel.org/comment/23274389/

Suman Anna (1):
remoteproc: Fix and restore the parenting hierarchy for vdev

Tero Kristo (1):
remoteproc: Fall back to using parent memory pool if no dedicated
available

 drivers/remoteproc/remoteproc_core.c   |  2 +-
 drivers/remoteproc/remoteproc_virtio.c | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)
Signature · 1 line
2.26.0
author
#1 lore raw

PATCH v3 1/2 remoteproc: Fall back to using parent memory pool if no dedicated available

From: Tero Kristo <[email protected]>

In some cases, like with OMAP remoteproc, we are not creating dedicated memory pool for the virtio device. Instead, we use the same memory pool for all shared memories. The current virtio memory pool handling forces a split between these two, as a separate device is created for it, causing memory to be allocated from bad location if the dedicated pool is not available. Fix this by falling back to using the parent device memory pool if dedicated is not available.

Fixes 086d08725d34 ("remoteproc: create vdev subdevice with specific dma memory pool")

---
v3:
- Go back to v1 logic (removed the vdevbuf_mem_id variable added in v2)
- Revised the comment to remove references to vdevbuf_mem_id
- Capitalize the patch header
v2: https://patchwork.kernel.org/patch/11447651/

 drivers/remoteproc/remoteproc_virtio.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/remoteproc/remoteproc_virtio.c +12 -0
index e61d738d9b47..44187fe43677 100644
@@ -376,6 +376,18 @@ int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id)
 				goto out;
 			}
 		}
+	} else {
+		struct device_node *np = rproc->dev.parent->of_node;
+
+		/*
+		 * If we don't have dedicated buffer, just attempt to re-assign
+		 * the reserved memory from our parent. A default memory-region
+		 * at index 0 from the parent's memory-regions is assigned for
+		 * the rvdev dev to allocate from. Failure is non-critical and
+		 * the allocations will fall back to global pools, so don't
+		 * check return value either.
+		 */
+		of_reserved_mem_device_init_by_idx(dev, np, 0);
 	}
 
 	/* Allocate virtio device */
Signature · 1 line
2.26.0
Acked-by on v3 1/2
#2 lore raw

Re: [PATCH v3 1/2] remoteproc: Fall back to using parent memory pool if no dedicated available

Hi Suman

Quoted 9 lines · Suman Anna

From: Tero Kristo <[email protected]>

In some cases, like with OMAP remoteproc, we are not creating dedicated memory pool for the virtio device. Instead, we use the same memory pool for all shared memories. The current virtio memory pool handling forces a split between these two, as a separate device is created for it, causing memory to be allocated from bad location if the dedicated pool is not available. Fix this by falling back to using the parent device memory pool if dedicated is not available.

As it fixes the implementation of the legacy, that seems reasonable to me.

Quoted 38 lines
Fixes 086d08725d34 ("remoteproc: create vdev subdevice with specific dma memory pool")

---
v3:
- Go back to v1 logic (removed the vdevbuf_mem_id variable added in v2)
- Revised the comment to remove references to vdevbuf_mem_id
- Capitalize the patch header
v2: https://patchwork.kernel.org/patch/11447651/

 drivers/remoteproc/remoteproc_virtio.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/remoteproc/remoteproc_virtio.c +12 -0
index e61d738d9b47..44187fe43677 100644
@@ -376,6 +376,18 @@ int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id)
 				goto out;
 			}
 		}
+	} else {
+		struct device_node *np = rproc->dev.parent->of_node;
+
+		/*
+		 * If we don't have dedicated buffer, just attempt to re-assign
+		 * the reserved memory from our parent. A default memory-region
+		 * at index 0 from the parent's memory-regions is assigned for
+		 * the rvdev dev to allocate from. Failure is non-critical and
+		 * the allocations will fall back to global pools, so don't
+		 * check return value either.
+		 */
+		of_reserved_mem_device_init_by_idx(dev, np, 0);
 	}
 
 	/* Allocate virtio device */
maintainer Reviewed-by on v3 1/2
#3 lore raw

Re: [PATCH v3 1/2] remoteproc: Fall back to using parent memory pool if no dedicated available

In reply to Suman Anna
Quoted 11 lines · Suman Anna

From: Tero Kristo <[email protected]>

In some cases, like with OMAP remoteproc, we are not creating dedicated memory pool for the virtio device. Instead, we use the same memory pool for all shared memories. The current virtio memory pool handling forces a split between these two, as a separate device is created for it, causing memory to be allocated from bad location if the dedicated pool is not available. Fix this by falling back to using the parent device memory pool if dedicated is not available.

Quoted 3 lines
Fixes 086d08725d34 ("remoteproc: create vdev subdevice with specific dma memory pool")
Quoted 37 lines

---
v3:
- Go back to v1 logic (removed the vdevbuf_mem_id variable added in v2)
- Revised the comment to remove references to vdevbuf_mem_id
- Capitalize the patch header
v2: https://patchwork.kernel.org/patch/11447651/

 drivers/remoteproc/remoteproc_virtio.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/remoteproc/remoteproc_virtio.c +12 -1
index e61d738d9b47..44187fe43677 100644
@@ -376,6 +376,18 @@ int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id)
                                goto out;
                        }
                }
+       } else {
+               struct device_node *np = rproc->dev.parent->of_node;
+
+               /*
+                * If we don't have dedicated buffer, just attempt to re-assign
+                * the reserved memory from our parent. A default memory-region
+                * at index 0 from the parent's memory-regions is assigned for
+                * the rvdev dev to allocate from. Failure is non-critical and
+                * the allocations will fall back to global pools, so don't
+                * check return value either.
+                */
+               of_reserved_mem_device_init_by_idx(dev, np, 0);
        }
 
        /* Allocate virtio device */
--

2.26.0

author
#4 lore raw

PATCH v3 2/2 remoteproc: Fix and restore the parenting hierarchy for vdev

In reply to Suman Anna

The commit 086d08725d34 ("remoteproc: create vdev subdevice with specific dma memory pool") has introduced a new vdev subdevice for each vdev declared in the firmware resource table and made it as the parent for the created virtio rpmsg devices instead of the previous remoteproc device. This changed the overall parenting hierarchy for the rpmsg devices, which were children of virtio devices, and does not allow the corresponding rpmsg drivers to retrieve the parent rproc device through the rproc_get_by_child() API.

Fix this by restoring the remoteproc device as the parent. The new vdev subdevice can continue to inherit the DMA attributes from the remoteproc's parent device (actual platform device).

Fixes 086d08725d34 ("remoteproc: create vdev subdevice with specific dma memory pool")

---
v3: No changes
v2: https://patchwork.kernel.org/patch/11447653/

 drivers/remoteproc/remoteproc_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/remoteproc/remoteproc_core.c +1 -1
index e12a54e67588..be15aace9b3c 100644
@@ -517,7 +517,7 @@ static int rproc_handle_vdev(struct rproc *rproc, struct fw_rsc_vdev *rsc,
 
 	/* Initialise vdev subdevice */
 	snprintf(name, sizeof(name), "vdev%dbuffer", rvdev->index);
-	rvdev->dev.parent = rproc->dev.parent;
+	rvdev->dev.parent = &rproc->dev;
 	rvdev->dev.dma_pfn_offset = rproc->dev.parent->dma_pfn_offset;
 	rvdev->dev.release = rproc_rvdev_release;
 	dev_set_name(&rvdev->dev, "%s#%s", dev_name(rvdev->dev.parent), name);
Signature · 1 line
2.26.0
author
#5 lore raw
In reply to Suman Anna

Hi Bjorn,

Quoted 11 lines · Suman Anna

Hi Bjorn,

This is another minor revision of the fixes around fixed memory region support [1] series. Patch 1 is revised to go back to the logic used in v1 after a long discussion on the v2 version [2]. The other suggestions can be future improvments as they would require corresponding platform driver changes. Please look through the discussion there and let us know your preference. Patches are based on v5.7-rc1.

I really appreciate it if you can target the series for the current 5.7 -rc's. The fixes would apply for all 5.1+ kernels.

Ping on these.

regards
Suman

Quoted 20 lines

Please see the v1 cover-letter [1] for the details on the issues.

regards
Suman

[1] https://patchwork.kernel.org/cover/11422723/
[2] https://patchwork.kernel.org/comment/23274389/

Suman Anna (1):
remoteproc: Fix and restore the parenting hierarchy for vdev

Tero Kristo (1):
remoteproc: Fall back to using parent memory pool if no dedicated
available

  drivers/remoteproc/remoteproc_core.c   |  2 +-
  drivers/remoteproc/remoteproc_virtio.c | 12 ++++++++++++
  2 files changed, 13 insertions(+), 1 deletion(-)
author
#6 lore raw

Hi Bjorn,

Quoted 12 lines · Suman Anna

Hi Bjorn,

Quoted 9 lines · Suman Anna

Hi Bjorn,

This is another minor revision of the fixes around fixed memory region support [1] series. Patch 1 is revised to go back to the logic used in v1 after a long discussion on the v2 version [2]. The other suggestions can be future improvments as they would require corresponding platform driver changes. Please look through the discussion there and let us know your preference. Patches are based on v5.7-rc1.

Quoted 4 lines
Quoted 2 lines

I really appreciate it if you can target the series for the current 5.7 -rc's. The fixes would apply for all 5.1+ kernels.

Ping on these.

The patches have been reviewed and/or acked by both Mathieu and Arnaud. Can you please get these into the current -rc's?

Thanks,
Suman

Quoted 25 lines

regards
Suman

Quoted 20 lines

Please see the v1 cover-letter [1] for the details on the issues.

regards
Suman

[1] https://patchwork.kernel.org/cover/11422723/
[2] https://patchwork.kernel.org/comment/23274389/

Suman Anna (1):
   remoteproc: Fix and restore the parenting hierarchy for vdev

Tero Kristo (1):
   remoteproc: Fall back to using parent memory pool if no dedicated available

  drivers/remoteproc/remoteproc_core.c   |  2 +- drivers/remoteproc/remoteproc_virtio.c | 12 ++++++++++++

  2 files changed, 13 insertions(+), 1 deletion(-)
#7 lore raw
Quoted 15 lines · Suman Anna

Hi Bjorn,

Quoted 12 lines · Suman Anna

Hi Bjorn,

Quoted 9 lines · Suman Anna

Hi Bjorn,

This is another minor revision of the fixes around fixed memory region support [1] series. Patch 1 is revised to go back to the logic used in v1 after a long discussion on the v2 version [2]. The other suggestions can be future improvments as they would require corresponding platform driver changes. Please look through the discussion there and let us know your preference. Patches are based on v5.7-rc1.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

I really appreciate it if you can target the series for the current 5.7 -rc's.
The fixes would apply for all 5.1+ kernels.

Ping on these.

The patches have been reviewed and/or acked by both Mathieu and Arnaud.

Thanks for the reviews!

Quoted 2 lines

Can you please get these into the current -rc's?

The offending patch appeared in 5.1, so I have a hard time claiming that this is a regression in 5.7-rc. I've added Cc: stable and picked the two patches for 5.8.

Thanks,
Bjorn

Quoted 29 lines

Thanks,
Suman

Quoted 25 lines

regards
Suman

Quoted 20 lines

Please see the v1 cover-letter [1] for the details on the issues.

regards
Suman

[1] https://patchwork.kernel.org/cover/11422723/
[2] https://patchwork.kernel.org/comment/23274389/

Suman Anna (1):
   remoteproc: Fix and restore the parenting hierarchy for vdev

Tero Kristo (1):
   remoteproc: Fall back to using parent memory pool if no dedicated available

  drivers/remoteproc/remoteproc_core.c   |  2 +- drivers/remoteproc/remoteproc_virtio.c | 12 ++++++++++++

  2 files changed, 13 insertions(+), 1 deletion(-)
#8 lore raw
Quoted 25 lines · Bjorn Andersson
Quoted 15 lines · Suman Anna

Hi Bjorn,

Quoted 12 lines · Suman Anna

Hi Bjorn,

Quoted 9 lines · Suman Anna

Hi Bjorn,

This is another minor revision of the fixes around fixed memory region support [1] series. Patch 1 is revised to go back to the logic used in v1 after a long discussion on the v2 version [2]. The other suggestions can be future improvments as they would require corresponding platform driver changes. Please look through the discussion there and let us know your preference. Patches are based on v5.7-rc1.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

I really appreciate it if you can target the series for the current 5.7 -rc's.
The fixes would apply for all 5.1+ kernels.

Ping on these.

The patches have been reviewed and/or acked by both Mathieu and Arnaud.

Quoted 8 lines

Thanks for the reviews!

Quoted 2 lines

Can you please get these into the current -rc's?

The offending patch appeared in 5.1, so I have a hard time claiming that this is a regression in 5.7-rc. I've added Cc: stable and picked the two patches for 5.8.

Thanks Bjorn,

I believe 5.8 should be fine, we can backport this internally if needed.

-Tero

Quoted 33 lines

Thanks,
Bjorn

Quoted 29 lines

Thanks,
Suman

Quoted 25 lines

regards
Suman

Quoted 20 lines

Please see the v1 cover-letter [1] for the details on the issues.

regards
Suman

[1] https://patchwork.kernel.org/cover/11422723/
[2] https://patchwork.kernel.org/comment/23274389/

Suman Anna (1):
   remoteproc: Fix and restore the parenting hierarchy for vdev

Tero Kristo (1):
   remoteproc: Fall back to using parent memory pool if no dedicated available

   drivers/remoteproc/remoteproc_core.c   |  2 +-
   drivers/remoteproc/remoteproc_virtio.c | 12 ++++++++++++
   2 files changed, 13 insertions(+), 1 deletion(-)

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

#9 lore raw
In reply to Suman Anna
This series was applied to andersson/remoteproc.git (refs/heads/for-next).

Hello:

This series was applied to andersson/remoteproc.git (refs/heads/for-next).

Quoted 10 lines · On Mon, 20 Apr 2020 11:05:58 -0500 you wrote:

Hi Bjorn,

This is another minor revision of the fixes around fixed memory region support [1] series. Patch 1 is revised to go back to the logic used in v1 after a long discussion on the v2 version [2]. The other suggestions can be future improvments as they would require corresponding platform driver changes. Please look through the discussion there and let us know your preference. Patches are based on v5.7-rc1.

[...]

Here is a summary with links:
- [v3,1/2] remoteproc: Fall back to using parent memory pool if no dedicated available

    https://git.kernel.org/andersson/remoteproc/c/db9178a4f8c4e523f824892cb8bab00961b07385
  - [v3,2/2] remoteproc: Fix and restore the parenting hierarchy for vdev
    https://git.kernel.org/andersson/remoteproc/c/c774ad010873bb89dcc0cdcb1e96aef6664d8caf

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/pwbot