Subject: Re: [PATCH net-next 2/2] net: wwan: t7xx: Add NAPI support

From: "Kancharla, Sreehari" <[email-masked]>
Date: Thu, 20 Oct 2022 19:52:26 +0530

Hi Andy,

On 10/10/2022 8:51 PM, Andy Shevchenko wrote:
> On Mon, Oct 10, 2022 at 07:52:49PM +0530, Kancharla, Sreehari wrote:
>> On 9/12/2022 6:23 PM, Loic Poulain wrote:
>>> On Fri, 9 Sept 2022 at 18:40, Sreehari Kancharla
>>> <[email-masked]> wrote:
> ...
>
>>>>           if (!rxq->que_started) {
>>>>                   atomic_set(&rxq->rx_processing, 0);
>>>> -               dev_err(dpmaif_ctrl->dev, "Work RXQ: %d has not been started\n", rxq->index);
>>>> -               return;
>>>> +               dev_err(rxq->dpmaif_ctrl->dev, "Work RXQ: %d has not been started\n", rxq->index);
>>>> +               return work_done;
>>>>           }
>>>>
>>>> -       ret = pm_runtime_resume_and_get(dpmaif_ctrl->dev);
>>>> -       if (ret < 0 && ret != -EACCES)
>>>> -               return;
>>>> +       if (!rxq->sleep_lock_pending) {
>>>> +               ret = pm_runtime_resume_and_get(rxq->dpmaif_ctrl->dev);
>>> AFAIK, polling is not called in a context allowing you to sleep (e.g.
>>> performing a synced pm runtime operation).
>> Device will be in resumed state when NAPI poll is invoked from IRQ context,
>> but host/driver can trigger RPM suspend to device. so we are using pm_runtime_resume_and_get
>> here to prevent runtime suspend.
> If it's known that device is always in power on state here, there is no need to
> call all this, but what you need is to bump the reference counter. Perhaps you
> need pm_runtime_get_noresume(). I.o.w. find the proper one and check that is
> not sleeping.

Agree, incrementing the reference counter will be sufficient. we will replace
pm_runtime_resume_and_get with pm_runtime_get_noresume in v2 submission.

Regards,
Sreehari