31 Jan, 2019

2 commits

  • commit ba50bf1ce9a51fc97db58b96d01306aa70bc3979 upstream.

    fc96df16a1ce is good and can already fix the "return stack garbage" issue,
    but let's also improve hv_ringbuffer_get_debuginfo(), which would silently
    return stack garbage, if people forget to check channel->state or
    ring_info->ring_buffer, when using the function in the future.

    Having an error check in the function would eliminate the potential risk.

    Add a Fixes tag to indicate the patch depdendency.

    Fixes: fc96df16a1ce ("Drivers: hv: vmbus: Return -EINVAL for the sys files for unopened channels")
    Cc: stable@vger.kernel.org
    Cc: K. Y. Srinivasan
    Cc: Haiyang Zhang
    Signed-off-by: Stephen Hemminger
    Signed-off-by: Dexuan Cui
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Dexuan Cui
     
  • commit da8ced360ca8ad72d8f41f5c8fcd5b0e63e1555f upstream.

    Hyper-V memory hotplug protocol has 2M granularity and in Linux x86 we use
    128M. To deal with it we implement partial section onlining by registering
    custom page onlining callback (hv_online_page()). Later, when more memory
    arrives we try to online the 'tail' (see hv_bring_pgs_online()).

    It was found that in some cases this 'tail' onlining causes issues:

    BUG: Bad page state in process kworker/0:2 pfn:109e3a
    page:ffffe08344278e80 count:0 mapcount:1 mapping:0000000000000000 index:0x0
    flags: 0xfffff80000000()
    raw: 000fffff80000000 dead000000000100 dead000000000200 0000000000000000
    raw: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    page dumped because: nonzero mapcount
    ...
    Workqueue: events hot_add_req [hv_balloon]
    Call Trace:
    dump_stack+0x5c/0x80
    bad_page.cold.112+0x7f/0xb2
    free_pcppages_bulk+0x4b8/0x690
    free_unref_page+0x54/0x70
    hv_page_online_one+0x5c/0x80 [hv_balloon]
    hot_add_req.cold.24+0x182/0x835 [hv_balloon]
    ...

    Turns out that we now have deferred struct page initialization for memory
    hotplug so e.g. memory_block_action() in drivers/base/memory.c does
    pages_correctly_probed() check and in that check it avoids inspecting
    struct pages and checks sections instead. But in Hyper-V balloon driver we
    do PageReserved(pfn_to_page()) check and this is now wrong.

    Switch to checking online_section_nr() instead.

    Signed-off-by: Vitaly Kuznetsov
    Cc: stable@kernel.org
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Vitaly Kuznetsov
     

13 Jan, 2019

1 commit


29 Dec, 2018

1 commit

  • commit fc96df16a1ce80cbb3c316ab7d4dc8cd5c2852ce upstream.

    Before 98f4c651762c, we returned zeros for unopened channels.
    With 98f4c651762c, we started to return random on-stack values.

    We'd better return -EINVAL instead.

    Fixes: 98f4c651762c ("hv: move ringbuffer bus attributes to dev_groups")
    Cc: stable@vger.kernel.org
    Cc: K. Y. Srinivasan
    Cc: Haiyang Zhang
    Cc: Stephen Hemminger
    Signed-off-by: Dexuan Cui
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Dexuan Cui
     

13 Dec, 2018

1 commit

  • commit 37c2578c0c40e286bc0d30bdc05290b2058cf66e upstream.

    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 8195b1396ec8.

    Fixes: 8195b1396ec8 ("hv_netvsc: fix deadlock on hotplug")
    Cc: stable@vger.kernel.org
    Cc: Stephen Hemminger
    Cc: K. Y. Srinivasan
    Cc: Haiyang Zhang
    Signed-off-by: Dexuan Cui
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Dexuan Cui
     

06 Dec, 2018

1 commit

  • commit eceb05965489784f24bbf4d61ba60e475a983016 upstream.

    This is a longstanding issue: if the vmbus upper-layer drivers try to
    consume too many GPADLs, the host may return with an error
    0xC0000044 (STATUS_QUOTA_EXCEEDED), but currently we forget to check
    the creation_status, and hence we can pass an invalid GPADL handle
    into the OPEN_CHANNEL message, and get an error code 0xc0000225 in
    open_info->response.open_result.status, and finally we hang in
    vmbus_open() -> "goto error_free_info" -> vmbus_teardown_gpadl().

    With this patch, we can exit gracefully on STATUS_QUOTA_EXCEEDED.

    Cc: Stephen Hemminger
    Cc: K. Y. Srinivasan
    Cc: Haiyang Zhang
    Cc: stable@vger.kernel.org
    Signed-off-by: Dexuan Cui
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Dexuan Cui
     

