mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Moreton <andy.moreton@amd.com>
To: Alex Austin <alex.austin@amd.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Richard Cochran <richardcochran@gmail.com>
Cc: netdev@vger.kernel.org, linux-net-drivers@amd.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] sfc: create PPS workqueue before registering phc
Date: Fri, 20 Nov 2026 11:50:28 +0000	[thread overview]
Message-ID: <f17bcfed-9b35-4f87-bf3b-c99fb823c0b5@amd.com> (raw)
In-Reply-To: <20261120-sfc_pps_wq_fix-v1-1-5837aeb14a4f@amd.com>

On 11/20/26 08:44, Alex Austin wrote:
> Registering the PHC before creating the PPS workqueue leaves a small
> window for PTP_CLK_REQ_PPS to be requested and a NIC generated PPS event
> to arrive before the workqueue exists. Create the PPS workqueue before
> registering the PHC.
> 
> Fixes: 7c236c43b838 ("sfc: Add support for IEEE-1588 PTP")
> Signed-off-by: Alex Austin <alex.austin@amd.com>
> ---
>  drivers/net/ethernet/sfc/ptp.c | 26 +++++++++++++-------------
>  1 file changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
> index 37511f234d76..ad6a4e7d990f 100644
> --- a/drivers/net/ethernet/sfc/ptp.c
> +++ b/drivers/net/ethernet/sfc/ptp.c
> @@ -1633,26 +1633,26 @@ int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel)
>  
>  	if (efx->mcdi->fn_flags &
>  	    (1 << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_PRIMARY)) {
> +		INIT_WORK(&ptp->pps_work, efx_ptp_pps_worker);
> +		ptp->pps_workwq = create_singlethread_workqueue("sfc_pps");
> +		if (!ptp->pps_workwq) {
> +			rc = -ENOMEM;
> +			goto fail3;
> +		}
> +
>  		ptp->phc_clock_info = efx_phc_clock_info;
>  		ptp->phc_clock = ptp_clock_register(&ptp->phc_clock_info,
>  						    &efx->pci_dev->dev);
>  		if (IS_ERR(ptp->phc_clock)) {
>  			rc = PTR_ERR(ptp->phc_clock);
> -			goto fail3;
> -		} else if (ptp->phc_clock) {
> -			INIT_WORK(&ptp->pps_work, efx_ptp_pps_worker);
> -			ptp->pps_workwq = create_singlethread_workqueue("sfc_pps");
> -			if (!ptp->pps_workwq) {
> -				rc = -ENOMEM;
> -				goto fail4;
> -			}
> +			goto fail4;
>  		}
>  	}
>  	ptp->nic_ts_enabled = false;
>  
>  	return 0;
>  fail4:
> -	ptp_clock_unregister(efx->ptp_data->phc_clock);
> +	destroy_workqueue(efx->ptp_data->pps_workwq);
>  
>  fail3:
>  	destroy_workqueue(efx->ptp_data->workwq);
> @@ -1702,16 +1702,16 @@ void efx_ptp_remove(struct efx_nic *efx)
>  
>  	cancel_work_sync(&efx->ptp_data->work);
>  	cancel_delayed_work_sync(&efx->ptp_data->cleanup_work);
> -	if (efx->ptp_data->pps_workwq)
> +	if (efx->ptp_data->pps_workwq) {
>  		cancel_work_sync(&efx->ptp_data->pps_work);
> +		destroy_workqueue(efx->ptp_data->pps_workwq);
> +	}
>  
>  	skb_queue_purge(&efx->ptp_data->rxq);
>  	skb_queue_purge(&efx->ptp_data->txq);
>  
> -	if (efx->ptp_data->phc_clock) {
> -		destroy_workqueue(efx->ptp_data->pps_workwq);
> +	if (efx->ptp_data->phc_clock)
>  		ptp_clock_unregister(efx->ptp_data->phc_clock);
> -	}
>  
>  	destroy_workqueue(efx->ptp_data->workwq);
>  
> 
> ---
> base-commit: 9068e05d35f3b02a802f520e664032f802bcd2e9
> change-id: 20261120-sfc_pps_wq_fix-2ed4ecc4c345
> 
> Best regards,
> --  
> Alex Austin <alex.austin@amd.com>
> 
Reviewed-by: Andy Moreton <andy.moreton@amd.com>

      parent reply	other threads:[~2026-11-20 11:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  8:44 Alex Austin
2026-11-20  8:47 ` netdev-bot+sinfo
2026-11-20  9:04   ` Austin, Alex (DCCG)
2026-11-20 11:50 ` Andy Moreton [this message]

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=f17bcfed-9b35-4f87-bf3b-c99fb823c0b5@amd.com \
    --to=andy.moreton@amd.com \
    --cc=alex.austin@amd.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-net-drivers@amd.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    /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®