Skip to content

Commit 763b009

Browse files
aboganiUlrich Hecht
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 <[email protected]> Tested-by: Arpana Arland <[email protected]> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Sasha Levin <[email protected]> [uli: backport to 4.4] Signed-off-by: Ulrich Hecht <[email protected]>
1 parent 0230f87 commit 763b009

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

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

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,34 +1089,6 @@ void igb_ptp_init(struct igb_adapter *adapter)
10891089

10901090
wrfl();
10911091

1092-
spin_lock_init(&adapter->tmreg_lock);
1093-
INIT_WORK(&adapter->ptp_tx_work, igb_ptp_tx_work);
1094-
1095-
/* Initialize the clock and overflow work for devices that need it. */
1096-
if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211)) {
1097-
struct timespec64 ts = ktime_to_timespec64(ktime_get_real());
1098-
1099-
igb_ptp_settime_i210(&adapter->ptp_caps, &ts);
1100-
} else {
1101-
timecounter_init(&adapter->tc, &adapter->cc,
1102-
ktime_to_ns(ktime_get_real()));
1103-
1104-
INIT_DELAYED_WORK(&adapter->ptp_overflow_work,
1105-
igb_ptp_overflow_check);
1106-
1107-
schedule_delayed_work(&adapter->ptp_overflow_work,
1108-
IGB_SYSTIM_OVERFLOW_PERIOD);
1109-
}
1110-
1111-
/* Initialize the time sync interrupts for devices that support it. */
1112-
if (hw->mac.type >= e1000_82580) {
1113-
wr32(E1000_TSIM, TSYNC_INTERRUPTS);
1114-
wr32(E1000_IMS, E1000_IMS_TS);
1115-
}
1116-
1117-
adapter->tstamp_config.rx_filter = HWTSTAMP_FILTER_NONE;
1118-
adapter->tstamp_config.tx_type = HWTSTAMP_TX_OFF;
1119-
11201092
adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps,
11211093
&adapter->pdev->dev);
11221094
if (IS_ERR(adapter->ptp_clock)) {
@@ -1126,6 +1098,34 @@ void igb_ptp_init(struct igb_adapter *adapter)
11261098
dev_info(&adapter->pdev->dev, "added PHC on %s\n",
11271099
adapter->netdev->name);
11281100
adapter->flags |= IGB_FLAG_PTP;
1101+
1102+
spin_lock_init(&adapter->tmreg_lock);
1103+
INIT_WORK(&adapter->ptp_tx_work, igb_ptp_tx_work);
1104+
1105+
/* Initialize the clock and overflow work for devices that need it. */
1106+
if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211)) {
1107+
struct timespec64 ts = ktime_to_timespec64(ktime_get_real());
1108+
1109+
igb_ptp_settime_i210(&adapter->ptp_caps, &ts);
1110+
} else {
1111+
timecounter_init(&adapter->tc, &adapter->cc,
1112+
ktime_to_ns(ktime_get_real()));
1113+
1114+
INIT_DELAYED_WORK(&adapter->ptp_overflow_work,
1115+
igb_ptp_overflow_check);
1116+
1117+
schedule_delayed_work(&adapter->ptp_overflow_work,
1118+
IGB_SYSTIM_OVERFLOW_PERIOD);
1119+
}
1120+
1121+
/* Initialize the time sync interrupts for devices that support it. */
1122+
if (hw->mac.type >= e1000_82580) {
1123+
wr32(E1000_TSIM, TSYNC_INTERRUPTS);
1124+
wr32(E1000_IMS, E1000_IMS_TS);
1125+
}
1126+
1127+
adapter->tstamp_config.rx_filter = HWTSTAMP_FILTER_NONE;
1128+
adapter->tstamp_config.tx_type = HWTSTAMP_TX_OFF;
11291129
}
11301130
}
11311131

0 commit comments

Comments
 (0)