14 Nov, 2018

1 commit

  • [ Upstream commit 25355252607ca288f329ee033f387764883393f6 ]

    A cpumask structure on the stack can cause a warning with
    CONFIG_NR_CPUS=8192 (e.g. Ubuntu 16.04 and 18.04 use this):

    drivers/hv//channel_mgmt.c: In function ‘init_vp_index’:
    drivers/hv//channel_mgmt.c:702:1: warning: the frame size of 1032 bytes
    is larger than 1024 bytes [-Wframe-larger-than=]

    Nowadays it looks most distros enable CONFIG_CPUMASK_OFFSTACK=y, and
    hence we can work around the warning by using cpumask_var_t.

    Signed-off-by: Dexuan Cui
    Cc: K. Y. Srinivasan
    Cc: Haiyang Zhang
    Cc: Stephen Hemminger
    Cc:
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Dexuan Cui
     

10 Oct, 2018

1 commit

  • commit 41e270f6898e7502be9fd6920ee0a108ca259d36 upstream.

    With CONFIG_DEBUG_PREEMPT=y, I always see this warning:
    BUG: using smp_processor_id() in preemptible [00000000]

    Fix the false warning by using get/put_cpu().

    Here vmbus_connect() sends a message to the host and waits for the
    host's response. The host will deliver the response message and an
    interrupt on CPU msg->target_vcpu, and later the interrupt handler
    will wake up vmbus_connect(). vmbus_connect() doesn't really have
    to run on the same cpu as CPU msg->target_vcpu, so it's safe to
    call put_cpu() just here.

    Signed-off-by: Dexuan Cui
    Cc: stable@vger.kernel.org
    Cc: K. Y. Srinivasan
    Cc: Haiyang Zhang
    Cc: Stephen Hemminger
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Dexuan Cui
     

20 Sep, 2018

1 commit

  • [ Upstream commit 572086325ce9a9e348b8748e830653f3959e88b6 ]

    clk_evt memory is not being freed when the synic is shutdown
    or when there is an allocation error. Add the appropriate
    kfree() call, along with a comment to clarify how the memory
    gets freed after an allocation error. Make the free path
    consistent by removing checks for NULL since kfree() and
    free_page() already do the check.

    Signed-off-by: Michael Kelley
    Reported-by: Dan Carpenter
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Michael Kelley
     

10 Sep, 2018

1 commit

  • commit d3b26dd7cb0e3433bfd3c1d4dcf74c6039bb49fb upstream.

    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 .

    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: Dexuan Cui
    Reviewed-by: Michael Kelley
    Cc: stable@vger.kernel.org
    Cc: K. Y. Srinivasan
    Cc: Stephen Hemminger
    Cc: Michael Kelley
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Dexuan Cui
     

19 Apr, 2018

1 commit

  • commit 238064f13d057390a8c5e1a6a80f4f0a0ec46499 upstream.

    The pci-hyperv driver's channel callback hv_pci_onchannelcallback() is not
    really a hot path, so we don't need to mark it as a perf_device, meaning
    with this patch all HV_PCIE channels' target_cpu will be CPU0.

    Signed-off-by: Dexuan Cui
    Cc: stable@vger.kernel.org
    Cc: Stephen Hemminger
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Greg Kroah-Hartman

    Dexuan Cui
     

29 Mar, 2018

1 commit

  • commit 655296c8bbeffcf020558c4455305d597a73bde1 upstream.

    Fix bugs in signaling the Hyper-V host when freeing space in the
    host->guest ring buffer:

    1. The interrupt_mask must not be used to determine whether to signal
    on the host->guest ring buffer
    2. The ring buffer write_index must be read (via hv_get_bytes_to_write)
    *after* pending_send_sz is read in order to avoid a race condition
    3. Comparisons with pending_send_sz must treat the "equals" case as
    not-enough-space
    4. Don't signal if the pending_send_sz feature is not present. Older
    versions of Hyper-V that don't implement this feature will poll.

    Fixes: 03bad714a161 ("vmbus: more host signalling avoidance")

    Cc: Stable # 4.14 and above
    Signed-off-by: Michael Kelley
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Michael Kelley
     

