Received: by 10.192.165.148 with SMTP id m20csp1786149imm; Thu, 26 Apr 2018 02:10:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+AdHZkAEpUsTyUSdKMBsEskLlHZsc+kBtAZNCsThGbM52B3Q9RP9qrhHwor30DBUTGQs4S X-Received: by 10.98.77.2 with SMTP id a2mr31468350pfb.213.1524733813350; Thu, 26 Apr 2018 02:10:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524733813; cv=none; d=google.com; s=arc-20160816; b=jjY4OH8U8uK5vc67HT9C7LV65FcTG3tKwmgSyAZwNbpt6Iu06VhxYFEK3v5U5PJYi8 0IfB9tQqJAfbq5Mne22gF3Dxa2TVgbycAdtyt+SztMc87ohQHxdnH7jhuHi3To3AzMn/ GdqUQZ7pqvqq52DWI1SsDuJivv2Xz/2Fqbz8EeZAI3Hwp3pvO6Ag4a0oEG6JjCqccEHM xhXD/MnRBBkAj3csx7EYyIVxRanmxIdo96VZMBTVjCle8hmVoIjrqv6oyw9SYKhdNNuF vW3aVU9xnCweHgTFafhEspHbeHMfmXdxAR4JFWl7r/W2Bix5Mryav1efijyLa01K4HRJ nxBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=z+iVUNaxrTnads83Ic4F8Mw516hKbuMc1I7VuDhJIL4=; b=XVAXcHbAANRXVSqWUTMrRj2WSD3nH7u8EZy1egWgUodYvn3nHba6GpT0IkWdFM2EFv IG+2ZHTlPQNspKlqY8vG5CYzImKnc/0MkiYM+dFddMkbqw4sFOP4Tq0FjdUHl7PaoEUV QNTPpS1p05CLY2oulrFixOfJqFGbLTq6ABgvEGtIJGfEf3MxW0vYmwtIsiNKCtk24x67 +tKjBmP46hAdTJdZCsZ5JzDmO5KQia94o2L7ui6PJaQZ2smxn3oPymjglD/vOinrAhvw 6rDoSTxoRr9V045wdDrTmrsL6fHdjBADsxZLcE83XmG0l82Wi2RKLkUeWQYKDQ1/tllz qYwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BAYwSTkn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p1-v6si18000864plo.128.2018.04.26.02.09.58; Thu, 26 Apr 2018 02:10:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BAYwSTkn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754836AbeDZJIb (ORCPT + 99 others); Thu, 26 Apr 2018 05:08:31 -0400 Received: from mail-wr0-f180.google.com ([209.85.128.180]:33688 "EHLO mail-wr0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754428AbeDZJI0 (ORCPT ); Thu, 26 Apr 2018 05:08:26 -0400 Received: by mail-wr0-f180.google.com with SMTP id o4-v6so5686887wrm.0 for ; Thu, 26 Apr 2018 02:08:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=z+iVUNaxrTnads83Ic4F8Mw516hKbuMc1I7VuDhJIL4=; b=BAYwSTknHo3AOvIJn7bwrZp+2NnDqdtoN1SPgcAvg3rxwvyVcAdoMiaAkYa/OF+/vz 4Y96btiJNJJNSPpitrRLPy7f2xYmDbo879XApSW+fyht4fARwuE3ko1v/meAcl0Erqp3 fX3jev/NuFnJv2Xrm+AVEVXFr3wE5Vh+679fQ8ZaCwbADexlcZF+BuPAdKCc1vTy09NY tcCWv/B0A3KHYsj/B5eJ6v21SBuVofr9v7Ao8duFp2BckltpGNmvLFND1saoKwJN3bRz F46UMp5nHR7xHydar4F2q8lqVUlkkRZ3Lgy/zqRK8ejNLI5hlcY6qclS3hUrK+pKq5wR 1wvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=z+iVUNaxrTnads83Ic4F8Mw516hKbuMc1I7VuDhJIL4=; b=IWB5A5V3q72rKUA2MksN0PZHEN1S6ZmvS+ZkiI0MP2gctvSILGPXF4h7r9QiKozNAm mXGy1ifj3sTupthCRBhbCQgYQ+G5H32Nl6L1GR9d3/RDXFejfyFJcClZMhkQWP/ElFqC 7MoMNfSAf/+JFicXrLGQ2xMdRXgpznP4l/yyVzjHqXqKDVpOQ4D9MHuCOGOc2ygFrorl vebS3qPEUMcSR/GqLF0mLDYyIhyxR4W9gLhARDERkOMLS0Q2pU4VewCr6Cw5jplX+AGs E7uWkMdSgZ2lCLybHfmw91ZTQrlxW0iKQvQcqMSGdsBYy0RMGYcMAuHMQaN4VyWMy93M BuRw== X-Gm-Message-State: ALQs6tDRGwi2fUa7iBOWbuGtfpRBtIi4JdBMOBMZMhCtY/kMzCKERN/b TaVSWjFuhGwuCvE06wslMEkmBw== X-Received: by 2002:adf:dbc6:: with SMTP id e6-v6mr28402068wrj.212.1524733704804; Thu, 26 Apr 2018 02:08:24 -0700 (PDT) Received: from localhost (p5B3F6DEF.dip0.t-ipconnect.de. [91.63.109.239]) by smtp.gmail.com with ESMTPSA id n49-v6sm28740139wrn.50.2018.04.26.02.08.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Apr 2018 02:08:23 -0700 (PDT) From: Holger Schurig To: Alexander Duyck Cc: Jeff Kirsher , intel-wired-lan , LKML Subject: Re: [BUG] igb: reconnecting of cable not always detected In-Reply-To: References: <87h8o0ocul.fsf@gmail.com> <877eovobxl.fsf@gmail.com> Date: Thu, 26 Apr 2018 11:08:22 +0200 Message-ID: <87wowumj21.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, > Thanks. I'm suspecting we may need to instrument igb_rd32 at this > point. In order to trigger what you are seeing I am assuming the > device has been detached due to a read failure of some sort. Okay, I added a printk to igb_rd32. And because no one calls this function directly (all access goes via the rd32/rd32_array macro) I also added the output of the calling function. This should help greatly in identifying the read from the hardware to the consumer. Finally, I noticed that igb_update_stats() produced a lot of churn that most likely are unrelated. So I helper variable to make output from this function go away. I installed this modified driver, rebooted, and removed / inserted the LAN cable until the error was present. As before, "ethtool" and "mii-tool" now said that the device is not there, while "ip link" showed the device as present. The full output of "journalctl -fk | grep igb" is 600 kB. So put the whole file at Google Drive: https://drive.google.com/open?id=1p9cCT2d_EHnSHh29oS3AepUgFTKGFSeA I looked at the output to see patterns, e.g with grep -n igb_get_cfg_done_i210 igb.error.txt grep -n __igb_shutdown igb.error.txt ... (and almost all other function names). I hoped to see patterns. But for my untrained eye, things looked not out of the order. (For reference, here is the debug patch) Index: linux-4.16/drivers/net/ethernet/intel/igb/igb_main.c =================================================================== --- linux-4.16.orig/drivers/net/ethernet/intel/igb/igb_main.c 2018-04-01 23:20:27.000000000 +0200 +++ linux-4.16/drivers/net/ethernet/intel/igb/igb_main.c 2018-04-26 10:36:09.625135952 +0200 @@ -759,7 +759,8 @@ } } -u32 igb_rd32(struct e1000_hw *hw, u32 reg) +int igb_rd32_silent = 0; +u32 igb_rd32(const char *func, struct e1000_hw *hw, u32 reg) { struct igb_adapter *igb = container_of(hw, struct igb_adapter, hw); u8 __iomem *hw_addr = READ_ONCE(hw->hw_addr); @@ -769,6 +770,8 @@ return ~value; value = readl(&hw_addr[reg]); + if (!igb_rd32_silent) + printk("rd32 %s %08x %08x\n", func, reg, value); /* reads should not return all F's */ if (!(~value) && (!reg || !(~readl(hw_addr)))) { @@ -5935,6 +5938,7 @@ if (pci_channel_offline(pdev)) return; + igb_rd32_silent = 1; bytes = 0; packets = 0; @@ -6100,6 +6104,7 @@ adapter->stats.b2ospc += rd32(E1000_B2OSPC); adapter->stats.b2ogprc += rd32(E1000_B2OGPRC); } + igb_rd32_silent = 0; } static void igb_tsync_interrupt(struct igb_adapter *adapter) Index: linux-4.16/drivers/net/ethernet/intel/igb/e1000_regs.h =================================================================== --- linux-4.16.orig/drivers/net/ethernet/intel/igb/e1000_regs.h 2018-04-01 23:20:27.000000000 +0200 +++ linux-4.16/drivers/net/ethernet/intel/igb/e1000_regs.h 2018-04-26 10:34:24.332157000 +0200 @@ -370,7 +370,8 @@ struct e1000_hw; -u32 igb_rd32(struct e1000_hw *hw, u32 reg); +extern int igb_rd32_silent; +u32 igb_rd32(const char *fname, struct e1000_hw *hw, u32 reg); /* write operations, indexed using DWORDS */ #define wr32(reg, val) \ @@ -380,14 +381,14 @@ writel((val), &hw_addr[(reg)]); \ } while (0) -#define rd32(reg) (igb_rd32(hw, reg)) +#define rd32(reg) (igb_rd32(__func__, hw, reg)) #define wrfl() ((void)rd32(E1000_STATUS)) #define array_wr32(reg, offset, value) \ wr32((reg) + ((offset) << 2), (value)) -#define array_rd32(reg, offset) (igb_rd32(hw, reg + ((offset) << 2))) +#define array_rd32(reg, offset) (igb_rd32(__func__, hw, reg + ((offset) << 2))) /* DMA Coalescing registers */ #define E1000_PCIEMISC 0x05BB8 /* PCIE misc config register */