Message ID | 20230627031217.1476-1-muhammad.husaini.zulkifli@intel.com |
---|---|
State | Changes Requested |
Delegated to: | Anthony Nguyen |
Headers | show |
Series | [iwl-net,v3] igc: Fix Kernel Panic during ndo_tx_timeout callback | expand |
On 6/26/2023 8:12 PM, Muhammad Husaini Zulkifli wrote: > The Xeon validation group has been carrying out some loaded tests > with various HW configurations, and they have seen some transmit > queue time out happening during the test. This will cause the > reset adapter function to be called by igc_tx_timeout(). > Similar race conditions may arise when the interface is being brought > down and up in igc_reinit_locked(), an interrupt being generated, and > igc_clean_tx_irq() being called to complete the TX. > > When the igc_tx_timeout() function is invoked, this patch will turn > off all TX ring HW queues during igc_down() process. TX ring HW queues > will be activated again during the igc_configure_tx_ring() process > when performing the igc_up() procedure later. > > This patch also moved existing igc_disable_tx_ring_hw() to avoid using > forward declaration. ... > Fixes: 9b275176270e ("igc: Add ndo_tx_timeout support") > Tested-by: Alejandra Victoria Alcaraz <alejandra.victoria.alcaraz@intel.com> > Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com> > Reported-by: kernel test robot <lkp@intel.com> > Closes: https://lore.kernel.org/oe-kbuild-all/202306230056.OGrsvyKV-lkp@intel.com/ Applied... with last two tags removed. Please note that this isn't to be included unless you are making a patch only to fix a reported issue. 'If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags...' https://lore.kernel.org/intel-wired-lan/202306230056.OGrsvyKV-lkp@intel.com/ > --- > V2 -> V3 : Fixed kernel test robot warning about missing prototype of "igc_disable_tx_ring_hw" > V1 -> V2 : Removed forward declaration function suggested by Vinicius
Dear Anthony, > -----Original Message----- > From: Nguyen, Anthony L <anthony.l.nguyen@intel.com> > Sent: Thursday, 29 June, 2023 1:47 AM > To: Zulkifli, Muhammad Husaini <muhammad.husaini.zulkifli@intel.com>; > intel-wired-lan@osuosl.org > Cc: Neftin, Sasha <sasha.neftin@intel.com>; Gomes, Vinicius > <vinicius.gomes@intel.com>; naamax.meir@linux.intel.com > Subject: Re: [PATCH iwl-net v3] igc: Fix Kernel Panic during ndo_tx_timeout > callback > > > > On 6/26/2023 8:12 PM, Muhammad Husaini Zulkifli wrote: > > The Xeon validation group has been carrying out some loaded tests with > > various HW configurations, and they have seen some transmit queue time > > out happening during the test. This will cause the reset adapter > > function to be called by igc_tx_timeout(). > > Similar race conditions may arise when the interface is being brought > > down and up in igc_reinit_locked(), an interrupt being generated, and > > igc_clean_tx_irq() being called to complete the TX. > > > > When the igc_tx_timeout() function is invoked, this patch will turn > > off all TX ring HW queues during igc_down() process. TX ring HW queues > > will be activated again during the igc_configure_tx_ring() process > > when performing the igc_up() procedure later. > > > > This patch also moved existing igc_disable_tx_ring_hw() to avoid using > > forward declaration. > > ... > > > Fixes: 9b275176270e ("igc: Add ndo_tx_timeout support") > > Tested-by: Alejandra Victoria Alcaraz > > <alejandra.victoria.alcaraz@intel.com> > > Signed-off-by: Muhammad Husaini Zulkifli > > <muhammad.husaini.zulkifli@intel.com> > > Reported-by: kernel test robot <lkp@intel.com> > > Closes: > > https://lore.kernel.org/oe-kbuild-all/202306230056.OGrsvyKV-lkp@intel. > > com/ > > Applied... with last two tags removed. Please note that this isn't to be > included unless you are making a patch only to fix a reported issue. Noted and thanks 😊 > 'If you fix the issue in a separate patch/commit (i.e. not just a new version of > the same patch/commit), kindly add following tags...' Oh , I see. I'll keep that in mind. Thanks for the information. > > https://lore.kernel.org/intel-wired-lan/202306230056.OGrsvyKV- > lkp@intel.com/ > > > --- > > V2 -> V3 : Fixed kernel test robot warning about missing prototype of > "igc_disable_tx_ring_hw" > > V1 -> V2 : Removed forward declaration function suggested by Vinicius
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index 1e6350c44380..3cb76da81b1d 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -316,6 +316,33 @@ static void igc_clean_all_tx_rings(struct igc_adapter *adapter) igc_clean_tx_ring(adapter->tx_ring[i]); } +static void igc_disable_tx_ring_hw(struct igc_ring *ring) +{ + struct igc_hw *hw = &ring->q_vector->adapter->hw; + u8 idx = ring->reg_idx; + u32 txdctl; + + txdctl = rd32(IGC_TXDCTL(idx)); + txdctl &= ~IGC_TXDCTL_QUEUE_ENABLE; + txdctl |= IGC_TXDCTL_SWFLUSH; + wr32(IGC_TXDCTL(idx), txdctl); +} + +/** + * igc_disable_all_tx_rings_hw - Disable all transmit queue operation + * @adapter: board private structure + */ +static void igc_disable_all_tx_rings_hw(struct igc_adapter *adapter) +{ + int i; + + for (i = 0; i < adapter->num_tx_queues; i++) { + struct igc_ring *tx_ring = adapter->tx_ring[i]; + + igc_disable_tx_ring_hw(tx_ring); + } +} + /** * igc_setup_tx_resources - allocate Tx resources (Descriptors) * @tx_ring: tx descriptor ring (for a specific queue) to setup @@ -5014,6 +5041,7 @@ void igc_down(struct igc_adapter *adapter) /* clear VLAN promisc flag so VFTA will be updated if necessary */ adapter->flags &= ~IGC_FLAG_VLAN_PROMISC; + igc_disable_all_tx_rings_hw(adapter); igc_clean_all_tx_rings(adapter); igc_clean_all_rx_rings(adapter); } @@ -7187,18 +7215,6 @@ void igc_enable_rx_ring(struct igc_ring *ring) igc_alloc_rx_buffers(ring, igc_desc_unused(ring)); } -static void igc_disable_tx_ring_hw(struct igc_ring *ring) -{ - struct igc_hw *hw = &ring->q_vector->adapter->hw; - u8 idx = ring->reg_idx; - u32 txdctl; - - txdctl = rd32(IGC_TXDCTL(idx)); - txdctl &= ~IGC_TXDCTL_QUEUE_ENABLE; - txdctl |= IGC_TXDCTL_SWFLUSH; - wr32(IGC_TXDCTL(idx), txdctl); -} - void igc_disable_tx_ring(struct igc_ring *ring) { igc_disable_tx_ring_hw(ring);