25 Dec, 2017

1 commit

  • commit 03b2a320b19f1424e9ac9c21696be9c60b6d0d93 upstream.

    The x86_hyper pointer is only used for checking whether a virtual
    device is supporting the hypervisor the system is running on.

    Use an enum for that purpose instead and drop the x86_hyper pointer.

    Signed-off-by: Juergen Gross
    Acked-by: Thomas Gleixner
    Acked-by: Xavier Deguillard
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: akataria@vmware.com
    Cc: arnd@arndb.de
    Cc: boris.ostrovsky@oracle.com
    Cc: devel@linuxdriverproject.org
    Cc: dmitry.torokhov@gmail.com
    Cc: gregkh@linuxfoundation.org
    Cc: haiyangz@microsoft.com
    Cc: kvm@vger.kernel.org
    Cc: kys@microsoft.com
    Cc: linux-graphics-maintainer@vmware.com
    Cc: linux-input@vger.kernel.org
    Cc: moltmann@vmware.com
    Cc: pbonzini@redhat.com
    Cc: pv-drivers@vmware.com
    Cc: rkrcmar@redhat.com
    Cc: sthemmin@microsoft.com
    Cc: virtualization@lists.linux-foundation.org
    Cc: xen-devel@lists.xenproject.org
    Link: http://lkml.kernel.org/r/20171109132739.23465-3-jgross@suse.com
    Signed-off-by: Ingo Molnar
    Signed-off-by: Greg Kroah-Hartman

    Juergen Gross
     

14 Dec, 2017

1 commit

  • commit 7fa32e5ec28b1609abc0b797b58267f725fc3964 upstream.

    The current rescind processing code will not correctly handle
    the case where the host immediately rescinds a channel that has
    been offerred. In this case, we could be blocked in the open call and
    since the channel is rescinded, the host will not respond and we could
    be blocked forever in the vmbus open call.i Fix this problem.

    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    K. Y. Srinivasan
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

20 Oct, 2017

1 commit

  • Without the patch, vmbus_hvsock_device_unregister() can destroy the device
    prematurely when close() is called, and can cause NULl dereferencing or
    potential data loss (the last portion of the data stream may be dropped
    prematurely).

    Signed-off-by: Dexuan Cui
    Cc: Haiyang Zhang
    Cc: Stephen Hemminger
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Dexuan Cui
     

04 Oct, 2017

1 commit

  • This patch addresses the following bugs in the current rescind handling code:

    1. Fixes a race condition where we may be invoking hv_process_channel_removal()
    on an already freed channel.

    2. Prevents indefinite wait when rescinding sub-channels by correctly setting
    the probe_complete state.

    I would like to thank Dexuan for patiently reviewing earlier versions of this
    patch and identifying many of the issues fixed here.

    Greg, please apply this to 4.14-final.

    Fixes: '54a66265d675 ("Drivers: hv: vmbus: Fix rescind handling")'

    Signed-off-by: K. Y. Srinivasan
    Reviewed-by: Dexuan Cui
    Cc: stable@vger.kernel.org # (4.13 and above)
    Signed-off-by: Greg Kroah-Hartman

    K. Y. Srinivasan
     

22 Sep, 2017

