Skip to content

Commit ca2fe89

Browse files
aboganiFishwaldo
authored andcommitted
igb: Avoid starting unnecessary workqueues
[ Upstream commit b888c51 ] 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: 1f6e817 ("igb: Prevent dropped Tx timestamps via work items and interrupts.") Fixes: d339b13 ("igb: add PTP Hardware Clock code") Signed-off-by: Alessio Igor Bogani <alessio.bogani@elettra.eu> Tested-by: Arpana Arland <arpanax.arland@intel.com> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://lore.kernel.org/r/20230821171927.2203644-1-anthony.l.nguyen@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 5f38482 commit ca2fe89

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

drivers/net/ethernet/intel/igb/igb_ptp.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,18 +1260,6 @@ void igb_ptp_init(struct igb_adapter *adapter)
12601260
return;
12611261
}
12621262

1263-
spin_lock_init(&adapter->tmreg_lock);
1264-
INIT_WORK(&adapter->ptp_tx_work, igb_ptp_tx_work);
1265-
1266-
if (adapter->ptp_flags & IGB_PTP_OVERFLOW_CHECK)
1267-
INIT_DELAYED_WORK(&adapter->ptp_overflow_work,
1268-
igb_ptp_overflow_check);
1269-
1270-
adapter->tstamp_config.rx_filter = HWTSTAMP_FILTER_NONE;
1271-
adapter->tstamp_config.tx_type = HWTSTAMP_TX_OFF;
1272-
1273-
igb_ptp_reset(adapter);
1274-
12751263
adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps,
12761264
&adapter->pdev->dev);
12771265
if (IS_ERR(adapter->ptp_clock)) {
@@ -1281,6 +1269,18 @@ void igb_ptp_init(struct igb_adapter *adapter)
12811269
dev_info(&adapter->pdev->dev, "added PHC on %s\n",
12821270
adapter->netdev->name);
12831271
adapter->ptp_flags |= IGB_PTP_ENABLED;
1272+
1273+
spin_lock_init(&adapter->tmreg_lock);
1274+
INIT_WORK(&adapter->ptp_tx_work, igb_ptp_tx_work);
1275+
1276+
if (adapter->ptp_flags & IGB_PTP_OVERFLOW_CHECK)
1277+
INIT_DELAYED_WORK(&adapter->ptp_overflow_work,
1278+
igb_ptp_overflow_check);
1279+
1280+
adapter->tstamp_config.rx_filter = HWTSTAMP_FILTER_NONE;
1281+
adapter->tstamp_config.tx_type = HWTSTAMP_TX_OFF;
1282+
1283+
igb_ptp_reset(adapter);
12841284
}
12851285
}
12861286

0 commit comments

Comments
 (0)