From: Luben Tuikov <ltuikov89@gmail.com>
To: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>,
srini@kernel.org, linux-arm-msm@vger.kernel.org
Cc: gregkh@linuxfoundation.org, quic_bkumar@quicinc.com,
linux-kernel@vger.kernel.org, quic_chennak@quicinc.com,
dri-devel@lists.freedesktop.org, arnd@arndb.de,
dmitry.baryshkov@oss.qualcomm.com,
konrad.dybcio@oss.qualcomm.com, andersson@kernel.org
Subject: Re: [PATCH v8 4/4] misc: fastrpc: Add polling mode support for fastRPC driver
Date: Thu, 16 Apr 2026 23:54:17 -0400 [thread overview]
Message-ID: <4fd08215-c9f4-493f-ac49-141e9a486b02@gmail.com> (raw)
In-Reply-To: <90c2f6d5-21cd-4ba1-86e4-458100c8f830@oss.qualcomm.com>
[-- Attachment #1.1.1: Type: text/plain, Size: 3463 bytes --]
On 2026-04-16 09:58, Ekansh Gupta wrote:
> On 16-04-2026 13:47, Luben Tuikov wrote:
>> Hi Ekansh,
>>
>> Good work. A couple of notes below:
--cut--->>> +static inline int fastrpc_wait_for_response(struct fastrpc_invoke_ctx *ctx,
>>> + u32 kernel)
>>
>> What is "kernel" and why is it a u32 when it is used as a "bool"? Perhaps a better name can be had?
> This reflects kernel message. As of now, just propagated the same that
> is used across the driver, maybe can address this as a separate patch.
I can see that its origin is internal to the driver, as a boolean. Perhaps "kernel_message" or "kmessage" or something descriptive like that. I think it's more important that it is a "message", rather than "kernel message".
Yes, a separate patch indeed makes sense for this.
--cut--->>> +static int fastrpc_wait_for_completion(struct fastrpc_invoke_ctx *ctx,
>>> + u32 kernel)
>>> +{
>>> + int err;
>>> +
>>> + do {
>>> + if (ctx->is_polled) {
>>> + err = poll_for_remote_response(ctx);
>>> + /* If polling timed out, move to normal response mode */
>>> + if (err)
>>> + ctx->is_polled = false;
>>> + } else {
>>> + err = fastrpc_wait_for_response(ctx, kernel);
>>> + if (err)
>>> + return err;
>>> + }
>>> + } while (!ctx->is_work_done);
>>
>> Perhaps you want to also check "err" here to make the exit condition more explicit. (The invariant in do-while loops is generally directly determined by something within the loop and generally not implicit.)
> The reason to not keep "err" check is because the call should fallback
> to normal response(fastrpc_wait_for_response()) in case
> poll_for_remote_response() fails.
>>
>> Is it possible that in poll_for_remote_response() you get 0 as a poll result and val is not equal to FASTRCPC_POLL_RESPONSE? In such a case, this may hang. (Is a hang desired here?)
> That's actually a good point, let me try making it more robust, this
> condition might get encountered in case normal response is sent instead
> of poll memory update.
Right. We want to avoid this dependency. If the device hangs for whatever reason (defective device, cosmic ray, etc.) this should not result in a process or a kernel execution context hanging.
>> Is it possible that if polling is enabled, then you want to poll only once, and if unsuccessful, or successful but "!work_done", then transition to fastrpc_wait_for_response() and return, without looping? (since polling is looping after all...)
> This is correct, the intention is the poll until it returns, continue if
> successful and fallback to normal response if unsuccessful.
Right. So this was obvious by reading the contents of the do-while loop. If you prefer, you can remove the do-while loop, or at least take out the poll_for_remote_response() out, and only leave the fastrpc_wait_for_response() inside the loop, and decide how many time intervals you want to wait. If that is once, then you don't need the do-while loop. (Effectively, you've waited once in the poll and 2nd time in the fast_wait_for_response().)
We just want to avoid hangs.
> Thanks, Luben, for taking the time to review this change and for
> providing insightful comments.
Yes, no problem. Good work and thank you for your work and contribution!
> [1]
> https://lore.kernel.org/all/wipphezpxtuuxtwhpwamsmvhwgwuesexmy5ev5pcqb65vov5kz@vuzzyyqnu7ci/
Ah, thank you for this reference.
--
Regards,
Luben
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 677 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
next prev parent reply other threads:[~2026-04-17 3:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-15 11:25 [PATCH v8 0/4] misc: fastrpc: Add polling mode support Ekansh Gupta
2026-04-15 11:25 ` [PATCH v8 1/4] misc: fastrpc: Move fdlist to invoke context structure Ekansh Gupta
2026-04-15 11:25 ` [PATCH v8 2/4] misc: fastrpc: Replace hardcoded ctxid mask with GENMASK Ekansh Gupta
2026-04-15 11:25 ` [PATCH v8 3/4] misc: fastrpc: Expand context ID mask for DSP polling mode support Ekansh Gupta
2026-04-15 11:25 ` [PATCH v8 4/4] misc: fastrpc: Add polling mode support for fastRPC driver Ekansh Gupta
2026-04-16 8:17 ` Luben Tuikov
2026-04-16 13:58 ` Ekansh Gupta
2026-04-17 3:54 ` Luben Tuikov [this message]
2026-04-16 10:55 ` Dmitry Baryshkov
2026-04-16 14:02 ` Ekansh Gupta
2026-04-17 13:18 ` Dmitry Baryshkov
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=4fd08215-c9f4-493f-ac49-141e9a486b02@gmail.com \
--to=ltuikov89@gmail.com \
--cc=andersson@kernel.org \
--cc=arnd@arndb.de \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=ekansh.gupta@oss.qualcomm.com \
--cc=gregkh@linuxfoundation.org \
--cc=konrad.dybcio@oss.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_bkumar@quicinc.com \
--cc=quic_chennak@quicinc.com \
--cc=srini@kernel.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
all inboxes | Powered by JetHome®