2 commits

  • Till recently the expected length of bytes read by the
    daemon did depend on the context. It was either hv_start_fcopy or
    hv_do_fcopy. The daemon had a buffer size of two pages, which was much
    larger than needed.

    Now the expected length of bytes read by the
    daemon changed slightly. For START_FILE_COPY it is still the size of
    hv_start_fcopy. But for WRITE_TO_FILE and the other operations it is as
    large as the buffer that arrived via vmbus. In case of WRITE_TO_FILE
    that is slightly larger than a struct hv_do_fcopy. Since the buffer in
    the daemon was still larger everything was fine.

    Currently, the daemon reads only what is actually needed.
    The new buffer layout is as large as a struct hv_do_fcopy, for the
    WRITE_TO_FILE operation. Since the kernel expects a slightly larger
    size, hvt_op_read will return -EINVAL because the daemon will read
    slightly less than expected. Address this by restoring the expected
    buffer size in case of WRITE_TO_FILE.

    Fixes: 'c7e490fc23eb ("Drivers: hv: fcopy: convert to hv_utils_transport")'
    Fixes: '3f2baa8a7d2e ("Tools: hv: update buffer handling in hv_fcopy_daemon")'

    Signed-off-by: Olaf Hering
    Signed-off-by: K. Y. Srinivasan
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Olaf Hering
     
  • Due to commit 54a66265d675 ("Drivers: hv: vmbus: Fix rescind handling"),
    we need this patch to resolve the below deadlock:

    after we get the mutex in vmbus_hvsock_device_unregister() and call
    vmbus_device_unregister() -> device_unregister() -> ... -> device_release()
    -> vmbus_device_release(), we'll get a deadlock, because
    vmbus_device_release() tries to get the same mutex.

    Signed-off-by: Dexuan Cui
    Cc: K. Y. Srinivasan
    Cc: Haiyang Zhang
    Cc: Stephen Hemminger
    Signed-off-by: K. Y. Srinivasan
    Cc: stable@vger.kernel.org (4.13 and above)
    Signed-off-by: Greg Kroah-Hartman

    Dexuan Cui
     

08 Sep, 2017

1 commit

  • Pull x86 platform updates from Ingo Molnar:
    "The main changes include various Hyper-V optimizations such as faster
    hypercalls and faster/better TLB flushes - and there's also some
    Intel-MID cleanups"

    * 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    tracing/hyper-v: Trace hyperv_mmu_flush_tlb_others()
    x86/hyper-v: Support extended CPU ranges for TLB flush hypercalls
    x86/platform/intel-mid: Make several arrays static, to make code smaller
    MAINTAINERS: Add missed file for Hyper-V
    x86/hyper-v: Use hypercall for remote TLB flush
    hyper-v: Globalize vp_index
    x86/hyper-v: Implement rep hypercalls
    hyper-v: Use fast hypercall for HVCALL_SIGNAL_EVENT
    x86/hyper-v: Introduce fast hypercall implementation
    x86/hyper-v: Make hv_do_hypercall() inline
    x86/hyper-v: Include hyperv/ only when CONFIG_HYPERV is set
    x86/platform/intel-mid: Make 'bt_sfi_data' const
    x86/platform/intel-mid: Make IRQ allocation a bit more flexible
    x86/platform/intel-mid: Group timers callbacks together

    Linus Torvalds
     

07 Sep, 2017

1 commit

  • Pull networking updates from David Miller:

    1) Support ipv6 checksum offload in sunvnet driver, from Shannon
    Nelson.

    2) Move to RB-tree instead of custom AVL code in inetpeer, from Eric
    Dumazet.

    3) Allow generic XDP to work on virtual devices, from John Fastabend.

    4) Add bpf device maps and XDP_REDIRECT, which can be used to build
    arbitrary switching frameworks using XDP. From John Fastabend.

    5) Remove UFO offloads from the tree, gave us little other than bugs.

    6) Remove the IPSEC flow cache, from Florian Westphal.

    7) Support ipv6 route offload in mlxsw driver.

    8) Support VF representors in bnxt_en, from Sathya Perla.

    9) Add support for forward error correction modes to ethtool, from
    Vidya Sagar Ravipati.

    10) Add time filter for packet scheduler action dumping, from Jamal Hadi
    Salim.

    11) Extend the zerocopy sendmsg() used by virtio and tap to regular
    sockets via MSG_ZEROCOPY. From Willem de Bruijn.

    12) Significantly rework value tracking in the BPF verifier, from Edward
    Cree.

    13) Add new jump instructions to eBPF, from Daniel Borkmann.

    14) Rework rtnetlink plumbing so that operations can be run without
    taking the RTNL semaphore. From Florian Westphal.

    15) Support XDP in tap driver, from Jason Wang.

    16) Add 32-bit eBPF JIT for ARM, from Shubham Bansal.

    17) Add Huawei hinic ethernet driver.

    18) Allow to report MD5 keys in TCP inet_diag dumps, from Ivan
    Delalande.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1780 commits)
    i40e: point wb_desc at the nvm_wb_desc during i40e_read_nvm_aq
    i40e: avoid NVM acquire deadlock during NVM update
    drivers: net: xgene: Remove return statement from void function
    drivers: net: xgene: Configure tx/rx delay for ACPI
    drivers: net: xgene: Read tx/rx delay for ACPI
    rocker: fix kcalloc parameter order
    rds: Fix non-atomic operation on shared flag variable
    net: sched: don't use GFP_KERNEL under spin lock
    vhost_net: correctly check tx avail during rx busy polling
    net: mdio-mux: add mdio_mux parameter to mdio_mux_init()
    rxrpc: Make service connection lookup always check for retry
    net: stmmac: Delete dead code for MDIO registration
    gianfar: Fix Tx flow control deactivation
    cxgb4: Ignore MPS_TX_INT_CAUSE[Bubble] for T6
    cxgb4: Fix pause frame count in t4_get_port_stats
    cxgb4: fix memory leak
    tun: rename generic_xdp to skb_xdp
    tun: reserve extra headroom only when XDP is set
    net: dsa: bcm_sf2: Configure IMP port TC2QOS mapping
    net: dsa: bcm_sf2: Advertise number of egress queues
    ...

    Linus Torvalds
     

