1. 23 4月, 2020 6 次提交
  2. 10 4月, 2020 1 次提交
  3. 26 1月, 2020 1 次提交
    • D
      Drivers: hv: vmbus: Ignore CHANNELMSG_TL_CONNECT_RESULT(23) · ddc9d357
      Dexuan Cui 提交于
      When a Linux hv_sock app tries to connect to a Service GUID on which no
      host app is listening, a recent host (RS3+) sends a
      CHANNELMSG_TL_CONNECT_RESULT (23) message to Linux and this triggers such
      a warning:
      
      unknown msgtype=23
      WARNING: CPU: 2 PID: 0 at drivers/hv/vmbus_drv.c:1031 vmbus_on_msg_dpc
      
      Actually Linux can safely ignore the message because the Linux app's
      connect() will time out in 2 seconds: see VSOCK_DEFAULT_CONNECT_TIMEOUT
      and vsock_stream_connect(). We don't bother to make use of the message
      because: 1) it's only supported on recent hosts; 2) a non-trivial effort
      is required to use the message in Linux, but the benefit is small.
      
      So, let's not see the warning by silently ignoring the message.
      Signed-off-by: NDexuan Cui <decui@microsoft.com>
      Reviewed-by: NMichael Kelley <mikelley@microsoft.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      ddc9d357
  4. 07 9月, 2019 3 次提交
  5. 05 6月, 2019 1 次提交
  6. 11 4月, 2019 1 次提交
    • K
      Drivers: hv: vmbus: Fix race condition with new ring_buffer_info mutex · 14948e39
      Kimberly Brown 提交于
      Fix a race condition that can result in a ring buffer pointer being set
      to null while a "_show" function is reading the ring buffer's data. This
      problem was discussed here: https://lkml.org/lkml/2018/10/18/779
      
      To fix the race condition, add a new mutex lock to the
      "hv_ring_buffer_info" struct. Add a new function,
      "hv_ringbuffer_pre_init()", where a channel's inbound and outbound
      ring_buffer_info mutex locks are initialized.
      
      Acquire/release the locks in the "hv_ringbuffer_cleanup()" function,
      which is where the ring buffer pointers are set to null.
      
      Acquire/release the locks in the four channel-level "_show" functions
      that access ring buffer data. Remove the "const" qualifier from the
      "vmbus_channel" parameter and the "rbi" variable of the channel-level
      "_show" functions so that the locks can be acquired/released in these
      functions.
      
      Acquire/release the locks in hv_ringbuffer_get_debuginfo(). Remove the
      "const" qualifier from the "hv_ring_buffer_info" parameter so that the
      locks can be acquired/released in this function.
      Signed-off-by: NKimberly Brown <kimbrownkd@gmail.com>
      Reviewed-by: NMichael Kelley <mikelley@microsoft.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      14948e39
  7. 21 3月, 2019 1 次提交
    • K
      Drivers: hv: vmbus: Expose monitor data only when monitor pages are used · 46fc1548
      Kimberly Brown 提交于
      There are two methods for signaling the host: the monitor page mechanism
      and hypercalls. The monitor page mechanism is used by performance
      critical channels (storage, networking, etc.) because it provides
      improved throughput. However, latency is increased. Monitor pages are
      allocated to these channels.
      
      Monitor pages are not allocated to channels that do not use the monitor
      page mechanism. Therefore, these channels do not have a valid monitor id
      or valid monitor page data. In these cases, some of the "_show"
      functions return incorrect data. They return an invalid monitor id and
      data that is beyond the bounds of the hv_monitor_page array fields.
      
      The "channel->offermsg.monitor_allocated" value can be used to determine
      whether monitor pages have been allocated to a channel.
      
      Add "is_visible()" callback functions for the device-level and
      channel-level attribute groups. These functions will hide the monitor
      sysfs files when the monitor mechanism is not used.
      
      Remove ".default_attributes" from "vmbus_chan_attrs" and create a
      channel-level attribute group. These changes allow the new
      "is_visible()" callback function to be applied to the channel-level
      attributes.
      
      Call "sysfs_create_group()" in "vmbus_add_channel_kobj()" to create the
      channel's sysfs files. Add a new function,
      “vmbus_remove_channel_attr_group()”, and call it in "free_channel()" to
      remove the channel's sysfs files when the channel is closed.
      Signed-off-by: NKimberly Brown <kimbrownkd@gmail.com>
      Reviewed-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Reviewed-by: NMichael Kelley <mikelley@microsoft.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      46fc1548
  8. 15 2月, 2019 1 次提交
  9. 03 12月, 2018 1 次提交
    • D
      Drivers: hv: vmbus: Offload the handling of channels to two workqueues · 37c2578c
      Dexuan Cui 提交于
      vmbus_process_offer() mustn't call channel->sc_creation_callback()
      directly for sub-channels, because sc_creation_callback() ->
      vmbus_open() may never get the host's response to the
      OPEN_CHANNEL message (the host may rescind a channel at any time,
      e.g. in the case of hot removing a NIC), and vmbus_onoffer_rescind()
      may not wake up the vmbus_open() as it's blocked due to a non-zero
      vmbus_connection.offer_in_progress, and finally we have a deadlock.
      
      The above is also true for primary channels, if the related device
      drivers use sync probing mode by default.
      
      And, usually the handling of primary channels and sub-channels can
      depend on each other, so we should offload them to different
      workqueues to avoid possible deadlock, e.g. in sync-probing mode,
      NIC1's netvsc_subchan_work() can race with NIC2's netvsc_probe() ->
      rtnl_lock(), and causes deadlock: the former gets the rtnl_lock
      and waits for all the sub-channels to appear, but the latter
      can't get the rtnl_lock and this blocks the handling of sub-channels.
      
      The patch can fix the multiple-NIC deadlock described above for
      v3.x kernels (e.g. RHEL 7.x) which don't support async-probing
      of devices, and v4.4, v4.9, v4.14 and v4.18 which support async-probing
      but don't enable async-probing for Hyper-V drivers (yet).
      
      The patch can also fix the hang issue in sub-channel's handling described
      above for all versions of kernels, including v4.19 and v4.20-rc4.
      
      So actually the patch should be applied to all the existing kernels,
      not only the kernels that have 8195b139.
      
      Fixes: 8195b139 ("hv_netvsc: fix deadlock on hotplug")
      Cc: stable@vger.kernel.org
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Cc: K. Y. Srinivasan <kys@microsoft.com>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Signed-off-by: NDexuan Cui <decui@microsoft.com>
      Signed-off-by: NK. Y. Srinivasan <kys@microsoft.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      37c2578c
  10. 27 11月, 2018 1 次提交
  11. 03 10月, 2018 2 次提交
  12. 26 9月, 2018 1 次提交
  13. 02 8月, 2018 1 次提交
    • D
      Drivers: hv: vmbus: Reset the channel callback in vmbus_onoffer_rescind() · d3b26dd7
      Dexuan Cui 提交于
      Before setting channel->rescind in vmbus_rescind_cleanup(), we should make
      sure the channel callback won't run any more, otherwise a high-level
      driver like pci_hyperv, which may be infinitely waiting for the host VSP's
      response and notices the channel has been rescinded, can't safely give
      up: e.g., in hv_pci_protocol_negotiation() -> wait_for_response(), it's
      unsafe to exit from wait_for_response() and proceed with the on-stack
      variable "comp_pkt" popped. The issue was originally spotted by
      Michael Kelley <mikelley@microsoft.com>.
      
      In vmbus_close_internal(), the patch also minimizes the range protected by
      disabling/enabling channel->callback_event: we don't really need that for
      the whole function.
      Signed-off-by: NDexuan Cui <decui@microsoft.com>
      Reviewed-by: NMichael Kelley <mikelley@microsoft.com>
      Cc: stable@vger.kernel.org
      Cc: K. Y. Srinivasan <kys@microsoft.com>
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Cc: Michael Kelley <mikelley@microsoft.com>
      Signed-off-by: NK. Y. Srinivasan <kys@microsoft.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d3b26dd7
  14. 03 7月, 2018 1 次提交
  15. 28 3月, 2018 1 次提交
  16. 07 3月, 2018 1 次提交
  17. 28 11月, 2017 1 次提交
  18. 04 11月, 2017 9 次提交
  19. 20 10月, 2017 1 次提交
  20. 04 10月, 2017 2 次提交
  21. 22 9月, 2017 1 次提交
  22. 17 8月, 2017 1 次提交
  23. 10 8月, 2017 1 次提交