1. 08 2月, 2017 2 次提交
  2. 04 2月, 2017 3 次提交
    • T
      base/memory, hotplug: fix a kernel oops in show_valid_zones() · a96dfddb
      Toshi Kani 提交于
      Reading a sysfs "memoryN/valid_zones" file leads to the following oops
      when the first page of a range is not backed by struct page.
      show_valid_zones() assumes that 'start_pfn' is always valid for
      page_zone().
      
       BUG: unable to handle kernel paging request at ffffea017a000000
       IP: show_valid_zones+0x6f/0x160
      
      This issue may happen on x86-64 systems with 64GiB or more memory since
      their memory block size is bumped up to 2GiB.  [1] An example of such
      systems is desribed below.  0x3240000000 is only aligned by 1GiB and
      this memory block starts from 0x3200000000, which is not backed by
      struct page.
      
       BIOS-e820: [mem 0x0000003240000000-0x000000603fffffff] usable
      
      Since test_pages_in_a_zone() already checks holes, fix this issue by
      extending this function to return 'valid_start' and 'valid_end' for a
      given range.  show_valid_zones() then proceeds with the valid range.
      
      [1] 'Commit bdee237c ("x86: mm: Use 2GB memory block size on
          large-memory x86-64 systems")'
      
      Link: http://lkml.kernel.org/r/20170127222149.30893-3-toshi.kani@hpe.comSigned-off-by: NToshi Kani <toshi.kani@hpe.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Zhang Zhen <zhenzhang.zhang@huawei.com>
      Cc: Reza Arbab <arbab@linux.vnet.ibm.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: <stable@vger.kernel.org>	[4.4+]
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a96dfddb
    • H
      vhost: fix initialization for vq->is_le · cda8bba0
      Halil Pasic 提交于
      Currently, under certain circumstances vhost_init_is_le does just a part
      of the initialization job, and depends on vhost_reset_is_le being called
      too. For this reason vhost_vq_init_access used to call vhost_reset_is_le
      when vq->private_data is NULL. This is not only counter intuitive, but
      also real a problem because it breaks vhost_net. The bug was introduced to
      vhost_net with commit 2751c988 ("vhost: cross-endian support for
      legacy devices"). The symptom is corruption of the vq's used.idx field
      (virtio) after VHOST_NET_SET_BACKEND was issued as a part of the vhost
      shutdown on a vq with pending descriptors.
      
      Let us make sure the outcome of vhost_init_is_le never depend on the state
      it is actually supposed to initialize, and fix virtio_net by removing the
      reset from vhost_vq_init_access.
      
      With the above, there is no reason for vhost_reset_is_le to do just half
      of the job. Let us make vhost_reset_is_le reinitialize is_le.
      Signed-off-by: NHalil Pasic <pasic@linux.vnet.ibm.com>
      Reported-by: NMichael A. Tebolt <miket@us.ibm.com>
      Reported-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Fixes: commit 2751c988 ("vhost: cross-endian support for legacy devices")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Tested-by: NMichael A. Tebolt <miket@us.ibm.com>
      cda8bba0
    • M
      Revert "vring: Force use of DMA API for ARM-based systems with legacy devices" · 0d5415b4
      Michael S. Tsirkin 提交于
      This reverts commit c7070619.
      
      This has been shown to regress on some ARM systems:
      
      by forcing on DMA API usage for ARM systems, we have inadvertently
      kicked open a hornets' nest in terms of cache-coherency. Namely that
      unless the virtio device is explicitly described as capable of coherent
      DMA by firmware, the DMA APIs on ARM and other DT-based platforms will
      assume it is non-coherent. This turns out to cause a big problem for the
      likes of QEMU and kvmtool, which generate virtio-mmio devices in their
      guest DTs but neglect to add the often-overlooked "dma-coherent"
      property; as a result, we end up with the guest making non-cacheable
      accesses to the vring, the host doing so cacheably, both talking past
      each other and things going horribly wrong.
      
      We are working on a safer work-around.
      
      Fixes: c7070619 ("vring: Force use of DMA API for ARM-based systems with legacy devices")
      Reported-by: NRobin Murphy <robin.murphy@arm.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Acked-by: NMarc Zyngier <marc.zyngier@arm.com>
      0d5415b4
  3. 03 2月, 2017 2 次提交
  4. 02 2月, 2017 3 次提交
    • A
      efi/fdt: Avoid FDT manipulation after ExitBootServices() · c8f325a5
      Ard Biesheuvel 提交于
      Some AArch64 UEFI implementations disable the MMU in ExitBootServices(),
      after which unaligned accesses to RAM are no longer supported.
      
      Commit:
      
        abfb7b68 ("efi/libstub/arm*: Pass latest memory map to the kernel")
      
      fixed an issue in the memory map handling of the stub FDT code, but
      inadvertently created an issue with such firmware, by moving some
      of the FDT manipulation to after the invocation of ExitBootServices().
      
      Given that the stub's libfdt implementation uses the ordinary, accelerated
      string functions, which rely on hardware handling of unaligned accesses,
      manipulating the FDT with the MMU off may result in alignment faults.
      
      So fix the situation by moving the update_fdt_memmap() call into the
      callback function invoked by efi_exit_boot_services() right before it
      calls the ExitBootServices() UEFI service (which is arguably a better
      place for it anyway)
      
      Note that disabling the MMU in ExitBootServices() is not compliant with
      the UEFI spec, and carries great risk due to the fact that switching from
      cached to uncached memory accesses halfway through compiler generated code
      (i.e., involving a stack) can never be done in a way that is architecturally
      safe.
      
      Fixes: abfb7b68 ("efi/libstub/arm*: Pass latest memory map to the kernel")
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Tested-by: NRiku Voipio <riku.voipio@linaro.org>
      Cc: <stable@vger.kernel.org>
      Cc: mark.rutland@arm.com
      Cc: linux-efi@vger.kernel.org
      Cc: matt@codeblueprint.co.uk
      Cc: leif.lindholm@linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: http://lkml.kernel.org/r/1485971102-23330-2-git-send-email-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      c8f325a5
    • A
      vfio/spapr: Fix missing mutex unlock when creating a window · 2da64d20
      Alexey Kardashevskiy 提交于
      Commit d9c72894 ("vfio/spapr: Postpone default window creation")
      added an additional exit to the VFIO_IOMMU_SPAPR_TCE_CREATE case and
      made it possible to return from tce_iommu_ioctl() without unlocking
      container->lock; this fixes the issue.
      
      Fixes: d9c72894 ("vfio/spapr: Postpone default window creation")
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      2da64d20
    • I
      be2net: fix initial MAC setting · 4993b39a
      Ivan Vecera 提交于
      Recent commit 34393529 ("be2net: fix MAC addr setting on privileged
      BE3 VFs") allows privileged BE3 VFs to set its MAC address during
      initialization. Although the initial MAC for such VFs is already
      programmed by parent PF the subsequent setting performed by VF is OK,
      but in certain cases (after fresh boot) this command in VF can fail.
      
      The MAC should be initialized only when:
      1) no MAC is programmed (always except BE3 VFs during first init)
      2) programmed MAC is different from requested (e.g. MAC is set when
         interface is down). In this case the initial MAC programmed by PF
         needs to be deleted.
      
      The adapter->dev_mac contains MAC address currently programmed in HW so
      it should be zeroed when the MAC is deleted from HW and should not be
      filled when MAC is set when interface is down in be_mac_addr_set() as
      no programming is performed in this case.
      
      Example of failure without the fix (immediately after fresh boot):
      
      # ip link set eth0 up  <- eth0 is BE3 PF
      be2net 0000:01:00.0 eth0: Link is Up
      
      # echo 1 > /sys/class/net/eth0/device/sriov_numvfs  <- Create 1 VF
      ...
      be2net 0000:01:04.0: Emulex OneConnect(be3): VF  port 0
      
      # ip link set eth8 up  <- eth8 is created privileged VF
      be2net 0000:01:04.0: opcode 59-1 failed:status 1-76
      RTNETLINK answers: Input/output error
      
      # echo 0 > /sys/class/net/eth0/device/sriov_numvfs  <- Delete VF
      iommu: Removing device 0000:01:04.0 from group 33
      ...
      
      # echo 1 > /sys/class/net/eth0/device/sriov_numvfs  <- Create it again
      iommu: Removing device 0000:01:04.0 from group 33
      ...
      
      # ip link set eth8 up
      be2net 0000:01:04.0 eth8: Link is Up
      
      Initialization is now OK.
      
      v2 - Corrected the comment and condition check suggested by Suresh & Harsha
      
      Fixes: 34393529 ("be2net: fix MAC addr setting on privileged BE3 VFs")
      Cc: Sathya Perla <sathya.perla@broadcom.com>
      Cc: Ajit Khaparde <ajit.khaparde@broadcom.com>
      Cc: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
      Cc: Somnath Kotur <somnath.kotur@broadcom.com>
      Signed-off-by: NIvan Vecera <cera@cera.cz>
      Acked-by: NSriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4993b39a
  5. 01 2月, 2017 4 次提交
  6. 31 1月, 2017 15 次提交
    • M
      drm/atomic: Fix double free in drm_atomic_state_default_clear · 92c715fc
      Maarten Lankhorst 提交于
      drm_atomic_helper_page_flip and drm_atomic_ioctl set their own events
      in crtc_state->event. But when it's set the event is freed in 2 places.
      
      Solve this by only freeing the event in the atomic ioctl when it
      allocated its own event.
      
      This has been broken twice. The first time when the code was introduced,
      but only in the corner case when an event is allocated, but more crtc's
      were included by atomic check and then failing. This can mostly
      happen when you do an atomic modeset in i915 and the display clock is
      changed, which forces all crtc's to be included to the state.
      
      This has been broken worse by adding in-fences support, which caused
      the double free to be done unconditionally.
      
      [IGT] kms_rotation_crc: starting subtest primary-rotation-180
      =============================================================================
      BUG kmalloc-128 (Tainted: G     U         ): Object already free
      -----------------------------------------------------------------------------
      
      Disabling lock debugging due to kernel taint
      INFO: Allocated in drm_atomic_helper_setup_commit+0x285/0x2f0 [drm_kms_helper] age=0 cpu=3 pid=1529
       ___slab_alloc+0x308/0x3b0
       __slab_alloc+0xd/0x20
       kmem_cache_alloc_trace+0x92/0x1c0
       drm_atomic_helper_setup_commit+0x285/0x2f0 [drm_kms_helper]
       intel_atomic_commit+0x35/0x4f0 [i915]
       drm_atomic_commit+0x46/0x50 [drm]
       drm_mode_atomic_ioctl+0x7d4/0xab0 [drm]
       drm_ioctl+0x2b3/0x490 [drm]
       do_vfs_ioctl+0x69c/0x700
       SyS_ioctl+0x4e/0x80
       entry_SYSCALL_64_fastpath+0x13/0x94
      INFO: Freed in drm_event_cancel_free+0xa3/0xb0 [drm] age=0 cpu=3 pid=1529
       __slab_free+0x48/0x2e0
       kfree+0x159/0x1a0
       drm_event_cancel_free+0xa3/0xb0 [drm]
       drm_mode_atomic_ioctl+0x86d/0xab0 [drm]
       drm_ioctl+0x2b3/0x490 [drm]
       do_vfs_ioctl+0x69c/0x700
       SyS_ioctl+0x4e/0x80
       entry_SYSCALL_64_fastpath+0x13/0x94
      INFO: Slab 0xffffde1f0997b080 objects=17 used=2 fp=0xffff92fb65ec2578 flags=0x200000000008101
      INFO: Object 0xffff92fb65ec2578 @offset=1400 fp=0xffff92fb65ec2ae8
      
      Redzone ffff92fb65ec2570: bb bb bb bb bb bb bb bb                          ........
      Object ffff92fb65ec2578: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
      Object ffff92fb65ec2588: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
      Object ffff92fb65ec2598: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
      Object ffff92fb65ec25a8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
      Object ffff92fb65ec25b8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
      Object ffff92fb65ec25c8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
      Object ffff92fb65ec25d8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
      Object ffff92fb65ec25e8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b a5  kkkkkkkkkkkkkkk.
      Redzone ffff92fb65ec25f8: bb bb bb bb bb bb bb bb                          ........
      Padding ffff92fb65ec2738: 5a 5a 5a 5a 5a 5a 5a 5a                          ZZZZZZZZ
      CPU: 3 PID: 180 Comm: kworker/3:2 Tainted: G    BU          4.10.0-rc6-patser+ #5039
      Hardware name:                  /NUC5PPYB, BIOS PYBSWCEL.86A.0031.2015.0601.1712 06/01/2015
      Workqueue: events intel_atomic_helper_free_state [i915]
      Call Trace:
       dump_stack+0x4d/0x6d
       print_trailer+0x20c/0x220
       free_debug_processing+0x1c6/0x330
       ? drm_atomic_state_default_clear+0xf7/0x1c0 [drm]
       __slab_free+0x48/0x2e0
       ? drm_atomic_state_default_clear+0xf7/0x1c0 [drm]
       kfree+0x159/0x1a0
       drm_atomic_state_default_clear+0xf7/0x1c0 [drm]
       ? drm_atomic_state_clear+0x30/0x30 [drm]
       intel_atomic_state_clear+0xd/0x20 [i915]
       drm_atomic_state_clear+0x1a/0x30 [drm]
       __drm_atomic_state_free+0x13/0x60 [drm]
       intel_atomic_helper_free_state+0x5d/0x70 [i915]
       process_one_work+0x260/0x4a0
       worker_thread+0x2d1/0x4f0
       kthread+0x127/0x130
       ? process_one_work+0x4a0/0x4a0
       ? kthread_stop+0x120/0x120
       ret_from_fork+0x29/0x40
      FIX kmalloc-128: Object at 0xffff92fb65ec2578 not freed
      
      Fixes: 3b24f7d6 ("drm/atomic: Add struct drm_crtc_commit to track async updates")
      Fixes: 96260142 ("drm/fence: add in-fences support")
      Cc: <stable@vger.kernel.org> # v4.8+
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NGustavo Padovan <gustavo.padovan@collabora.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/1485854725-27640-1-git-send-email-maarten.lankhorst@linux.intel.com
      92c715fc
    • J
      HID: cp2112: fix gpio-callback error handling · 8e9faa15
      Johan Hovold 提交于
      In case of a zero-length report, the gpio direction_input callback would
      currently return success instead of an errno.
      
      Fixes: 1ffb3c40 ("HID: cp2112: make transfer buffers DMA capable")
      Cc: stable <stable@vger.kernel.org>     # 4.9
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Reviewed-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      8e9faa15
    • J
      HID: cp2112: fix sleep-while-atomic · 7a7b5df8
      Johan Hovold 提交于
      A recent commit fixing DMA-buffers on stack added a shared transfer
      buffer protected by a spinlock. This is broken as the USB HID request
      callbacks can sleep. Fix this up by replacing the spinlock with a mutex.
      
      Fixes: 1ffb3c40 ("HID: cp2112: make transfer buffers DMA capable")
      Cc: stable <stable@vger.kernel.org>	# 4.9
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Reviewed-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      7a7b5df8
    • G
      mmc: sdhci: Ignore unexpected CARD_INT interrupts · 161e6d44
      Gabriel Krisman Bertazi 提交于
      One of our kernelCI boxes hanged at boot because a faulty eSDHC device
      was triggering spurious CARD_INT interrupts for SD cards, causing CMD52
      reads, which are not allowed for SD devices.  This adds a sanity check
      to the interruption path, preventing that illegal command from getting
      sent if the CARD_INT interruption should be disabled.
      
      This quirk allows that particular machine to resume boot despite the
      faulty hardware, instead of getting hung dealing with thousands of
      mishandled interrupts.
      Suggested-by: NAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: NGabriel Krisman Bertazi <krisman@collabora.co.uk>
      Acked-by: NAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Cc: <stable@vger.kernel.org>
      161e6d44
    • B
      drm/nouveau/kms/nv50: request vblank events for commits that send completion events · 2b507893
      Ben Skeggs 提交于
      This somehow fixes an issue where sync-to-vblank longer works correctly
      after resume from suspend.
      
      From a HW perspective, we don't need the IRQs turned on to be able to
      detect flip completion, so it's assumed that this is required for the
      voodoo in the core DRM vblank core.
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      2b507893
    • I
      drm/nouveau/nv1a,nv1f/disp: fix memory clock rate retrieval · 24bf7ae3
      Ilia Mirkin 提交于
      Based on the xf86-video-nv code, NFORCE (NV1A) and NFORCE2 (NV1F) have a
      different way of retrieving clocks. See the
      nv_hw.c:nForceUpdateArbitrationSettings function in the original code
      for how these clocks were accessed.
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54587
      Cc: stable@vger.kernel.org
      Signed-off-by: NIlia Mirkin <imirkin@alum.mit.edu>
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      24bf7ae3
    • A
      drm/nouveau/disp/gt215: Fix HDA ELD handling (thus, HDMI audio) on gt215 · d347583a
      Alastair Bridgewater 提交于
      Store the ELD correctly, not just enough copies of the first byte
      to pad out the given ELD size.
      Signed-off-by: NAlastair Bridgewater <alastair.bridgewater@gmail.com>
      Fixes: 120b0c39 ("drm/nv50-/disp: audit and version SOR_HDA_ELD method")
      Cc: stable@vger.kernel.org # v3.17+
      Reviewed-by: NIlia Mirkin <imirkin@alum.mit.edu>
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      d347583a
    • M
      drm/nouveau/nouveau/led: prevent compiling the led-code if nouveau=y and leds=m · d72498ca
      Martin Peres 提交于
      The proper fix would have been to select LEDS_CLASS but this can lead
      to a circular dependency, as found out by Arnd.
      
      This patch implements Arnd's suggestion instead, at the cost of some
      auto-magic for a fringe feature.
      Reported-by: NArnd Bergmann <arnd@arndb.de>
      Reported-by: Intel's 0-DAY
      Fixes: 8d021d71 ("drm/nouveau/drm/nouveau: add a LED driver for the NVIDIA logo")
      Signed-off-by: NMartin Peres <martin.peres@free.fr>
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      d72498ca
    • B
      drm/nouveau/disp/mcp7x: disable dptmds workaround · 7dfee682
      Ben Skeggs 提交于
      The workaround appears to cause regressions on these boards, and from
      inspection of RM traces, NVIDIA don't appear to do it on them either.
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      Tested-by: NRoy Spliet <nouveau@spliet.org>
      7dfee682
    • B
      c966b627
    • B
    • D
      Drivers: hv: vmbus: finally fix hv_need_to_signal_on_read() · 433e19cf
      Dexuan Cui 提交于
      Commit a389fcfd ("Drivers: hv: vmbus: Fix signaling logic in
      hv_need_to_signal_on_read()")
      added the proper mb(), but removed the test "prev_write_sz < pending_sz"
      when making the signal decision.
      
      As a result, the guest can signal the host unnecessarily,
      and then the host can throttle the guest because the host
      thinks the guest is buggy or malicious; finally the user
      running stress test can perceive intermittent freeze of
      the guest.
      
      This patch brings back the test, and properly handles the
      in-place consumption APIs used by NetVSC (see get_next_pkt_raw(),
      put_pkt_raw() and commit_rd_index()).
      
      Fixes: a389fcfd ("Drivers: hv: vmbus: Fix signaling logic in
      hv_need_to_signal_on_read()")
      Signed-off-by: NDexuan Cui <decui@microsoft.com>
      Reported-by: NRolf Neugebauer <rolf.neugebauer@docker.com>
      Tested-by: NRolf Neugebauer <rolf.neugebauer@docker.com>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NK. Y. Srinivasan <kys@microsoft.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      433e19cf
    • C
      Input: synaptics-rmi4 - fix reversed conditions in enable/disable_irq_wake · 05e0be7c
      Christophe JAILLET 提交于
      These tests are reversed.  A warning should be displayed if an error is
      returned, not on success.
      Signed-off-by: NChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Reviewed-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      05e0be7c
    • J
      net/mlx4_core: Avoid command timeouts during VF driver device shutdown · d585df1c
      Jack Morgenstein 提交于
      Some Hypervisors detach VFs from VMs by instantly causing an FLR event
      to be generated for a VF.
      
      In the mlx4 case, this will cause that VF's comm channel to be disabled
      before the VM has an opportunity to invoke the VF device's "shutdown"
      method.
      
      The result is that the VF driver on the VM will experience a command
      timeout during the shutdown process when the Hypervisor does not deliver
      a command-completion event to the VM.
      
      To avoid FW command timeouts on the VM when the driver's shutdown method
      is invoked, we detect the absence of the VF's comm channel at the very
      start of the shutdown process. If the comm-channel has already been
      disabled, we cause all FW commands during the device shutdown process to
      immediately return success (and thus avoid all command timeouts).
      Signed-off-by: NJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: NTariq Toukan <tariqt@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d585df1c
    • A
      gianfar: synchronize DMA API usage by free_skb_rx_queue w/ gfar_new_page · 4af0e5bb
      Arseny Solokha 提交于
      In spite of switching to paged allocation of Rx buffers, the driver still
      called dma_unmap_single() in the Rx queues tear-down path.
      
      The DMA region unmapping code in free_skb_rx_queue() basically predates
      the introduction of paged allocation to the driver. While being refactored,
      it apparently hasn't reflected the change in the DMA API usage by its
      counterpart gfar_new_page().
      
      As a result, setting an interface to the DOWN state now yields the following:
      
        # ip link set eth2 down
        fsl-gianfar ffe24000.ethernet: DMA-API: device driver frees DMA memory with wrong function [device address=0x000000001ecd0000] [size=40]
        ------------[ cut here ]------------
        WARNING: CPU: 1 PID: 189 at lib/dma-debug.c:1123 check_unmap+0x8e0/0xa28
        CPU: 1 PID: 189 Comm: ip Tainted: G           O    4.9.5 #1
        task: dee73400 task.stack: dede2000
        NIP: c02101e8 LR: c02101e8 CTR: c0260d74
        REGS: dede3bb0 TRAP: 0700   Tainted: G           O     (4.9.5)
        MSR: 00021000 <CE,ME>  CR: 28002222  XER: 00000000
      
        GPR00: c02101e8 dede3c60 dee73400 000000b6 dfbd033c dfbd36c4 1f622000 dede2000
        GPR08: 00000007 c05b1634 1f622000 00000000 22002484 100a9904 00000000 00000000
        GPR16: 00000000 db4c849c 00000002 db4c8480 00000001 df142240 db4c84bc 00000000
        GPR24: c0706148 c0700000 00029000 c07552e8 c07323b4 dede3cb8 c07605e0 db535540
        NIP [c02101e8] check_unmap+0x8e0/0xa28
        LR [c02101e8] check_unmap+0x8e0/0xa28
        Call Trace:
        [dede3c60] [c02101e8] check_unmap+0x8e0/0xa28 (unreliable)
        [dede3cb0] [c02103b8] debug_dma_unmap_page+0x88/0x9c
        [dede3d30] [c02dffbc] free_skb_resources+0x2c4/0x404
        [dede3d80] [c02e39b4] gfar_close+0x24/0xc8
        [dede3da0] [c0361550] __dev_close_many+0xa0/0xf8
        [dede3dd0] [c03616f0] __dev_close+0x2c/0x4c
        [dede3df0] [c036b1b8] __dev_change_flags+0xa0/0x174
        [dede3e10] [c036b2ac] dev_change_flags+0x20/0x60
        [dede3e30] [c03e130c] devinet_ioctl+0x540/0x824
        [dede3e90] [c0347dcc] sock_ioctl+0x134/0x298
        [dede3eb0] [c0111814] do_vfs_ioctl+0xac/0x854
        [dede3f20] [c0111ffc] SyS_ioctl+0x40/0x74
        [dede3f40] [c000f290] ret_from_syscall+0x0/0x3c
        --- interrupt: c01 at 0xff45da0
            LR = 0xff45cd0
        Instruction dump:
        811d001c 7c66482e 813d0020 9061000c 807f000c 5463103a 7cc6182e 3c60c052
        386309ac 90c10008 4cc63182 4826b845 <0fe00000> 4bfffa60 3c80c052 388402c4
        ---[ end trace 695ae6d7ac1d0c47 ]---
        Mapped at:
         [<c02e22a8>] gfar_alloc_rx_buffs+0x178/0x248
         [<c02e3ef0>] startup_gfar+0x368/0x570
         [<c036aeb4>] __dev_open+0xdc/0x150
         [<c036b1b8>] __dev_change_flags+0xa0/0x174
         [<c036b2ac>] dev_change_flags+0x20/0x60
      
      Even though the issue was discovered in 4.9 kernel, the code in question
      is identical in the current net and net-next trees.
      
      Fixes: 75354148 ("gianfar: Add paged allocation and Rx S/G")
      Signed-off-by: NArseny Solokha <asolokha@kb.kras.ru>
      Acked-by: NClaudiu Manoil <claudiu.manoil@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4af0e5bb
  7. 30 1月, 2017 11 次提交