From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759914AbbJ3Rbk (ORCPT ); Fri, 30 Oct 2015 13:31:40 -0400 Received: from mx2.suse.de ([195.135.220.15]:56862 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758017AbbJ3Rbi (ORCPT ); Fri, 30 Oct 2015 13:31:38 -0400 From: Benjamin Poirier To: Jeff Kirsher Cc: Alexander Duyck , Frank Steiner , Jesse Brandeburg , Shannon Nelson , Carolyn Wyborny , Don Skidmore , Matthew Vick , John Ronciak , Mitch Williams , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/4] e1000e msi-x fixes Date: Fri, 30 Oct 2015 10:31:00 -0700 Message-Id: <1446226264-29660-1-git-send-email-bpoirier@suse.com> X-Mailer: git-send-email 2.6.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, For this series: Benjamin Poirier (4): e1000e: Remove unreachable code e1000e: Do not read icr in Other interrupt e1000e: Do not write lsc to ics in msi-x mode e1000e: Fix msi-x interrupt automask drivers/net/ethernet/intel/e1000e/defines.h | 3 +- drivers/net/ethernet/intel/e1000e/netdev.c | 65 +++++++++++++---------------- 2 files changed, 30 insertions(+), 38 deletions(-) Changes in v2: Address review comments from Alexander Duyck: extend cleanup of Other interrupt handler and use tx_ring->ims_val. The first three patches cleanup handling of Other interrupts and the last patch fixes tx and rx interrupts. Please consider reading the description for that patch before proceeding. I believe that the following simple tracing statements are helpful in detecting the problem fixed by the last patch. diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 8881256..707a525 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -1952,6 +1952,9 @@ static irqreturn_t e1000_intr_msix_rx(int __always_unused irq, void *data) struct net_device *netdev = data; struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_ring *rx_ring = adapter->rx_ring; + struct e1000_hw *hw = &adapter->hw; + + trace_printk("%s: rxq0 irq ims 0x%08x\n", netdev->name, er32(IMS)); /* Write the ITR value calculated at the end of the * previous interrupt. @@ -1966,6 +1969,7 @@ static irqreturn_t e1000_intr_msix_rx(int __always_unused irq, void *data) adapter->total_rx_bytes = 0; adapter->total_rx_packets = 0; __napi_schedule(&adapter->napi); + trace_printk("%s: scheduling napi\n", netdev->name); } return IRQ_HANDLED; } @@ -2672,6 +2676,8 @@ static int e1000e_poll(struct napi_struct *napi, int weight) struct net_device *poll_dev = adapter->netdev; int tx_cleaned = 1, work_done = 0; + trace_printk("%s: poll starting ims 0x%08x\n", poll_dev->name, + er32(IMS)); adapter = netdev_priv(poll_dev); if (!adapter->msix_entries || @@ -2689,6 +2695,8 @@ static int e1000e_poll(struct napi_struct *napi, int weight) e1000_set_itr(adapter); napi_complete_done(napi, work_done); if (!test_bit(__E1000_DOWN, &adapter->state)) { + trace_printk("%s: will enable rxq0 irq\n", + poll_dev->name); if (adapter->msix_entries) ew32(IMS, adapter->rx_ring->ims_val); else -------- 8< -------- With that patch but without the patches in this series we can see that rx irqs occur at unexpected times: -0 [000] .Ns. 1986.887517: e1000e_poll: eth1: will enable rxq0 irq -0 [000] d.h. 1986.896654: e1000_intr_msix_rx: eth1: rxq0 irq ims 0x01500004 -0 [000] d.h. 1986.896657: e1000_intr_msix_rx: eth1: scheduling napi -0 [000] d.H. 1986.896662: e1000_intr_msix_rx: eth1: rxq0 irq ims 0x01500004 -0 [000] ..s. 1986.896667: e1000e_poll: eth1: poll starting ims 0x01500004 Warning: many interrupts (2) before napi -0 [000] ..s. 1986.896685: e1000e_poll: eth1: will enable rxq0 irq -0 [000] d.h. 1990.688870: e1000_intr_msix_rx: eth1: scheduling napi -0 [000] ..s. 1990.688875: e1000e_poll: eth1: poll starting ims 0x01500004 -0 [000] dNH. 1990.688913: e1000_intr_msix_rx: eth1: rxq0 irq ims 0x01500004 Warning: interrupt inside napi -0 [000] .Ns. 1990.688916: e1000e_poll: eth1: will enable rxq0 irq -0 [000] d.h. 1990.729688: e1000_intr_msix_rx: eth1: rxq0 irq ims 0x01500004 Here's a typical sequence after applying the patches in this series. Notice that ims is changed. Another printk at the end of e1000e_poll would show it to be 0x01500000. -0 [000] d.h. 672874.016104: e1000_intr_msix_rx: eth1: rxq0 irq ims 0x01400000 -0 [000] d.h. 672874.016107: e1000_intr_msix_rx: eth1: scheduling napi -0 [000] ..s. 672874.016112: e1000e_poll: eth1: poll starting ims 0x01400000 -0 [000] ..s. 672874.016126: e1000e_poll: eth1: will enable rxq0 irq Finally, here's the script I used to generate the warnings above: #!/usr/bin/python3 import sys import re import pprint class NaE(Exception): "Not an Event" pass class Event: def __init__(self, line): # sample events: # -0 [000] d.h. 2025.256536: e1000_intr_msix_rx: eth1: rxq0 irq ims 0x01500004 # -0 [000] d.h. 2025.256539: e1000_intr_msix_rx: eth1: scheduling napi # -0 [000] ..s. 2025.256544: e1000e_poll: eth1: poll starting ims 0x01500004 # -0 [000] ..s. 2025.256558: e1000e_poll: eth1: will enable rxq0 irq retval = re.match(" +.*)>?-(?P[0-9]+) +\[(?P.*)\] (?P[^ ]+) +(?P