Re: [PATCH v8 4/4] misc: fastrpc: Add polling mode support for fastRPC driver

From: Dmitry Baryshkov

Date: Fri Apr 17 2026 - 09:18:53 EST


On Thu, Apr 16, 2026 at 07:32:43PM +0530, Ekansh Gupta wrote:
> On 16-04-2026 16:25, Dmitry Baryshkov wrote:
> > On Wed, Apr 15, 2026 at 04:55:30PM +0530, Ekansh Gupta wrote:
> >> For any remote call to DSP, after sending an invocation message,
> >> fastRPC driver waits for glink response and during this time the
> >> CPU can go into low power modes. This adds latency to overall fastrpc
> >> call as CPU wakeup and scheduling latencies are included. Add polling
> >> mode support with which fastRPC driver will poll continuously on a
> >> memory after sending a message to remote subsystem which will eliminate
> >> CPU wakeup and scheduling latencies and reduce fastRPC overhead. In case
> >> poll timeout happens, the call will fallback to normal RPC mode. Poll
> >> mode can be enabled by user by using FASTRPC_IOCTL_SET_OPTION ioctl
> >> request with FASTRPC_POLL_MODE request id.
> >>
> >> Signed-off-by: Ekansh Gupta <ekansh.gupta@xxxxxxxxxxxxxxxx>
> >> ---
> >> drivers/misc/fastrpc.c | 137 ++++++++++++++++++++++++++++++++++--
> >> include/uapi/misc/fastrpc.h | 25 +++++++
> >> 2 files changed, 155 insertions(+), 7 deletions(-)
> >>
> >> @@ -1813,6 +1908,30 @@ static int fastrpc_get_info_from_kernel(struct fastrpc_ioctl_capability *cap,
> >> return 0;
> >> }
> >>
> >> +static int fastrpc_set_option(struct fastrpc_user *fl, char __user *argp)
> >> +{
> >> + struct fastrpc_ioctl_set_option opt = {0};
> >> + int i;
> >> +
> >> + if (copy_from_user(&opt, argp, sizeof(opt)))
> >> + return -EFAULT;
> >> +
> >> + for (i = 0; i < ARRAY_SIZE(opt.reserved); i++) {
> >> + if (opt.reserved[i] != 0)
> >> + return -EINVAL;
> >> + }
> >> +
> >> + if (opt.request_id != FASTRPC_POLL_MODE)
> >> + return -EINVAL;
> >> +
> >> + if (opt.value)
> >> + fl->poll_mode = true;
> >
> > This will enable poll mode on the platforms where it is not supported,
> > later silinently changing back to the normal mode. Please don't surprise
> > users and make this call fail if polling mode is not supported.
> Ack. Working on adding compatible based checks for supporting platforms
> by reading the root compatible string, something like pdmapper[1].

SGTM

>
> [1]
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/soc/qcom/qcom_pd_mapper.c#n643
>
> Thanks,
> Ekansh
>
> >
> >> + else
> >> + fl->poll_mode = false;
> >> +
> >> + return 0;
> >> +}
> >> +
> >
>

--
With best wishes
Dmitry