All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] Fix issue with module unload and CTI cleanup
@ 2020-07-29 19:52 Mike Leach
  2020-07-29 19:52 ` [PATCH 1/1] coresight: cti: Fix bug clearing sysfs links on callback Mike Leach
  2020-07-30  2:41 ` [PATCH 0/1] Fix issue with module unload and CTI cleanup Tingwei Zhang
  0 siblings, 2 replies; 3+ messages in thread
From: Mike Leach @ 2020-07-29 19:52 UTC (permalink / raw)
  To: linux-arm-kernel, coresight, mathieu.poirier, tingwei
  Cc: Mike Leach, suzuki.poulose

In the proposed Coresight module set v5 [1] from Tingwei, unloading the
ETM module before the CTI module will crash on unload of the CTI module
due to the cleanup callback from Coresight to the CTI module not working
correctly in clearing sysfs callbacks.

Patch fixes this issue. Applies on [1].

Tingwei - could you consider adding this to your set for v6?

[1] https://lists.linaro.org/pipermail/coresight/2020-July/004349.html

Mike Leach (1):
  coresight: cti: Fix bug clearing sysfs links on callback

 drivers/hwtracing/coresight/coresight-core.c     | 4 ++--
 drivers/hwtracing/coresight/coresight-cti-core.c | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 1/1] coresight: cti: Fix bug clearing sysfs links on callback
  2020-07-29 19:52 [PATCH 0/1] Fix issue with module unload and CTI cleanup Mike Leach
@ 2020-07-29 19:52 ` Mike Leach
  2020-07-30  2:41 ` [PATCH 0/1] Fix issue with module unload and CTI cleanup Tingwei Zhang
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Leach @ 2020-07-29 19:52 UTC (permalink / raw)
  To: linux-arm-kernel, coresight, mathieu.poirier, tingwei
  Cc: Mike Leach, suzuki.poulose

During module unload, a coresight driver module will call back into
the CTI driver to remove any links between the two devices.

The current code has 2 issues:-
1) in the CTI driver the matching code is matching to the wrong device
so misses all the links.
2) The callback is called too late in the unload process resulting in a
crash.

This fixes both the issues.

Fixes: 177af8285b59 (coresight: cti: Enable CTI associated with devices)
Reported-by: Tingwei Zhang <tingwei@codeaurora.org>
Signed-off-by: Mike Leach <mike.leach@linaro.org>
---
 drivers/hwtracing/coresight/coresight-core.c     | 4 ++--
 drivers/hwtracing/coresight/coresight-cti-core.c | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
index a11288fbb160..c849c2afbcfb 100644
--- a/drivers/hwtracing/coresight/coresight-core.c
+++ b/drivers/hwtracing/coresight/coresight-core.c
@@ -1254,8 +1254,6 @@ static void coresight_device_release(struct device *dev)
 {
 	struct coresight_device *csdev = to_coresight_device(dev);
 
-	if (cti_assoc_ops && cti_assoc_ops->remove)
-		cti_assoc_ops->remove(csdev);
 	fwnode_handle_put(csdev->dev.fwnode);
 	kfree(csdev->refcnt);
 	kfree(csdev);
@@ -1580,6 +1578,8 @@ void coresight_unregister(struct coresight_device *csdev)
 {
 	etm_perf_del_symlink_sink(csdev);
 	/* Remove references of that device in the topology */
+	if (cti_assoc_ops && cti_assoc_ops->remove)
+		cti_assoc_ops->remove(csdev);
 	coresight_remove_conns(csdev);
 	coresight_clear_default_sink(csdev);
 	coresight_release_platform_data(csdev, csdev->pdata);
diff --git a/drivers/hwtracing/coresight/coresight-cti-core.c b/drivers/hwtracing/coresight/coresight-cti-core.c
index 255e914b21b5..c5a4213d6623 100644
--- a/drivers/hwtracing/coresight/coresight-cti-core.c
+++ b/drivers/hwtracing/coresight/coresight-cti-core.c
@@ -502,7 +502,6 @@ static bool cti_add_sysfs_link(struct cti_drvdata *drvdata,
 	link_info.orig_name = tc->con_dev_name;
 	link_info.target = tc->con_dev;
 	link_info.target_name = dev_name(&drvdata->csdev->dev);
-
 	link_err = coresight_add_sysfs_link(&link_info);
 	if (link_err)
 		dev_warn(&drvdata->csdev->dev,
@@ -608,7 +607,7 @@ void cti_remove_assoc_from_csdev(struct coresight_device *csdev)
 		ctidrv = csdev_to_cti_drvdata(csdev->ect_dev);
 		ctidev = &ctidrv->ctidev;
 		list_for_each_entry(tc, &ctidev->trig_cons, node) {
-			if (tc->con_dev == csdev->ect_dev) {
+			if (tc->con_dev == csdev) {
 				cti_remove_sysfs_link(ctidrv, tc);
 				tc->con_dev = NULL;
 				break;
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 0/1] Fix issue with module unload and CTI cleanup
  2020-07-29 19:52 [PATCH 0/1] Fix issue with module unload and CTI cleanup Mike Leach
  2020-07-29 19:52 ` [PATCH 1/1] coresight: cti: Fix bug clearing sysfs links on callback Mike Leach
@ 2020-07-30  2:41 ` Tingwei Zhang
  1 sibling, 0 replies; 3+ messages in thread
From: Tingwei Zhang @ 2020-07-30  2:41 UTC (permalink / raw)
  To: Mike Leach
  Cc: coresight, tingwei, mathieu.poirier, linux-arm-kernel, suzuki.poulose

On Thu, Jul 30, 2020 at 03:52:32AM +0800, Mike Leach wrote:
> In the proposed Coresight module set v5 [1] from Tingwei, unloading the
> ETM module before the CTI module will crash on unload of the CTI module
> due to the cleanup callback from Coresight to the CTI module not working
> correctly in clearing sysfs callbacks.
> 
> Patch fixes this issue. Applies on [1].
> 
> Tingwei - could you consider adding this to your set for v6?

Sure, Mike.  I'll pick this change into v6.

Thanks, Tingwei
> 
> [1] https://lists.linaro.org/pipermail/coresight/2020-July/004349.html
> 
> Mike Leach (1):
>   coresight: cti: Fix bug clearing sysfs links on callback
> 
>  drivers/hwtracing/coresight/coresight-core.c     | 4 ++--
>  drivers/hwtracing/coresight/coresight-cti-core.c | 3 +--
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> -- 
> 2.17.1
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-07-30  2:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29 19:52 [PATCH 0/1] Fix issue with module unload and CTI cleanup Mike Leach
2020-07-29 19:52 ` [PATCH 1/1] coresight: cti: Fix bug clearing sysfs links on callback Mike Leach
2020-07-30  2:41 ` [PATCH 0/1] Fix issue with module unload and CTI cleanup Tingwei Zhang

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.