• Vitaly Kuznetsov's avatar
    Drivers: hv: vmbus: handle various crash scenarios · cd95aad5
    Vitaly Kuznetsov authored
    Kdump keeps biting. Turns out CHANNELMSG_UNLOAD_RESPONSE is always
    delivered to the CPU which was used for initial contact or to CPU0
    depending on host version. vmbus_wait_for_unload() doesn't account for
    the fact that in case we're crashing on some other CPU we won't get the
    CHANNELMSG_UNLOAD_RESPONSE message and our wait on the current CPU will
    never end.
    
    Do the following:
    1) Check for completion_done() in the loop. In case interrupt handler is
       still alive we'll get the confirmation we need.
    
    2) Read message pages for all CPUs message page as we're unsure where
       CHANNELMSG_UNLOAD_RESPONSE is going to be delivered to. We can race with
       still-alive interrupt handler doing the same, add cmpxchg() to
       vmbus_signal_eom() to not lose CHANNELMSG_UNLOAD_RESPONSE message.
    
    3) Cleanup message pages on all CPUs. This is required (at least for the
       current CPU as we're clearing CPU0 messages now but we may want to bring
       up additional CPUs on crash) as new messages won't be delivered till we
       consume what's pending. On boot we'll place message pages somewhere else
       and we won't be able to read stale messages.
    Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
    Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    cd95aad5
vmbus_drv.c 35.6 KB