17 Aug, 2017

8 commits

  • The only usage of vmbus_sendpacket_ctl was by vmbus_sendpacket.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    stephen hemminger
     
  • The function vmbus_sendpacket_pagebuffer_ctl was never used directly.
    Just have vmbus_send_pagebuffer

    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    stephen hemminger
     
  • This function is not used anywhere in current code.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    stephen hemminger
     
  • This patch handles the following issues that were observed when we are
    handling racing channel offer message and rescind message for the same
    offer:

    1. Since the host does not respond to messages on a rescinded channel,
    in the current code, we could be indefinitely blocked on the vmbus_open() call.

    2. When a rescinded channel is being closed, if there is a pending interrupt on the
    channel, we could end up freeing the channel that the interrupt handler would run on.

    Signed-off-by: K. Y. Srinivasan
    Reviewed-by: Dexuan Cui
    Tested-by: Dexuan Cui
    Signed-off-by: Greg Kroah-Hartman

    K. Y. Srinivasan
     
  • There's a bug which passes the output buffer size as MAX_IP_ADDR_SIZE,
    when converting the adapter_id field to UTF16. This is much larger than
    the actual size (MAX_ADAPTER_ID_SIZE). Fix this by passing the proper
    size.

    Fortunately, the translation is limited by the length of the input. This
    explains why we haven't seen output buffer overflow conditions.

    Signed-off-by: Alex Ng
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Alex Ng
     
  • When left uninitialized, this sometimes fails the following check in
    post_status():

    if (!time_after(now, (last_post_time + HZ))) {
    return;
    }

    This causes unnecessary delays in reporting memory pressure to host after
    booting up.

    Signed-off-by: Alex Ng
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Alex Ng
     
  • Previously we were only showing max number of pages. We should make it
    more clear that this value is the max amount of dynamic memory that the
    Hyper-V host is willing to assign to this guest.

    Signed-off-by: Alex Ng
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Alex Ng
     
  • Previously, num_pages_onlined was updated using value from memory online
    notifier. This is incorrect because they assume that all hot-added pages
    are online, even though we only online the amount that's backed by the
    host. We should update num_pages_onlined only when the balloon driver
    marks a page as online.

    Signed-off-by: Alex Ng
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Alex Ng
     

11 Aug, 2017

1 commit

  • Hyper-V host can suggest us to use hypercall for doing remote TLB flush,
    this is supposed to work faster than IPIs.

    Implementation details: to do HvFlushVirtualAddress{Space,List} hypercalls
    we need to put the input somewhere in memory and we don't really want to
    have memory allocation on each call so we pre-allocate per cpu memory areas
    on boot.

    pv_ops patching is happening very early so we need to separate
    hyperv_setup_mmu_ops() and hyper_alloc_mmu().

    It is possible and easy to implement local TLB flushing too and there is
    even a hint for that. However, I don't see a room for optimization on the
    host side as both hypercall and native tlb flush will result in vmexit. The
    hint is also not set on modern Hyper-V versions.

    Signed-off-by: Vitaly Kuznetsov
    Reviewed-by: Andy Shevchenko
    Reviewed-by: Stephen Hemminger
    Cc: Andy Lutomirski
    Cc: Haiyang Zhang
    Cc: Jork Loeser
    Cc: K. Y. Srinivasan
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Simon Xiao
    Cc: Steven Rostedt
    Cc: Thomas Gleixner
    Cc: devel@linuxdriverproject.org
    Link: http://lkml.kernel.org/r/20170802160921.21791-8-vkuznets@redhat.com
    Signed-off-by: Ingo Molnar

    Vitaly Kuznetsov
     

