Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/516410/?format=api
{ "id": 516410, "url": "http://patchwork.ozlabs.org/api/patches/516410/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1441913870-12953-1-git-send-email-jarod@redhat.com/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api", "name": "Intel Wired Ethernet development", "link_name": "intel-wired-lan", "list_id": "intel-wired-lan.osuosl.org", "list_email": "intel-wired-lan@osuosl.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1441913870-12953-1-git-send-email-jarod@redhat.com>", "list_archive_url": null, "date": "2015-09-10T19:37:50", "name": "[v2] igb: don't unmap NULL hw_addr", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "b0982a88810f72228485368ec5295b7c0d84a093", "submitter": { "id": 1153, "url": "http://patchwork.ozlabs.org/api/people/1153/?format=api", "name": "Jarod Wilson", "email": "jarod@redhat.com" }, "delegate": { "id": 68, "url": "http://patchwork.ozlabs.org/api/users/68/?format=api", "username": "jtkirshe", "first_name": "Jeff", "last_name": "Kirsher", "email": "jeffrey.t.kirsher@intel.com" }, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1441913870-12953-1-git-send-email-jarod@redhat.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/516410/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/516410/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@lists.osuosl.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Received": [ "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ozlabs.org (Postfix) with ESMTP id D96D514010F\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 11 Sep 2015 05:38:05 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id EC78732C8E;\n\tThu, 10 Sep 2015 19:38:03 +0000 (UTC)", "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 5rIp559r6hxO; Thu, 10 Sep 2015 19:38:02 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id B781332C89;\n\tThu, 10 Sep 2015 19:38:02 +0000 (UTC)", "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id 418BB1C11DE\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 10 Sep 2015 19:38:01 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 3863432C7D\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 10 Sep 2015 19:38:01 +0000 (UTC)", "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id okwUssSWRKG0 for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 10 Sep 2015 19:37:59 +0000 (UTC)", "from mx1.redhat.com (mx1.redhat.com [209.132.183.28])\n\tby silver.osuosl.org (Postfix) with ESMTPS id 5A6CC32C40\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 10 Sep 2015 19:37:59 +0000 (UTC)", "from int-mx14.intmail.prod.int.phx2.redhat.com\n\t(int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27])\n\tby mx1.redhat.com (Postfix) with ESMTPS id 9868380091;\n\tThu, 10 Sep 2015 19:37:58 +0000 (UTC)", "from hp-dl360pgen8-07.khw.lab.eng.bos.redhat.com\n\t(hp-dl360pgen8-07.khw.lab.eng.bos.redhat.com [10.16.184.47])\n\tby int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with\n\tESMTP id t8AJbv7l010508; Thu, 10 Sep 2015 15:37:57 -0400" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "From": "Jarod Wilson <jarod@redhat.com>", "To": "linux-kernel@vger.kernel.org", "Date": "Thu, 10 Sep 2015 15:37:50 -0400", "Message-Id": "<1441913870-12953-1-git-send-email-jarod@redhat.com>", "In-Reply-To": "<9AC147AD-6D52-4A7D-BE5B-3A40F8D22B1A@intel.com>", "References": "<9AC147AD-6D52-4A7D-BE5B-3A40F8D22B1A@intel.com>", "X-Scanned-By": "MIMEDefang 2.68 on 10.5.11.27", "Cc": "netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org,\n\tJarod Wilson <jarod@redhat.com>", "Subject": "[Intel-wired-lan] [PATCH v2] igb: don't unmap NULL hw_addr", "X-BeenThere": "intel-wired-lan@lists.osuosl.org", "X-Mailman-Version": "2.1.18-1", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>", "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>", "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>" }, "content": "I've got a startech thunderbolt dock someone loaned me, which among other\nthings, has the following device in it:\n\n08:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)\n\nThis hotplugs just fine (kernel 4.2.0 plus a patch or two here):\n\n[ 863.020315] igb: Intel(R) Gigabit Ethernet Network Driver - version 5.2.18-k\n[ 863.020316] igb: Copyright (c) 2007-2014 Intel Corporation.\n[ 863.028657] igb 0000:08:00.0: enabling device (0000 -> 0002)\n[ 863.062089] igb 0000:08:00.0: added PHC on eth0\n[ 863.062090] igb 0000:08:00.0: Intel(R) Gigabit Ethernet Network Connection\n[ 863.062091] igb 0000:08:00.0: eth0: (PCIe:2.5Gb/s:Width x1) e8:ea:6a:00:1b:2a\n[ 863.062194] igb 0000:08:00.0: eth0: PBA No: 000200-000\n[ 863.062196] igb 0000:08:00.0: Using MSI-X interrupts. 4 rx queue(s), 4 tx queue(s)\n[ 863.064889] igb 0000:08:00.0 enp8s0: renamed from eth0\n\nBut disconnecting it is another story:\n\n[ 1002.807932] igb 0000:08:00.0: removed PHC on enp8s0\n[ 1002.807944] igb 0000:08:00.0 enp8s0: PCIe link lost, device now detached\n[ 1003.341141] ------------[ cut here ]------------\n[ 1003.341148] WARNING: CPU: 0 PID: 199 at lib/iomap.c:43 bad_io_access+0x38/0x40()\n[ 1003.341149] Bad IO access at port 0x0 ()\n[ 1003.342767] Modules linked in: snd_usb_audio snd_usbmidi_lib snd_rawmidi igb dca firewire_ohci firewire_core crc_itu_t rfcomm ctr ccm arc4 iwlmvm mac80211 fuse xt_CHECKSUM ipt_MASQUERADE\nnf_nat_masquerade_ipv4 tun ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 ipt_REJECT nf_reject_ipv4 xt_conntrack ebtable_nat ebtable_broute bridge stp llc ebtable_filter ebtables ip6table_nat\nnf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw ip6table_filter ip6_tables iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat\nnf_conntrack iptable_mangle iptable_security iptable_raw iptable_filter bnep dm_mirror dm_region_hash dm_log dm_mod coretemp x86_pkg_temp_thermal intel_powerclamp kvm_intel snd_hda_codec_hdmi kvm\ncrct10dif_pclmul crc32_pclmul ghash_clmulni_intel drbg\n[ 1003.342793] ansi_cprng aesni_intel hp_wmi aes_x86_64 iTCO_wdt lrw iTCO_vendor_support ppdev gf128mul sparse_keymap glue_helper ablk_helper cryptd snd_hda_codec_realtek snd_hda_codec_generic\nmicrocode snd_hda_intel uvcvideo iwlwifi snd_hda_codec videobuf2_vmalloc videobuf2_memops snd_hda_core videobuf2_core snd_hwdep btusb v4l2_common btrtl snd_seq btbcm btintel videodev cfg80211\nsnd_seq_device rtsx_pci_ms bluetooth pcspkr input_leds i2c_i801 media parport_pc memstick rfkill sg lpc_ich snd_pcm 8250_fintek parport joydev snd_timer snd soundcore hp_accel ie31200_edac\nmei_me lis3lv02d edac_core input_polldev mei hp_wireless shpchp tpm_infineon sch_fq_codel nfsd auth_rpcgss nfs_acl lockd grace sunrpc ip_tables autofs4 xfs libcrc32c sd_mod sr_mod cdrom\nrtsx_pci_sdmmc mmc_core crc32c_intel serio_raw rtsx_pci\n[ 1003.342822] nouveau ahci libahci mxm_wmi e1000e xhci_pci hwmon ptp drm_kms_helper pps_core xhci_hcd ttm wmi video ipv6\n[ 1003.342839] CPU: 0 PID: 199 Comm: kworker/0:2 Not tainted 4.2.0-2.el7_UNSUPPORTED.x86_64 #1\n[ 1003.342840] Hardware name: Hewlett-Packard HP ZBook 15 G2/2253, BIOS M70 Ver. 01.07 02/26/2015\n[ 1003.342843] Workqueue: pciehp-3 pciehp_power_thread\n[ 1003.342844] ffffffff81a90655 ffff8804866d3b48 ffffffff8164763a 0000000000000000\n[ 1003.342846] ffff8804866d3b98 ffff8804866d3b88 ffffffff8107134a ffff8804866d3b88\n[ 1003.342847] ffff880486f46000 ffff88046c8a8000 ffff880486f46840 ffff88046c8a8098\n[ 1003.342848] Call Trace:\n[ 1003.342852] [<ffffffff8164763a>] dump_stack+0x45/0x57\n[ 1003.342855] [<ffffffff8107134a>] warn_slowpath_common+0x8a/0xc0\n[ 1003.342857] [<ffffffff810713c6>] warn_slowpath_fmt+0x46/0x50\n[ 1003.342859] [<ffffffff8133719e>] ? pci_disable_msix+0x3e/0x50\n[ 1003.342860] [<ffffffff812f6328>] bad_io_access+0x38/0x40\n[ 1003.342861] [<ffffffff812f6567>] pci_iounmap+0x27/0x40\n[ 1003.342865] [<ffffffffa0b728d7>] igb_remove+0xc7/0x160 [igb]\n[ 1003.342867] [<ffffffff8132189f>] pci_device_remove+0x3f/0xc0\n[ 1003.342869] [<ffffffff81433426>] __device_release_driver+0x96/0x130\n[ 1003.342870] [<ffffffff814334e3>] device_release_driver+0x23/0x30\n[ 1003.342871] [<ffffffff8131b404>] pci_stop_bus_device+0x94/0xa0\n[ 1003.342872] [<ffffffff8131b3ad>] pci_stop_bus_device+0x3d/0xa0\n[ 1003.342873] [<ffffffff8131b3ad>] pci_stop_bus_device+0x3d/0xa0\n[ 1003.342874] [<ffffffff8131b516>] pci_stop_and_remove_bus_device+0x16/0x30\n[ 1003.342876] [<ffffffff81333f5b>] pciehp_unconfigure_device+0x9b/0x180\n[ 1003.342877] [<ffffffff81333a73>] pciehp_disable_slot+0x43/0xb0\n[ 1003.342878] [<ffffffff81333b6d>] pciehp_power_thread+0x8d/0xb0\n[ 1003.342885] [<ffffffff810881b2>] process_one_work+0x152/0x3d0\n[ 1003.342886] [<ffffffff8108854a>] worker_thread+0x11a/0x460\n[ 1003.342887] [<ffffffff81088430>] ? process_one_work+0x3d0/0x3d0\n[ 1003.342890] [<ffffffff8108ddd9>] kthread+0xc9/0xe0\n[ 1003.342891] [<ffffffff8108dd10>] ? kthread_create_on_node+0x180/0x180\n[ 1003.342893] [<ffffffff8164e29f>] ret_from_fork+0x3f/0x70\n[ 1003.342894] [<ffffffff8108dd10>] ? kthread_create_on_node+0x180/0x180\n[ 1003.342895] ---[ end trace 65a77e06d5aa9358 ]---\n\nUpon looking at the igb driver, I see that igb_rd32() attempted to read from\nhw_addr and failed, so it set hw->hw_addr to NULL and spit out the message\nin the log output above, \"PCIe link lost, device now detached\".\n\nWell, now that hw_addr is NULL, the attempt to call pci_iounmap is obviously\nnot going to go well. As suggested by Mark Rustad, do something similar to\nwhat ixgbe does, and save a copy of hw_addr as adapter->io_addr, so we can\nstill call pci_iounmap on it on teardown. Additionally, for consistency,\nmake the pci_iomap call assignment directly to io_addr, so map and unmap\nmatch.\n\nCC: Mark Rustad <mark.d.rustad@intel.com>\nCC: Jeff Kirsher <jeffrey.t.kirsher@intel.com>\nCC: intel-wired-lan@lists.osuosl.org\nCC: netdev@vger.kernel.org\nSigned-off-by: Jarod Wilson <jarod@redhat.com>\n---\n drivers/net/ethernet/intel/igb/igb.h | 2 ++\n drivers/net/ethernet/intel/igb/igb_main.c | 10 ++++++----\n 2 files changed, 8 insertions(+), 4 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h\nindex 212d668..df1d1c5 100644\n--- a/drivers/net/ethernet/intel/igb/igb.h\n+++ b/drivers/net/ethernet/intel/igb/igb.h\n@@ -389,6 +389,8 @@ struct igb_adapter {\n \tu16 link_speed;\n \tu16 link_duplex;\n \n+\tu8 __iomem *io_addr; /* Mainly for iounmap use */\n+\n \tstruct work_struct reset_task;\n \tstruct work_struct watchdog_task;\n \tbool fc_autoneg;\ndiff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c\nindex e174fbb..76928b6 100644\n--- a/drivers/net/ethernet/intel/igb/igb_main.c\n+++ b/drivers/net/ethernet/intel/igb/igb_main.c\n@@ -2294,9 +2294,11 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n \tadapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE);\n \n \terr = -EIO;\n-\thw->hw_addr = pci_iomap(pdev, 0, 0);\n-\tif (!hw->hw_addr)\n+\tadapter->io_addr = pci_iomap(pdev, 0, 0);\n+\tif (!adapter->io_addr)\n \t\tgoto err_ioremap;\n+\t/* hw->hw_addr can be altered, we'll use adapter->io_addr for unmap */\n+\thw->hw_addr = adapter->io_addr;\n \n \tnetdev->netdev_ops = &igb_netdev_ops;\n \tigb_set_ethtool_ops(netdev);\n@@ -2656,7 +2658,7 @@ err_sw_init:\n #ifdef CONFIG_PCI_IOV\n \tigb_disable_sriov(pdev);\n #endif\n-\tpci_iounmap(pdev, hw->hw_addr);\n+\tpci_iounmap(pdev, adapter->io_addr);\n err_ioremap:\n \tfree_netdev(netdev);\n err_alloc_etherdev:\n@@ -2823,7 +2825,7 @@ static void igb_remove(struct pci_dev *pdev)\n \n \tigb_clear_interrupt_scheme(adapter);\n \n-\tpci_iounmap(pdev, hw->hw_addr);\n+\tpci_iounmap(pdev, adapter->io_addr);\n \tif (hw->flash_address)\n \t\tiounmap(hw->flash_address);\n \tpci_release_selected_regions(pdev,\n", "prefixes": [ "v2" ] }