From: James Clark <james.clark@arm.com>
To: coresight@lists.linaro.org, quic_jinlmao@quicinc.com,
mike.leach@linaro.org, suzuki.poulose@arm.com
Cc: James Clark <james.clark@arm.com>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
Leo Yan <leo.yan@linaro.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v4 01/13] coresight: Fix loss of connection info when a module is unloaded
Date: Tue, 4 Apr 2023 14:53:47 +0100 [thread overview]
Message-ID: <20230404135401.1728919-2-james.clark@arm.com> (raw)
In-Reply-To: <20230404135401.1728919-1-james.clark@arm.com>
child_fwnode should be a read only property based on the DT. If it's
cleared on the parent device when a child is unloaded, then when the
child is loaded again the connection won't be remade.
child_dev should be cleared instead which signifies that the connection
should be remade when the child_fwnode registers a new coresight_device.
Similarly the reference count shouldn't be decremented as long as the
parent device exists. The correct place to drop the reference is in
coresight_release_platform_data() which is already done.
Reproducible on Juno with the following steps:
# load all coresight modules.
$ cd /sys/bus/coresight/devices/
$ echo 1 > tmc_etr0/enable_sink
$ echo 1 > etm0/enable_source
# Works fine ^
$ echo 0 > etm0/enable_source
$ rmmod coresight-funnel
$ modprobe coresight-funnel
$ echo 1 > etm0/enable_source
-bash: echo: write error: Invalid argument
Fixes: 37ea1ffddffa ("coresight: Use fwnode handle instead of device names")
Fixes: 2af89ebacf29 ("coresight: Clear the connection field properly")
Signed-off-by: James Clark <james.clark@arm.com>
---
drivers/hwtracing/coresight/coresight-core.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
index d3bf82c0de1d..5733294ce5cd 100644
--- a/drivers/hwtracing/coresight/coresight-core.c
+++ b/drivers/hwtracing/coresight/coresight-core.c
@@ -1419,13 +1419,8 @@ static int coresight_remove_match(struct device *dev, void *data)
if (csdev->dev.fwnode == conn->child_fwnode) {
iterator->orphan = true;
coresight_remove_links(iterator, conn);
- /*
- * Drop the reference to the handle for the remote
- * device acquired in parsing the connections from
- * platform data.
- */
- fwnode_handle_put(conn->child_fwnode);
- conn->child_fwnode = NULL;
+
+ conn->child_dev = NULL;
/* No need to continue */
break;
}
--
2.34.1
next prev parent reply other threads:[~2023-04-04 13:55 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-04 13:53 [PATCH v4 00/13] coresight: Fix CTI module refcount leak by making it a helper device James Clark
2023-04-04 13:53 ` James Clark [this message]
2023-04-04 14:02 ` [PATCH v4 01/13] coresight: Fix loss of connection info when a module is unloaded Suzuki K Poulose
2023-04-04 13:53 ` [PATCH v4 02/13] coresight: Use enum type for cs_mode wherever possible James Clark
2023-04-04 13:53 ` [PATCH v4 03/13] coresight: Change name of pdata->conns James Clark
2023-04-04 13:53 ` [PATCH v4 04/13] coresight: Rename nr_outports to nr_outconns James Clark
2023-04-04 13:53 ` [PATCH v4 05/13] coresight: Rename connection members to make the direction explicit James Clark
2023-04-04 13:53 ` [PATCH v4 06/13] coresight: Dynamically add connections James Clark
2023-04-04 13:53 ` [PATCH v4 07/13] coresight: Store pointers to connections rather than an array of them James Clark
2023-04-04 14:18 ` Suzuki K Poulose
2023-04-04 13:53 ` [PATCH v4 08/13] coresight: Simplify connection fixup mechanism James Clark
2023-04-04 13:53 ` [PATCH v4 09/13] coresight: Store in-connections as well as out-connections James Clark
2023-04-04 13:53 ` [PATCH v4 10/13] coresight: Make refcount a property of the connection James Clark
2023-04-04 13:53 ` [PATCH v4 11/13] coresight: Refactor out buffer allocation function for ETR James Clark
2023-04-04 13:53 ` [PATCH v4 12/13] coresight: Enable and disable helper devices adjacent to the path James Clark
2023-04-04 13:53 ` [PATCH v4 13/13] coresight: Fix CTI module refcount leak by making it a helper device James Clark
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230404135401.1728919-2-james.clark@arm.com \
--to=james.clark@arm.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=coresight@lists.linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=leo.yan@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=mike.leach@linaro.org \
--cc=quic_jinlmao@quicinc.com \
--cc=suzuki.poulose@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®