From: Sumit Gupta <sumitg@nvidia.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
<treding@nvidia.com>, <dmitry.osipenko@collabora.com>,
<viresh.kumar@linaro.org>, <rafael@kernel.org>,
<jonathanh@nvidia.com>, <robh+dt@kernel.org>,
<lpieralisi@kernel.org>, <helgaas@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <linux-tegra@vger.kernel.org>,
<linux-pm@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-pci@vger.kernel.org>, <mmaddireddy@nvidia.com>,
<kw@linux.com>, <bhelgaas@google.com>, <vidyas@nvidia.com>,
<sanjayc@nvidia.com>, <ksitaraman@nvidia.com>, <ishah@nvidia.com>,
<bbasu@nvidia.com>, Sumit Gupta <sumitg@nvidia.com>
Subject: Re: [Patch v7 1/8] memory: tegra: add interconnect support for DRAM scaling in Tegra234
Date: Tue, 9 May 2023 20:17:41 +0530 [thread overview]
Message-ID: <10e2d3b4-d66f-947f-4643-97b1f04e4b31@nvidia.com> (raw)
In-Reply-To: <0815c0b5-304b-568f-5a64-d19d7d2aeb93@linaro.org>
On 09/05/23 19:06, Krzysztof Kozlowski wrote:
> External email: Use caution opening links or attachments
>
>
> On 09/05/2023 15:17, Sumit Gupta wrote:
>>>>>>> + /*
>>>>>>> + * MC driver probe can't get BPMP reference as
>>>>>>> it gets probed
>>>>>>> + * earlier than BPMP. So, save the BPMP ref got
>>>>>>> from the EMC
>>>>>>> + * DT node in the mc->bpmp and use it in MC's
>>>>>>> icc_set hook.
>>>>>>> + */
>>>>>>> + mc->bpmp = emc->bpmp;
>>>>>>
>>>>>> This (and ()) are called without any locking. You register first the
>>>>>> interconnect, so set() callback can be used, right? Then set() could be
>>>>>> called anytime between tegra_emc_interconnect_init() and assignment
>>>>>> above. How do you synchronize these?
>>>>>>
>>>>>> Best regards,
>>>>>> Krzysztof
>>>>>>
>>>>>
>>>>> Currently, the tegra234_mc_icc_set() has NULL check. So, it will give
>>>>> this error.
>>>>> if (!mc->bpmp) {
>>>
>>> How does it solve concurrent accesses and re-ordering of instructions by
>>> compiler or CPU?
>>>
>>
>> Now, the "mc->bpmp" is set before tegra_emc_interconnect_init().
>> So, until the EMC interconnect initializes, set() won't be
>> called as the devm_of_icc_get() call will fail.
>
> What if compiler puts "mc->bpmp" assignment after
> tegra_emc_interconnect_init()?
>
> What if CPU executes above assignment also after
> tegra_emc_interconnect_init()?
>
> Considering amount of code inside tegra_emc_interconnect_init() second
> case is rather unlikely, but first possible, right?
>
> Best regards,
> Krzysztof
>
Yes, for protection from compiler re-ordering I can add
barrier() after the assignment.
mc->bpmp = emc->bpmp;
barrier();
Thank you,
Sumit Gupta
next prev parent reply other threads:[~2023-05-09 14:48 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-24 13:13 [Patch v7 0/8] Tegra234 Memory interconnect support Sumit Gupta
2023-04-24 13:13 ` [Patch v7 1/8] memory: tegra: add interconnect support for DRAM scaling in Tegra234 Sumit Gupta
2023-04-24 13:48 ` Krzysztof Kozlowski
2023-04-24 15:00 ` Sumit Gupta
2023-04-24 15:21 ` Sumit Gupta
2023-05-07 9:11 ` Krzysztof Kozlowski
2023-05-09 13:17 ` Sumit Gupta
2023-05-09 13:36 ` Krzysztof Kozlowski
2023-05-09 14:47 ` Sumit Gupta [this message]
2023-04-24 13:13 ` [Patch v7 2/8] memory: tegra: add mc clients for Tegra234 Sumit Gupta
2023-04-24 13:13 ` [Patch v7 3/8] memory: tegra: add software mc clients in Tegra234 Sumit Gupta
2023-04-24 13:13 ` [Patch v7 4/8] dt-bindings: tegra: add icc ids for dummy MC clients Sumit Gupta
2023-04-24 13:13 ` [Patch v7 5/8] memory: tegra: make cpu cluster bw request a multiple of mc channels Sumit Gupta
2023-04-24 13:13 ` [Patch v7 6/8] PCI: tegra194: Fix possible array out of bounds access Sumit Gupta
2023-04-24 13:13 ` [Patch v7 7/8] PCI: tegra194: Add interconnect support in Tegra234 Sumit Gupta
2023-04-24 13:13 ` [Patch v7 8/8] arm64: tegra: Add cpu OPP tables and interconnects property Sumit Gupta
2023-04-24 13:41 ` [Patch v7 0/8] Tegra234 Memory interconnect support Krzysztof Kozlowski
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=10e2d3b4-d66f-947f-4643-97b1f04e4b31@nvidia.com \
--to=sumitg@nvidia.com \
--cc=bbasu@nvidia.com \
--cc=bhelgaas@google.com \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.osipenko@collabora.com \
--cc=helgaas@kernel.org \
--cc=ishah@nvidia.com \
--cc=jonathanh@nvidia.com \
--cc=krzysztof.kozlowski@linaro.org \
--cc=ksitaraman@nvidia.com \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mmaddireddy@nvidia.com \
--cc=rafael@kernel.org \
--cc=robh+dt@kernel.org \
--cc=sanjayc@nvidia.com \
--cc=treding@nvidia.com \
--cc=vidyas@nvidia.com \
--cc=viresh.kumar@linaro.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;
as well as URLs for NNTP newsgroup(s).