From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: mathieu.poirier@linaro.org
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, coresight@lists.linaro.org,
saiprakash.ranjan@codeaurora.org, leo.yan@linaro.org,
linux-arm-msm@vger.kernel.org, swboyd@chromium.org,
mike.leach@linaro.org
Subject: Re: [PATCH] coresight: Fix support for sparsely populated ports
Date: Tue, 14 Apr 2020 11:25:57 +0100 [thread overview]
Message-ID: <e63508ed-44ca-3844-809c-a8b356a89bf4@arm.com> (raw)
In-Reply-To: <20200410181745.GA13684@xps15>
Hi Mathieu,
On 04/10/2020 07:17 PM, Mathieu Poirier wrote:
> Hi Suzuki,
>
> On Thu, Apr 09, 2020 at 12:03:16PM +0100, Suzuki K Poulose wrote:
>> On some systems the firmware may not describe all the ports
>> connected to a component (e.g, for security reasons). This
>> could be especially problematic for "funnels" where we could
>> end up in modifying memory beyond the allocated space for
>> refcounts.
...
>> @@ -672,10 +687,14 @@ static int acpi_coresight_parse_graph(struct acpi_device *adev,
>> return dir;
>>
>> if (dir == ACPI_CORESIGHT_LINK_MASTER) {
>> - pdata->nr_outport++;
>> + if (ptr->outport > pdata->nr_outport)
>> + pdata->nr_outport = ptr->outport;
>> ptr++;
>> } else {
>> - pdata->nr_inport++;
>> + WARN_ON(pdata->nr_inport == ptr->child_port);
>> + /* Do not move the ptr for input connections */
>> + if (ptr->child_port > pdata->nr_inport)
>> + pdata->nr_inport = ptr->child_port;
>
> How you are using the current ptr as a scratch pad for input port was definitely
> a brain twister this morning... I would certainly appreciate a richer comment
> so that I (or anyone else) doesn't have to go through the same process the next
> time around.
>
Sure, it deserves a better comment. I will add something like :
/*
* We don't track input connection details for a device,
* except for the highest input port number. Thus we could
* reuse the current record as a scratch pad and reuse it
* by not moving the ptr ahead.
*/
>> /**
>> - * struct coresight_platform_data - data harvested from the DT specification
>> - * @nr_inport: number of input ports for this component.
>> - * @nr_outport: number of output ports for this component.
>> - * @conns: Array of nr_outport connections from this component
>> + * struct coresight_platform_data - data harvested from the firmware
>> + * specification.
>> + *
>> + * @nr_inport: Number of elements for the input connections.
>> + * @nr_outport: Number of elements for the output connections.
>> + * @conns: Sparse arrray of nr_outport connections from this component.
>
> s/arrray/array
>
> Please rebase your work on my the coresight-next branch. Other than the above
> this patch looks fine to me.
Thanks for the heads up, will do.
Cheers
Suzuki
prev parent reply other threads:[~2020-04-14 10:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-09 11:03 [PATCH] coresight: Fix support for sparsely populated ports Suzuki K Poulose
2020-04-10 18:17 ` Mathieu Poirier
2020-04-14 10:25 ` Suzuki K Poulose [this message]
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=e63508ed-44ca-3844-809c-a8b356a89bf4@arm.com \
--to=suzuki.poulose@arm.com \
--cc=coresight@lists.linaro.org \
--cc=leo.yan@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=mike.leach@linaro.org \
--cc=saiprakash.ranjan@codeaurora.org \
--cc=swboyd@chromium.org \
/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