From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: James Clark <james.clark@arm.com>,
coresight@lists.linaro.org, quic_jinlmao@quicinc.com,
mike.leach@linaro.org
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>,
Leo Yan <leo.yan@linaro.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com
Subject: Re: [PATCH v3 06/13] coresight: Fix loss of connection info when a module is unloaded
Date: Thu, 30 Mar 2023 15:01:06 +0100 [thread overview]
Message-ID: <bd5bbc22-4e5e-df1c-fcd1-bef0e55b6db8@arm.com> (raw)
In-Reply-To: <d398a5c4-90f1-e717-fb73-d621f5ea845b@arm.com>
On 30/03/2023 13:42, Suzuki K Poulose wrote:
> Hi James
>
> On 29/03/2023 12:53, James Clark wrote:
>> 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.
>>
>> Signed-off-by: James Clark <james.clark@arm.com>
>
> This looks like a bug in the existing driver. Please could you keep this
> at the beginning of the series, so that it is easier to backport for
> stable ?
>
> Also, please add :
>
> Fixes: 37ea1ffddffa ("coresight: Use fwnode handle instead of device
> names")
> Fixes: 2af89ebacf29 ("coresight: Clear the connection field properly")
>
>
>> ---
>> drivers/hwtracing/coresight/coresight-core.c | 10 ++--------
>> 1 file changed, 2 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-core.c
>> b/drivers/hwtracing/coresight/coresight-core.c
>> index bfe1b93aca4e..12cbb68e8e1c 100644
>> --- a/drivers/hwtracing/coresight/coresight-core.c
>> +++ b/drivers/hwtracing/coresight/coresight-core.c
>> @@ -1414,13 +1414,8 @@ static int coresight_remove_match(struct device
>> *dev, void *data)
>> if (csdev->dev.fwnode == conn->dest_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->dest_fwnode);
>> - conn->dest_fwnode = NULL;
>> +
>> + conn->dest_dev = NULL;
>> /* No need to continue */
>> break;
>> }
>> @@ -1553,7 +1548,6 @@ void coresight_release_platform_data(struct
>> coresight_device *csdev,
>> * is going away
>> */
>> fwnode_handle_put(conns[i].dest_fwnode);
>> - pdata->out_conns[i].dest_fwnode = NULL;
>
> This change is not required, as we are freeing the pdata anyway.
> Keeping this might be beneficial if someone else comes looking
> for references while we are going out. I don't see how we could
> hit that, but just to be safe.
For reference, I could reproduce the problem by :
On juno, 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
Suzuki
>
> Suzuki
>
next prev parent reply other threads:[~2023-03-30 14:01 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-29 11:53 [PATCH v3 00/13] coresight: Fix CTI module refcount leak by making it a helper device James Clark
2023-03-29 11:53 ` [PATCH v3 01/13] coresight: Use enum type for cs_mode wherever possible James Clark
2023-03-29 11:53 ` [PATCH v3 02/13] coresight: Change name of pdata->conns James Clark
2023-03-29 11:53 ` [PATCH v3 03/13] coresight: Rename nr_outports to nr_outconns James Clark
2023-03-29 11:53 ` [PATCH v3 04/13] coresight: Rename connection members to make the direction explicit James Clark
2023-03-29 11:53 ` [PATCH v3 05/13] coresight: Dynamically add connections James Clark
2023-03-29 11:53 ` [PATCH v3 06/13] coresight: Fix loss of connection info when a module is unloaded James Clark
2023-03-30 12:42 ` Suzuki K Poulose
2023-03-30 14:01 ` Suzuki K Poulose [this message]
2023-03-29 11:53 ` [PATCH v3 07/13] coresight: Store pointers to connections rather than an array of them James Clark
2023-04-03 8:46 ` Suzuki K Poulose
2023-04-03 10:16 ` James Clark
2023-04-03 11:11 ` Suzuki K Poulose
2023-03-29 11:53 ` [PATCH v3 08/13] coresight: Simplify connection fixup mechanism James Clark
2023-04-03 9:18 ` Suzuki K Poulose
2023-03-29 11:53 ` [PATCH v3 09/13] coresight: Store in-connections as well as out-connections James Clark
2023-04-03 10:17 ` Suzuki K Poulose
2023-03-29 11:53 ` [PATCH v3 10/13] coresight: Make refcount a property of the connection James Clark
2023-04-03 11:47 ` Suzuki K Poulose
2023-04-03 14:13 ` James Clark
2023-03-29 11:53 ` [PATCH v3 11/13] coresight: Refactor out buffer allocation function for ETR James Clark
2023-03-29 11:53 ` [PATCH v3 12/13] coresight: Enable and disable helper devices adjacent to the path James Clark
2023-04-03 17:54 ` Suzuki K Poulose
2023-03-29 11:53 ` [PATCH v3 13/13] coresight: Fix CTI module refcount leak by making it a helper device James Clark
2023-04-04 9:21 ` Suzuki K Poulose
2023-04-04 12:55 ` James Clark
2023-04-04 13:04 ` James Clark
2023-04-04 13:59 ` Suzuki K Poulose
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=bd5bbc22-4e5e-df1c-fcd1-bef0e55b6db8@arm.com \
--to=suzuki.poulose@arm.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=alexandre.torgue@foss.st.com \
--cc=coresight@lists.linaro.org \
--cc=james.clark@arm.com \
--cc=leo.yan@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mathieu.poirier@linaro.org \
--cc=mcoquelin.stm32@gmail.com \
--cc=mike.leach@linaro.org \
--cc=quic_jinlmao@quicinc.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;
as well as URLs for NNTP newsgroup(s).