[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1f03f358-3c52-8bff-f251-1e4177488cfb@amd.com>
Date:   Mon, 10 Apr 2023 12:12:48 -0700
From:   Shannon Nelson <shannon.nelson@....com>
To:     Leon Romanovsky <leon@...nel.org>
Cc:     brett.creeley@....com, davem@...emloft.net, netdev@...r.kernel.org,
        kuba@...nel.org, drivers@...sando.io, jiri@...nulli.us
Subject: Re: [PATCH v9 net-next 03/14] pds_core: health timer and workqueue
On 4/9/23 4:51 AM, Leon Romanovsky wrote:
> 
> On Thu, Apr 06, 2023 at 04:41:32PM -0700, Shannon Nelson wrote:
>> Add in the periodic health check and the related workqueue,
>> as well as the handlers for when a FW reset is seen.
>>
>> The firmware is polled every 5 seconds to be sure that it is
>> still alive and that the FW generation didn't change.
>>
>> The alive check looks to see that the PCI bus is still readable
>> and the fw_status still has the RUNNING bit on.  If not alive,
>> the driver stops activity and tears things down.  When the FW
>> recovers and the alive check again succeeds, the driver sets
>> back up for activity.
>>
>> The generation check looks at the fw_generation to see if it
>> has changed, which can happen if the FW crashed and recovered
>> or was updated in between health checks.  If changed, the
>> driver counts that as though the alive test failed and forces
>> the fw_down/fw_up cycle.
>>
>> Signed-off-by: Shannon Nelson <shannon.nelson@....com>
>> ---
>>   drivers/net/ethernet/amd/pds_core/core.c | 61 ++++++++++++++++++++++++
>>   drivers/net/ethernet/amd/pds_core/core.h |  8 ++++
>>   drivers/net/ethernet/amd/pds_core/dev.c  |  3 ++
>>   drivers/net/ethernet/amd/pds_core/main.c | 37 ++++++++++++++
>>   4 files changed, 109 insertions(+)
> 
> <...>
> 
>>
>>   err_out_unmap_bars:
>>        mutex_unlock(&pdsc->config_lock);
>> +     del_timer_sync(&pdsc->wdtimer);
>> +     if (pdsc->wq) {
>> +             flush_workqueue(pdsc->wq);
>> +             destroy_workqueue(pdsc->wq);
> 
> There is no need to call to flush_workqueue() as destroy_workqueue()
> will do it.
will fix
> 
>> +             pdsc->wq = NULL;
>> +     }
>>        mutex_destroy(&pdsc->config_lock);
>>        mutex_destroy(&pdsc->devcmd_lock);
>>        pci_free_irq_vectors(pdsc->pdev);
>> @@ -270,6 +300,13 @@ static void pdsc_remove(struct pci_dev *pdev)
>>        devl_unlock(dl);
>>
>>        if (!pdev->is_virtfn) {
>> +             del_timer_sync(&pdsc->wdtimer);
>> +             if (pdsc->wq) {
>> +                     flush_workqueue(pdsc->wq);
>> +                     destroy_workqueue(pdsc->wq);
> 
> Same
> 
>> +                     pdsc->wq = NULL;
> 
> Not really needed, pdsc is released.
will fix
> 
>> +             }
>> +
>>                mutex_lock(&pdsc->config_lock);
>>                set_bit(PDSC_S_STOPPING_DRIVER, &pdsc->state);
>>
>> --
>> 2.17.1
>>
Powered by blists - more mailing lists