linux-stable/drivers/hv
Michael Kelley 80c5d97b4a Drivers: hv: vmbus: Fix vmbus_wait_for_unload() to scan present CPUs
commit 320805ab61 upstream.

vmbus_wait_for_unload() may be called in the panic path after other
CPUs are stopped. vmbus_wait_for_unload() currently loops through
online CPUs looking for the UNLOAD response message. But the values of
CONFIG_KEXEC_CORE and crash_kexec_post_notifiers affect the path used
to stop the other CPUs, and in one of the paths the stopped CPUs
are removed from cpu_online_mask. This removal happens in both
x86/x64 and arm64 architectures. In such a case, vmbus_wait_for_unload()
only checks the panic'ing CPU, and misses the UNLOAD response message
except when the panic'ing CPU is CPU 0. vmbus_wait_for_unload()
eventually times out, but only after waiting 100 seconds.

Fix this by looping through *present* CPUs in vmbus_wait_for_unload().
The cpu_present_mask is not modified by stopping the other CPUs in the
panic path, nor should it be.

Also, in a CoCo VM the synic_message_page is not allocated in
hv_synic_alloc(), but is set and cleared in hv_synic_enable_regs()
and hv_synic_disable_regs() such that it is set only when the CPU is
online.  If not all present CPUs are online when vmbus_wait_for_unload()
is called, the synic_message_page might be NULL. Add a check for this.

Fixes: cd95aad557 ("Drivers: hv: vmbus: handle various crash scenarios")
Cc: stable@vger.kernel.org
Reported-by: John Starks <jostarks@microsoft.com>
Signed-off-by: Michael Kelley <mikelley@microsoft.com>
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Link: https://lore.kernel.org/r/1684422832-38476-1-git-send-email-mikelley@microsoft.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-28 10:29:42 +02:00
..
Kconfig hv: utils: add PTP_1588_CLOCK to Kconfig to fix build 2022-04-08 14:22:46 +02:00
Makefile
channel.c Drivers: hv: vmbus: Fix handling of messages with transaction ID of zero 2022-06-09 10:23:07 +02:00
channel_mgmt.c Drivers: hv: vmbus: Fix vmbus_wait_for_unload() to scan present CPUs 2023-06-28 10:29:42 +02:00
connection.c Drivers: vmbus: Check for channel allocation before looking up relids 2023-04-13 16:48:17 +02:00
hv.c
hv_balloon.c Drivers: hv: balloon: Support status report for larger page sizes 2022-09-05 10:30:04 +02:00
hv_common.c
hv_debugfs.c
hv_fcopy.c
hv_kvp.c
hv_snapshot.c
hv_trace.c
hv_trace.h
hv_trace_balloon.h
hv_util.c
hv_utils_transport.c
hv_utils_transport.h
hyperv_vmbus.h
ring_buffer.c video: hyperv_fb: Avoid taking busy spinlock on panic path 2022-12-31 13:14:39 +01:00
vmbus_drv.c Drivers: hv: vmbus: Call hv_synic_free() if hv_synic_alloc() fails 2023-06-28 10:29:42 +02:00