1. 02 3月, 2015 6 次提交
    • V
      Drivers: hv: vmbus: Teardown clockevent devices on module unload · e086748c
      Vitaly Kuznetsov 提交于
      Newly introduced clockevent devices made it impossible to unload hv_vmbus
      module as clockevents_config_and_register() takes additional reverence to
      the module. To make it possible again we do the following:
      - avoid setting dev->owner for clockevent devices;
      - implement hv_synic_clockevents_cleanup() doing clockevents_unbind_device();
      - call it from vmbus_exit().
      
      In theory hv_synic_clockevents_cleanup() can be merged with hv_synic_cleanup(),
      however, we call hv_synic_cleanup() from smp_call_function_single() and this
      doesn't work for clockevents_unbind_device() as it does such call on its own. I
      opted for a separate function.
      Signed-off-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: NK. Y. Srinivasan <kys@microsoft.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e086748c
    • V
      drivers: hv: vmbus: Teardown synthetic interrupt controllers on module unload · e72e7ac5
      Vitaly Kuznetsov 提交于
      SynIC has to be switched off when we unload the module, otherwise registered
      memory pages can get corrupted after (as Hyper-V host still writes there) and
      we see the following crashes for random processes:
      
      [   89.116774] BUG: Bad page map in process sh  pte:4989c716 pmd:36f81067
      [   89.159454] addr:0000000000437000 vm_flags:00000875 anon_vma:          (null) mapping:ffff88007bba55a0 index:37
      [   89.226146] vma->vm_ops->fault: filemap_fault+0x0/0x410
      [   89.257776] vma->vm_file->f_op->mmap: generic_file_mmap+0x0/0x60
      [   89.297570] CPU: 0 PID: 215 Comm: sh Tainted: G    B          3.19.0-rc5_bug923184+ #488
      [   89.353738] Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS 090006  05/23/2012
      [   89.409138]  0000000000000000 000000004e083d7b ffff880036e9fa18 ffffffff81a68d31
      [   89.468724]  0000000000000000 0000000000437000 ffff880036e9fa68 ffffffff811a1e3a
      [   89.519233]  000000004989c716 0000000000000037 ffffea0001edc340 0000000000437000
      [   89.575751] Call Trace:
      [   89.591060]  [<ffffffff81a68d31>] dump_stack+0x45/0x57
      [   89.625164]  [<ffffffff811a1e3a>] print_bad_pte+0x1aa/0x250
      [   89.667234]  [<ffffffff811a2c95>] vm_normal_page+0x55/0xa0
      [   89.703818]  [<ffffffff811a3105>] unmap_page_range+0x425/0x8a0
      [   89.737982]  [<ffffffff811a3601>] unmap_single_vma+0x81/0xf0
      [   89.780385]  [<ffffffff81184320>] ? lru_deactivate_fn+0x190/0x190
      [   89.820130]  [<ffffffff811a4131>] unmap_vmas+0x51/0xa0
      [   89.860168]  [<ffffffff811ad12c>] exit_mmap+0xac/0x1a0
      [   89.890588]  [<ffffffff810763c3>] mmput+0x63/0x100
      [   89.919205]  [<ffffffff811eba48>] flush_old_exec+0x3f8/0x8b0
      [   89.962135]  [<ffffffff8123b5bb>] load_elf_binary+0x32b/0x1260
      [   89.998581]  [<ffffffff811a14f2>] ? get_user_pages+0x52/0x60
      
      hv_synic_cleanup() function exists but noone calls it now. Do the following:
      - call hv_synic_cleanup() on each cpu from vmbus_exit();
      - write global disable bit through MSR;
      - use hv_synic_free_cpu() to avoid memory leask and code duplication.
      Signed-off-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: NK. Y. Srinivasan <kys@microsoft.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e72e7ac5
    • V
      Drivers: hv: vmbus: teardown hv_vmbus_con workqueue and vmbus_connection pages on shutdown · 09a19628
      Vitaly Kuznetsov 提交于
      We need to destroy hv_vmbus_con on module shutdown, otherwise the following
      crash is sometimes observed:
      
      [   76.569845] hv_vmbus: Hyper-V Host Build:9600-6.3-17-0.17039; Vmbus version:3.0
      [   82.598859] BUG: unable to handle kernel paging request at ffffffffa0003480
      [   82.599287] IP: [<ffffffffa0003480>] 0xffffffffa0003480
      [   82.599287] PGD 1f34067 PUD 1f35063 PMD 3f72d067 PTE 0
      [   82.599287] Oops: 0010 [#1] SMP
      [   82.599287] Modules linked in: [last unloaded: hv_vmbus]
      [   82.599287] CPU: 0 PID: 26 Comm: kworker/0:1 Not tainted 3.19.0-rc5_bug923184+ #488
      [   82.599287] Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS Hyper-V UEFI Release v1.0 11/26/2012
      [   82.599287] Workqueue: hv_vmbus_con 0xffffffffa0003480
      [   82.599287] task: ffff88007b6ddfa0 ti: ffff88007f8f8000 task.ti: ffff88007f8f8000
      [   82.599287] RIP: 0010:[<ffffffffa0003480>]  [<ffffffffa0003480>] 0xffffffffa0003480
      [   82.599287] RSP: 0018:ffff88007f8fbe00  EFLAGS: 00010202
      ...
      
      To avoid memory leaks we need to free monitor_pages and int_page for
      vmbus_connection. Implement vmbus_disconnect() function by separating cleanup
      path from vmbus_connect().
      
      As we use hv_vmbus_con to release channels (see free_channel() in channel_mgmt.c)
      we need to make sure the work was done before we remove the queue, do that with
      drain_workqueue(). We also need to avoid handling messages  which can (potentially)
      create new channels, so set vmbus_connection.conn_state = DISCONNECTED at the very
      beginning of vmbus_exit() and check for that in vmbus_onmessage_work().
      Signed-off-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: NK. Y. Srinivasan <kys@microsoft.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      09a19628
    • V
      Drivers: hv: vmbus: avoid double kfree for device_obj · adcde069
      Vitaly Kuznetsov 提交于
      On driver shutdown device_obj is being freed twice:
      1) In vmbus_free_channels()
      2) vmbus_device_release() (which is being triggered by device_unregister() in
         vmbus_device_unregister().
      This double kfree leads to the following sporadic crash on driver unload:
      
      [   23.469876] general protection fault: 0000 [#1] SMP
      [   23.470036] Modules linked in: hv_vmbus(-)
      [   23.470036] CPU: 2 PID: 213 Comm: rmmod Not tainted 3.19.0-rc5_bug923184+ #488
      [   23.470036] Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS 090006  05/23/2012
      [   23.470036] task: ffff880036ef1cb0 ti: ffff880036ce8000 task.ti: ffff880036ce8000
      [   23.470036] RIP: 0010:[<ffffffff811d2e1b>]  [<ffffffff811d2e1b>] __kmalloc_node_track_caller+0xdb/0x1e0
      [   23.470036] RSP: 0018:ffff880036cebcc8  EFLAGS: 00010246
      ...
      
      When this crash does not happen on driver unload the similar one is expected if
      we try to load hv_vmbus again.
      
      Remove kfree from vmbus_free_channels() as freeing it from
      vmbus_device_release() seems right.
      Signed-off-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: NK. Y. Srinivasan <kys@microsoft.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      adcde069
    • V
      Drivers: hv: vmbus: rename channel work queues · bc63b6f6
      Vitaly Kuznetsov 提交于
      All channel work queues are named 'hv_vmbus_ctl', this makes them
      indistinguishable in ps output and makes it hard to link to the corresponding
      vmbus device. Rename them to hv_vmbus_ctl/N and make vmbus device names match,
      e.g. now vmbus_1 device is served by hv_vmbus_ctl/1 work queue.
      Signed-off-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: NK. Y. Srinivasan <kys@microsoft.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bc63b6f6
    • V
      Drivers: hv: vmbus: prevent cpu offlining on newer hypervisors · e513229b
      Vitaly Kuznetsov 提交于
      When an SMP Hyper-V guest is running on top of 2012R2 Server and secondary
      cpus are sent offline (with echo 0 > /sys/devices/system/cpu/cpu$cpu/online)
      the system freeze is observed. This happens due to the fact that on newer
      hypervisors (Win8, WS2012R2, ...) vmbus channel handlers are distributed
      across all cpus (see init_vp_index() function in drivers/hv/channel_mgmt.c)
      and on cpu offlining nobody reassigns them to CPU0. Prevent cpu offlining
      when vmbus is loaded until the issue is fixed host-side.
      
      This patch also disables hibernation but it is OK as it is also broken (MCE
      error is hit on resume). Suspend still works.
      
      Tested with WS2008R2 and WS2012R2.
      Signed-off-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: NK. Y. Srinivasan <kys@microsoft.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e513229b
  2. 26 1月, 2015 12 次提交
  3. 12 1月, 2015 1 次提交
  4. 09 12月, 2014 1 次提交
  5. 27 11月, 2014 3 次提交
  6. 08 11月, 2014 1 次提交
    • V
      Drivers: hv: vmbus: Fix a race condition when unregistering a device · 04a258c1
      Vitaly Kuznetsov 提交于
      When build with Debug the following crash is sometimes observed:
      Call Trace:
       [<ffffffff812b9600>] string+0x40/0x100
       [<ffffffff812bb038>] vsnprintf+0x218/0x5e0
       [<ffffffff810baf7d>] ? trace_hardirqs_off+0xd/0x10
       [<ffffffff812bb4c1>] vscnprintf+0x11/0x30
       [<ffffffff8107a2f0>] vprintk+0xd0/0x5c0
       [<ffffffffa0051ea0>] ? vmbus_process_rescind_offer+0x0/0x110 [hv_vmbus]
       [<ffffffff8155c71c>] printk+0x41/0x45
       [<ffffffffa004ebac>] vmbus_device_unregister+0x2c/0x40 [hv_vmbus]
       [<ffffffffa0051ecb>] vmbus_process_rescind_offer+0x2b/0x110 [hv_vmbus]
      ...
      
      This happens due to the following race: between 'if (channel->device_obj)' check
      in vmbus_process_rescind_offer() and pr_debug() in vmbus_device_unregister() the
      device can disappear. Fix the issue by taking an additional reference to the
      device before proceeding to vmbus_device_unregister().
      Signed-off-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: NK. Y. Srinivasan <kys@microsoft.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      04a258c1
  7. 24 9月, 2014 8 次提交
  8. 18 7月, 2014 1 次提交
  9. 10 7月, 2014 3 次提交
  10. 04 6月, 2014 1 次提交
  11. 29 5月, 2014 1 次提交
  12. 04 5月, 2014 2 次提交