lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230409115110.GB182481@unreal>
Date:   Sun, 9 Apr 2023 14:51:10 +0300
From:   Leon Romanovsky <leon@...nel.org>
To:     Shannon Nelson <shannon.nelson@....com>
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 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.

> +		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.

> +		}
> +
>  		mutex_lock(&pdsc->config_lock);
>  		set_bit(PDSC_S_STOPPING_DRIVER, &pdsc->state);
>  
> -- 
> 2.17.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