Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1233495
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 4.1 007/159] igb: Fix oops caused by missing queue pairing |
| Date | 2015-09-27 00:00 +0200 |
| Message-ID | <qd5FF-445-27@gated-at.bofh.it> (permalink) |
| References | <qd4Tf-384-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shota Suzuki <suzuki_shota_t3@lab.ntt.co.jp>
commit 72ddef0506da852dc82f078f37ced8ef4d74a2bf upstream.
When initializing igb driver (e.g. 82576, I350), IGB_FLAG_QUEUE_PAIRS is
set if adapter->rss_queues exceeds half of max_rss_queues in
igb_init_queue_configuration().
On the other hand, IGB_FLAG_QUEUE_PAIRS is not set even if the number of
queues exceeds half of max_combined in igb_set_channels() when changing
the number of queues by "ethtool -L".
In this case, if numvecs is larger than MAX_MSIX_ENTRIES (10), the size
of adapter->msix_entries[], an overflow can occur in
igb_set_interrupt_capability(), which in turn leads to an oops.
Fix this problem as follows:
- When changing the number of queues by "ethtool -L", set
IGB_FLAG_QUEUE_PAIRS in the same way as initializing igb driver.
- When increasing the size of q_vector, reallocate it appropriately.
(With IGB_FLAG_QUEUE_PAIRS set, the size of q_vector gets larger.)
Another possible way to fix this problem is to cap the queues at its
initial number, which is the number of the initial online cpus. But this
is not the optimal way because we cannot increase queues when another
cpu becomes online.
Note that before commit cd14ef54d25b ("igb: Change to use statically
allocated array for MSIx entries"), this problem did not cause oops
but just made the number of queues become 1 because of entering msi_only
mode in igb_set_interrupt_capability().
Fixes: 907b7835799f ("igb: Add ethtool support to configure number of channels")
Signed-off-by: Shota Suzuki <suzuki_shota_t3@lab.ntt.co.jp>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/ethernet/intel/igb/igb.h | 1 +
drivers/net/ethernet/intel/igb/igb_ethtool.c | 5 ++++-
drivers/net/ethernet/intel/igb/igb_main.c | 16 ++++++++++++++--
3 files changed, 19 insertions(+), 3 deletions(-)
--- a/drivers/net/ethernet/intel/igb/igb.h
+++ b/drivers/net/ethernet/intel/igb/igb.h
@@ -540,6 +540,7 @@ void igb_ptp_rx_pktstamp(struct igb_q_ve
struct sk_buff *skb);
int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr);
int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr);
+void igb_set_flag_queue_pairs(struct igb_adapter *, const u32);
#ifdef CONFIG_IGB_HWMON
void igb_sysfs_exit(struct igb_adapter *adapter);
int igb_sysfs_init(struct igb_adapter *adapter);
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -2991,6 +2991,7 @@ static int igb_set_channels(struct net_d
{
struct igb_adapter *adapter = netdev_priv(netdev);
unsigned int count = ch->combined_count;
+ unsigned int max_combined = 0;
/* Verify they are not requesting separate vectors */
if (!count || ch->rx_count || ch->tx_count)
@@ -3001,11 +3002,13 @@ static int igb_set_channels(struct net_d
return -EINVAL;
/* Verify the number of channels doesn't exceed hw limits */
- if (count > igb_max_channels(adapter))
+ max_combined = igb_max_channels(adapter);
+ if (count > max_combined)
return -EINVAL;
if (count != adapter->rss_queues) {
adapter->rss_queues = count;
+ igb_set_flag_queue_pairs(adapter, max_combined);
/* Hardware has to reinitialize queues and interrupts to
* match the new configuration.
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -1205,10 +1205,14 @@ static int igb_alloc_q_vector(struct igb
/* allocate q_vector and rings */
q_vector = adapter->q_vector[v_idx];
- if (!q_vector)
+ if (!q_vector) {
q_vector = kzalloc(size, GFP_KERNEL);
- else
+ } else if (size > ksize(q_vector)) {
+ kfree_rcu(q_vector, rcu);
+ q_vector = kzalloc(size, GFP_KERNEL);
+ } else {
memset(q_vector, 0, size);
+ }
if (!q_vector)
return -ENOMEM;
@@ -2901,6 +2905,14 @@ static void igb_init_queue_configuration
adapter->rss_queues = min_t(u32, max_rss_queues, num_online_cpus());
+ igb_set_flag_queue_pairs(adapter, max_rss_queues);
+}
+
+void igb_set_flag_queue_pairs(struct igb_adapter *adapter,
+ const u32 max_rss_queues)
+{
+ struct e1000_hw *hw = &adapter->hw;
+
/* Determine if we need to pair queues. */
switch (hw->mac.type) {
case e1000_82575:
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 4.1 000/159] 4.1.9-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 087/159] md/raid10: always set reshape_safe when initializing reshape_position. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 090/159] iommu/io-pgtable-arm: Unmap and free table when overwriting with block Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 042/159] powerpc/mm: Recompute hash value after a failed update Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 040/159] crypto: vmx - Adding enable_kernel_vsx() to access VSX instructions Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 044/159] Add radeon suspend/resume quirk for HP Compaq dc5750. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 078/159] parisc: Filter out spurious interrupts in PA-RISC irq handler Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 037/159] powerpc/mm: Fix pte_pagesize_index() crash on 4K w/64K hash Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 062/159] NFS41/flexfiles: update inode after write finishes Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 038/159] powerpc/rtas: Introduce rtas_get_sensor_fast() for IRQ handlers Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 021/159] arm64: head.S: initialise mdcr_el2 in el2_setup Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 015/159] Revert "ext4: remove block_device_ejected" Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 066/159] NFSv4.1: Fix a protocol issue with CLOSE stateids Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 031/159] ALSA: hda - Add some FIXUP quirks for white noise on Dell laptop. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 029/159] ALSA: hda - Enable headphone jack detect on old Fujitsu laptops Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 065/159] NFSv4.1/flexfiles: Fix a protocol error in layoutreturn Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 020/159] arm64: compat: fix vfp save/restore across signal handlers in big-endian Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 064/159] NFS41/flexfiles: zero out DS write wcc Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 039/159] powerpc: Uncomment and make enable_kernel_vsx() routine available Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 067/159] Revert "NFSv4: Remove incorrect check in can_open_delegated()" Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 035/159] powerpc/eeh: Probe after unbalanced kref check Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 030/159] ALSA: hda - Use ALC880_FIXUP_FUJITSU for FSC Amilo M1437 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 089/159] iommu/fsl: Really fix init section(s) content Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 041/159] powerpc/boot: Specify ABI v2 when building an LE boot wrapper Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 012/159] cxl: Remove racy attempt to force EEH invocation in reset Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 063/159] NFSv4: Force a post-op attribute update when holding a delegation Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 036/159] powerpc/eeh: Fix fenced PHB caused by eeh_slot_error_detail() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:50 +0200
[PATCH 4.1 011/159] mac80211: enable assoc check for mesh interfaces Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-27 00:00 +0200
[PATCH 4.1 005/159] rtlwifi: rtl8192cu: Add new device ID Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-27 00:00 +0200
[PATCH 4.1 013/159] cxl: Fix unbalanced pci_dev_get in cxl_probe Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-27 00:00 +0200
[PATCH 4.1 008/159] tg3: Fix temperature reporting Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-27 00:00 +0200
[PATCH 4.1 010/159] MIPS: math-emu: Emulate missing BC1{EQ,NE}Z instructions Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-27 00:00 +0200
[PATCH 4.1 007/159] igb: Fix oops caused by missing queue pairing Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-27 00:00 +0200
[PATCH 4.1 001/159] NFC: st21nfca: fix use of uninitialized variables in error path Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-27 00:00 +0200
[PATCH 4.1 018/159] of/fdt: make memblock maximum physical address arch configurable Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-27 00:00 +0200
[PATCH 4.1 014/159] ext4: dont manipulate recovery flag when freezing no-journal fs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-27 00:00 +0200
[PATCH 4.1 006/159] rtlwifi: rtl8821ae: Fix an expression that is always false Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-27 00:00 +0200
[PATCH 4.1 004/159] unshare: Unsharing a thread does not require unsharing a vm Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-27 00:00 +0200
[PATCH 4.1 017/159] arm64: flush FP/SIMD state correctly after execve() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-27 00:00 +0200
[PATCH 4.1 003/159] blk-mq: fix buffer overflow when reading sysfs file of pending Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-27 00:00 +0200
[PATCH 4.1 002/159] nfc: nci: hci: Add check on skb nci_hci_send_cmd parameter Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-27 00:00 +0200
Re: [PATCH 4.1 000/159] 4.1.9-stable review (build error) Guenter Roeck <linux@roeck-us.net> - 2015-09-27 02:40 +0200
[PATCH] cxl: Don't remove AFUs/vPHBs in cxl_reset Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-27 08:50 +0200
Re: [PATCH] cxl: Don't remove AFUs/vPHBs in cxl_reset Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-27 17:40 +0200
Re: [PATCH] cxl: Don't remove AFUs/vPHBs in cxl_reset Daniel Axtens <dja@axtens.net> - 2015-09-29 07:30 +0200
Re: [PATCH 4.1 000/159] 4.1.9-stable review Guenter Roeck <linux@roeck-us.net> - 2015-09-27 21:20 +0200
Re: [PATCH 4.1 000/159] 4.1.9-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-27 21:40 +0200
Re: [PATCH 4.1 000/159] 4.1.9-stable review Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-28 07:10 +0200
Re: [PATCH 4.1 000/159] 4.1.9-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-28 16:30 +0200
Re: [PATCH 4.1 000/159] 4.1.9-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2015-09-28 19:40 +0200
Re: [PATCH 4.1 000/159] 4.1.9-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-28 23:40 +0200
Re: [PATCH 4.1 000/159] 4.1.9-stable review "Andre Tomt (LKML)" <lkml@tomt.net> - 2015-09-29 03:00 +0200
csiph-web