LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Doug Anderson <dianders@chromium.org>
To: Matthias Kaehlcke <mka@chromium.org>
Cc: Lina Iyer <ilina@codeaurora.org>,
Andy Gross <andy.gross@linaro.org>,
David Brown <david.brown@linaro.org>,
linux-arm-msm@vger.kernel.org,
"open list:ARM/QUALCOMM SUPPORT" <linux-soc@vger.kernel.org>,
Rajendra Nayak <rnayak@codeaurora.org>,
Bjorn Andersson <bjorn.andersson@linaro.org>,
LKML <linux-kernel@vger.kernel.org>,
Stephen Boyd <sboyd@kernel.org>,
Evan Green <evgreen@chromium.org>
Subject: Re: [PATCH v6 05/10] drivers: qcom: rpmh-rsc: write sleep/wake requests to TCS
Date: Fri, 27 Apr 2018 16:24:10 -0700 [thread overview]
Message-ID: <CAD=FV=Wan0G_GG29Q-atBbQS+_7nnbqTndE+yyi_G=scOdGMFA@mail.gmail.com> (raw)
In-Reply-To: <20180427215449.GA133494@google.com>
Hi,
On Fri, Apr 27, 2018 at 2:54 PM, Matthias Kaehlcke <mka@chromium.org> wrote:
>> > Am I getting something wrong here?
>>
>> The for_each_set_bit() should increment the 'i' and we would attempt to
>> compare the first address in the request with the next command in the
>> TCS cache. If they don't match we repeat the process again. If it does,
>> then we loop through 'j' to find if the sequence matches.
>>
>> Did I miss something?
>
> One of us is clearly in need of more caffeine or ready for the
> weekend, it might be me :) Maybe another pair of eyeballs could help
> to resolve this deadlock ...
>
> My single stepping above assumes that tcs->cmd_cache[i] matches
> cmd[0].addr, i.e. we either found the start of the sequence we are
> looking for or another sequence that starts with the same address. My
> claim is that the code returns i in either case, whether the
> subsequent addresses match or not.
I haven't reviewed this patch in detail, but I attempted to be another
pair of eyes here. Something is definitely wrong with the "for (j =
0; j < len; j++)" loop. I believe the code that's written right now
is equivalent to this much shorter function:
+static int find_match(const struct tcs_group *tcs, const struct tcs_cmd *cmd,
+ int len)
+{
+ int i, j;
+
+ /* Check for already cached commands */
+ for_each_set_bit(i, tcs->slots, MAX_TCS_SLOTS) {
+ if (tcs->cmd_cache[i] == cmd[0].addr)
+ return i;
+ }
+
+ return -ENODATA;
+}
Specifically the test "if (tcs->cmd_cache[i] != cmd[0].addr)" does not
take "j" into account. Thus if it was false when "j == 0" it will
continue to be false for "j == 1", "j == 2", etc. Eventually you'll
hit the "else if (j == len - 1)" and return.
I believe that's what Matthias has been saying. I personally haven't
looked at the rest of the patch to see how things out to be fixed, but
I'm quite convinced that the function either has a bug or should be
written as the shorter version I've written above.
-Doug
next prev parent reply other threads:[~2018-04-27 23:24 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-19 22:16 [PATCH v6 00/10] drivers/qcom: add RPMH communication support Lina Iyer
2018-04-19 22:16 ` [PATCH v6 01/10] drivers: qcom: rpmh-rsc: add RPMH controller for QCOM SoCs Lina Iyer
2018-04-19 22:16 ` [PATCH v6 02/10] dt-bindings: introduce RPMH RSC bindings for Qualcomm SoCs Lina Iyer
2018-05-01 23:45 ` Doug Anderson
2018-05-02 14:56 ` Lina Iyer
2018-04-19 22:16 ` [PATCH v6 03/10] drivers: qcom: rpmh-rsc: log RPMH requests in FTRACE Lina Iyer
2018-04-19 22:16 ` [PATCH v6 04/10] drivers: qcom: rpmh: add RPMH helper functions Lina Iyer
2018-04-26 18:05 ` Matthias Kaehlcke
2018-04-27 16:55 ` Lina Iyer
2018-04-19 22:16 ` [PATCH v6 05/10] drivers: qcom: rpmh-rsc: write sleep/wake requests to TCS Lina Iyer
2018-04-25 21:41 ` Matthias Kaehlcke
2018-04-27 17:39 ` Lina Iyer
2018-04-27 18:40 ` Matthias Kaehlcke
2018-04-27 19:45 ` Lina Iyer
2018-04-27 20:06 ` Matthias Kaehlcke
2018-04-27 21:32 ` Lina Iyer
2018-04-27 21:54 ` Matthias Kaehlcke
2018-04-27 23:24 ` Doug Anderson [this message]
2018-05-01 16:10 ` Lina Iyer
2018-05-01 16:42 ` Doug Anderson
2018-05-01 17:35 ` Lina Iyer
2018-05-01 16:45 ` Matthias Kaehlcke
2018-04-19 22:16 ` [PATCH v6 06/10] drivers: qcom: rpmh-rsc: allow invalidation of sleep/wake TCS Lina Iyer
2018-04-25 22:11 ` Matthias Kaehlcke
2018-04-27 16:44 ` Lina Iyer
2018-04-27 16:54 ` Matthias Kaehlcke
2018-04-19 22:16 ` [PATCH v6 07/10] drivers: qcom: rpmh: cache sleep/wake state requests Lina Iyer
2018-04-19 22:16 ` [PATCH v6 08/10] drivers: qcom: rpmh: allow requests to be sent asynchronously Lina Iyer
2018-04-19 22:16 ` [PATCH v6 09/10] drivers: qcom: rpmh: add support for batch RPMH request Lina Iyer
2018-04-25 23:41 ` Matthias Kaehlcke
2018-04-27 16:24 ` Lina Iyer
2018-04-19 22:16 ` [PATCH v6 10/10] drivers: qcom: rpmh-rsc: allow active requests from wake TCS Lina Iyer
2018-04-26 1:14 ` Matthias Kaehlcke
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='CAD=FV=Wan0G_GG29Q-atBbQS+_7nnbqTndE+yyi_G=scOdGMFA@mail.gmail.com' \
--to=dianders@chromium.org \
--cc=andy.gross@linaro.org \
--cc=bjorn.andersson@linaro.org \
--cc=david.brown@linaro.org \
--cc=evgreen@chromium.org \
--cc=ilina@codeaurora.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-soc@vger.kernel.org \
--cc=mka@chromium.org \
--cc=rnayak@codeaurora.org \
--cc=sboyd@kernel.org \
--subject='Re: [PATCH v6 05/10] drivers: qcom: rpmh-rsc: write sleep/wake requests to TCS' \
/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
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).