10 Aug, 2017

3 commits

  • To support implementing remote TLB flushing on Hyper-V with a hypercall
    we need to make vp_index available outside of vmbus module. Rename and
    globalize.

    Signed-off-by: Vitaly Kuznetsov
    Reviewed-by: Andy Shevchenko
    Reviewed-by: Stephen Hemminger
    Cc: Andy Lutomirski
    Cc: Haiyang Zhang
    Cc: Jork Loeser
    Cc: K. Y. Srinivasan
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Simon Xiao
    Cc: Steven Rostedt
    Cc: Thomas Gleixner
    Cc: devel@linuxdriverproject.org
    Link: http://lkml.kernel.org/r/20170802160921.21791-7-vkuznets@redhat.com
    Signed-off-by: Ingo Molnar

    Vitaly Kuznetsov
     
  • We need to pass only 8 bytes of input for HvSignalEvent which makes it a
    perfect fit for fast hypercall. hv_input_signal_event_buffer is not needed
    any more and hv_input_signal_event is converted to union for convenience.

    Signed-off-by: Vitaly Kuznetsov
    Reviewed-by: Andy Shevchenko
    Reviewed-by: Stephen Hemminger
    Cc: Andy Lutomirski
    Cc: Haiyang Zhang
    Cc: Jork Loeser
    Cc: K. Y. Srinivasan
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Simon Xiao
    Cc: Steven Rostedt
    Cc: Thomas Gleixner
    Cc: devel@linuxdriverproject.org
    Link: http://lkml.kernel.org/r/20170802160921.21791-5-vkuznets@redhat.com
    Signed-off-by: Ingo Molnar

    Vitaly Kuznetsov
     
  • We have only three call sites for hv_do_hypercall() and we're going to
    change HVCALL_SIGNAL_EVENT to doing fast hypercall so we can inline this
    function for optimization.

    Hyper-V top level functional specification states that r9-r11 registers
    and flags may be clobbered by the hypervisor during hypercall and with
    inlining this is somewhat important, add the clobbers.

    Signed-off-by: Vitaly Kuznetsov
    Reviewed-by: Andy Shevchenko
    Reviewed-by: Stephen Hemminger
    Cc: Andy Lutomirski
    Cc: Haiyang Zhang
    Cc: Jork Loeser
    Cc: K. Y. Srinivasan
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Simon Xiao
    Cc: Steven Rostedt
    Cc: Thomas Gleixner
    Cc: devel@linuxdriverproject.org
    Link: http://lkml.kernel.org/r/20170802160921.21791-3-vkuznets@redhat.com
    Signed-off-by: Ingo Molnar

    Vitaly Kuznetsov
     

24 Jul, 2017

1 commit


17 Jul, 2017

6 commits

  • When iterating over incoming ring elements from the host, prefetch
    the next descriptor so that it is cache hot.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Stephen Hemminger
     
  • Don't signal host if it has disabled interrupts for that
    ring buffer. Check the feature bit to see if host supports
    pending send size flag.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Stephen Hemminger
     
  • Don't need cached read index anymore now that packet iterator
    is used. The iterator has the original read index until the
    visible read_index is updated.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Stephen Hemminger
     
  • The function hv_signal_on_read was defined in hyperv.h and
    only used in one place in ring_buffer code. Clearer to just
    move it inline there.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Stephen Hemminger
     
  • With new iterator functions (and the double mapping) the ring buffer
    read function can be greatly simplified.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Stephen Hemminger
     
  • This problem shows up in 4.11 when netvsc driver is removed and reloaded.
    The problem is that the channel is closed during module removal and the
    tasklet for processing responses is disabled. When module is reloaded
    the channel is reopened but the tasklet is marked as disabled.
    The fix is to re-enable tasklet at the end of close which gets it back
    to the initial state.

    The issue is less urgent in 4.12 since network driver now uses NAPI
    and not the tasklet; and other VMBUS devices are rarely unloaded/reloaded.

    Fixes: dad72a1d2844 ("vmbus: remove hv_event_tasklet_disable/enable")

    Signed-off-by: Stephen Hemminger
    Signed-off-by: K. Y. Srinivasan
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Stephen Hemminger