From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: Alessio Igor Bogani <alessio.bogani@elettra.eu>,
<intel-wired-lan@lists.osuosl.org>
Subject: Re: [Intel-wired-lan] [PATCH] igb: Avoid starting unnecessary workqueues
Date: Fri, 21 Jul 2023 10:15:20 -0700 [thread overview]
Message-ID: <a4a27096-d231-631c-141f-6aee3b660cdc@intel.com> (raw)
In-Reply-To: <20230720145029.19674-1-alessio.bogani@elettra.eu>
On 7/20/2023 7:50 AM, Alessio Igor Bogani wrote:
Please designate a tree for your patch (net or net-next). As you have a
Fixes, I assume it's net, but please be explicit.
> if ptp_clock_register() fails or CONFIG_PTP isn't enabled avoid starting PTP related workqueues.
>
> In this way we can fix this:
> BUG: unable to handle page fault for address: ffffc9000440b6f8
> #PF: supervisor read access in kernel mode
> #PF: error_code(0x0000) - not-present page
> PGD 100000067 P4D 100000067 PUD 1001e0067 PMD 107dc5067 PTE 0
> Oops: 0000 [#1] PREEMPT SMP
> [...]
> Workqueue: events igb_ptp_overflow_check
> RIP: 0010:igb_rd32+0x1f/0x60
> [...]
> Call Trace:
> igb_ptp_read_82580+0x20/0x50
> timecounter_read+0x15/0x60
> igb_ptp_overflow_check+0x1a/0x50
> process_one_work+0x1cb/0x3c0
> worker_thread+0x53/0x3f0
> ? rescuer_thread+0x370/0x370
> kthread+0x142/0x160
> ? kthread_associate_blkcg+0xc0/0xc0
> ret_from_fork+0x1f/0x30
>
> Fixes: 1f6e8178d685 ("igb: Prevent dropped Tx timestamps via work items and interrupts.")
> Fixes: d339b1331616 ("igb: add PTP Hardware Clock code")
> Signed-off-by: Alessio Igor Bogani <alessio.bogani@elettra.eu>
> ---
> drivers/net/ethernet/intel/igb/igb_ptp.c | 24 ++++++++++++------------
> 1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
> index 6f471b91f562..8165232052c8 100644
> --- a/drivers/net/ethernet/intel/igb/igb_ptp.c
> +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
> @@ -1390,18 +1390,6 @@ void igb_ptp_init(struct igb_adapter *adapter)
> return;
> }
>
> - spin_lock_init(&adapter->tmreg_lock);
> - INIT_WORK(&adapter->ptp_tx_work, igb_ptp_tx_work);
> -
> - if (adapter->ptp_flags & IGB_PTP_OVERFLOW_CHECK)
> - INIT_DELAYED_WORK(&adapter->ptp_overflow_work,
> - igb_ptp_overflow_check);
> -
> - adapter->tstamp_config.rx_filter = HWTSTAMP_FILTER_NONE;
> - adapter->tstamp_config.tx_type = HWTSTAMP_TX_OFF;
> -
> - igb_ptp_reset(adapter);
> -
> adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps,
> &adapter->pdev->dev);
> if (IS_ERR(adapter->ptp_clock)) {
> @@ -1411,6 +1399,18 @@ void igb_ptp_init(struct igb_adapter *adapter)
> dev_info(&adapter->pdev->dev, "added PHC on %s\n",
> adapter->netdev->name);
> adapter->ptp_flags |= IGB_PTP_ENABLED;
> +
> + spin_lock_init(&adapter->tmreg_lock);
> + INIT_WORK(&adapter->ptp_tx_work, igb_ptp_tx_work);
> +
> + if (adapter->ptp_flags & IGB_PTP_OVERFLOW_CHECK)
> + INIT_DELAYED_WORK(&adapter->ptp_overflow_work,
> + igb_ptp_overflow_check);
> +
> + adapter->tstamp_config.rx_filter = HWTSTAMP_FILTER_NONE;
> + adapter->tstamp_config.tx_type = HWTSTAMP_TX_OFF;
> +
> + igb_ptp_reset(adapter);
This concerns me that the PTP clock will be registered before
initialization is complete/ready. I would prefer to see cleanup being
done for the error case; have everything setup for the register, but
remove the workqueues if we failed.
> }
> }
>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
next prev parent reply other threads:[~2023-07-21 17:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-18 13:45 [Intel-wired-lan] [PATCH] igb: Unconditionally deallocate workqueues as allocation already does Alessio Igor Bogani
2023-07-19 21:18 ` Tony Nguyen
2023-07-20 14:50 ` [Intel-wired-lan] [PATCH] igb: Avoid starting unnecessary workqueues Alessio Igor Bogani
2023-07-21 17:15 ` Tony Nguyen [this message]
2023-08-21 5:47 ` Arland, ArpanaX
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=a4a27096-d231-631c-141f-6aee3b660cdc@intel.com \
--to=anthony.l.nguyen@intel.com \
--cc=alessio.bogani@elettra.eu \
--cc=intel-wired-lan@lists.osuosl.org \
/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