From patchwork Sat May 5 15:10:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tee Hao Wei X-Patchwork-Id: 10382189 X-Patchwork-Delegate: luca@coelho.fi Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4A80360159 for ; Sat, 5 May 2018 15:10:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E65628F29 for ; Sat, 5 May 2018 15:10:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EC5C28F93; Sat, 5 May 2018 15:10:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FF2728F29 for ; Sat, 5 May 2018 15:10:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751218AbeEEPKr (ORCPT ); Sat, 5 May 2018 11:10:47 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:40722 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751086AbeEEPKq (ORCPT ); Sat, 5 May 2018 11:10:46 -0400 Received: by mail-pg0-f66.google.com with SMTP id l2-v6so17345492pgc.7 for ; Sat, 05 May 2018 08:10:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=in04.sg; s=google; h=to:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=GAi8z4yk1EbgEfQE/0Ek4GCUSPqdRDVm0K/dmKbNlRg=; b=KtD6TiIVmJIXcbtL+khf9trRlMHHeXuGSdNaXAoKmmM/xi/qrgiJXMPl/TAJPDbRRG Bqm4jx/fcIDcVQw/ElkQl2cZ+HqIudjbFrVtzN9BLLScSs1fP3iul+BiDJ517nY694I6 VNdVc8RPBROvkd/7YvYorDL32tcgeZSZ7ruBn8S4bn2oIle/DgmC124DqMfeTw/Xpylg zLz998HQnu162mxFTLdDiXTa8ZA4YADBZQc+qz26nfh5TtW8ADNkcsDGAbAcpCpUV8BH fnwoSOZbTqe5kqsToaBwlHMjb+wbd2vPIWN/Trn5JeLxDrmzDuBpHDhVsrn5AnzHLxPC JW2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=GAi8z4yk1EbgEfQE/0Ek4GCUSPqdRDVm0K/dmKbNlRg=; b=uO5cwNPuLeXrNyD9q6bZcOdj2uVNEL2+Vzd2p2R+tuMVygnSWwaRXP3MiI2n/yBCQ6 qX0AT6F7rimai5I9H31U9OLecxZmo+YaDXkv4hGhlJ0QaM3z2UBK+pv3334LPj91Zg+w 8lzLx1k+aBHdNrx++jmRHvbeEZ9cuWvfFE/UeKBaHGhkJgByOH+TW2mMkN2uHUNlgQtj IjZ5YFH6A+mchkBE6Hn61dL554uimFsC2orcvkekJMQvIBwrDAK7XJMy4XnXGE7cYx3y 5gphHeNRV98nrillWDOHyyCI17SaADMvO56jqSu79sfxoICIi9CNpqx/HtJsq4+gJNoy oX0Q== X-Gm-Message-State: ALQs6tDCvMVPcw1Cp3t0WbE12Cork0oKeifsX9XO5STAr0gBFv0fbY3y dkkXJPVAg3RHWOvLBJosUtk81E0XEFU= X-Google-Smtp-Source: AB8JxZrIkdSkC3oScL/Mww5EKy99EUzXkyEQTXVgR//BhQB7zuMqo2hREDZ8prDSk8Yq92COA8Mbug== X-Received: by 2002:a17:902:b609:: with SMTP id b9-v6mr31356487pls.29.1525533045248; Sat, 05 May 2018 08:10:45 -0700 (PDT) Received: from ?IPv6:2406:3003:2000:1e23:645d:763c:cc7c:3764? ([2406:3003:2000:1e23:645d:763c:cc7c:3764]) by smtp.gmail.com with ESMTPSA id p71sm41259737pfl.170.2018.05.05.08.10.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 05 May 2018 08:10:44 -0700 (PDT) To: johannes.berg@intel.com, emmanuel.grumbach@intel.com, luciano.coelho@intel.com, linuxwifi@intel.com, linux-wireless@vger.kernel.org From: Hao Wei Tee Subject: [PATCH] iwlwifi: limit MSI-X IRQs to IWL_MAX_RX_HW_QUEUES - 1 to avoid num_rx_queues > IWL_MAX_RX_HW_QUEUES Message-ID: Date: Sat, 5 May 2018 23:10:41 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 Content-Language: en-US Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When there are 16 or more logical CPUs, we request for `IWL_MAX_RX_HW_QUEUES` (16) IRQs only, but later on create `num_irqs+1` RX queues, which could end up more than `IWL_MAX_RX_HW_QUEUES` if the OS does return us 16 IRQs. This wreaks lots of havoc elsewhere later on due to code that uses `num_rx_queues` to calculate array sizes. Limit to IWL_MAX_RX_HW_QUEUES - 1 IRQs so num_rx_queues is never more than IWL_MAX_RX_HW_QUEUES. --- drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c index 6e9a9ecfb11c..f5c12924c836 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c @@ -1607,7 +1607,7 @@ static void iwl_pcie_set_interrupt_capa(struct pci_dev *pdev, goto enable_msi; nr_online_cpus = num_online_cpus(); - max_irqs = min_t(u32, nr_online_cpus + 2, IWL_MAX_RX_HW_QUEUES); + max_irqs = min_t(u32, nr_online_cpus + 2, IWL_MAX_RX_HW_QUEUES - 1); for (i = 0; i < max_irqs; i++) trans_pcie->msix_entries[i].entry = i;