Skip to contentSkip to conversation

Drivers: hv: vmbus: Fix crash handler reset of Hyper-V synic

PATCH Applied Michael Kelley 4 participants 4 messages Nov 14, 2019 – Nov 19, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Drivers: hv: vmbus: Fix crash handler reset of Hyper-V synic

The crash handler calls hv_synic_cleanup() to shutdown the Hyper-V synthetic interrupt controller. But if the CPU that calls hv_synic_cleanup() has a VMbus channel interrupt assigned to it (which is likely the case in smaller VM sizes), hv_synic_cleanup() returns an error and the synthetic interrupt controller isn't shutdown. While the lack of being shutdown hasn't caused a known problem, it still should be fixed for highest reliability.

So directly call hv_synic_disable_regs() instead of hv_synic_cleanup(), which ensures that the synic is always shutdown.

---
 drivers/hv/vmbus_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hv/vmbus_drv.c +1 -1
index 664a415..665920d 100644
@@ -2305,7 +2305,7 @@ static void hv_crash_handler(struct pt_regs *regs)
 	vmbus_connection.conn_state = DISCONNECTED;
 	cpu = smp_processor_id();
 	hv_stimer_cleanup(cpu);
-	hv_synic_cleanup(cpu);
+	hv_synic_disable_regs(cpu);
 	hyperv_cleanup();
 };
 
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Michael Kelley

The crash handler calls hv_synic_cleanup() to shutdown the Hyper-V synthetic interrupt controller. But if the CPU that calls hv_synic_cleanup() has a VMbus channel interrupt assigned to it (which is likely the case in smaller VM sizes), hv_synic_cleanup() returns an error and the synthetic interrupt controller isn't shutdown. While the lack of being shutdown hasn't caused a known problem, it still should be fixed for highest reliability.

Quoted 3 lines

So directly call hv_synic_disable_regs() instead of hv_synic_cleanup(), which ensures that the synic is always shutdown.

Generally, when performing kdump doing as little work as possible is always preferred and hv_synic_cleanup() does too much: taking mutex, walking through channel list,...

Also, hv_synic_cleanup() was calling hv_stimer_cleanup() and we have a second redundant invocation in hv_crash_handler().

Quoted 11 lines
---
 drivers/hv/vmbus_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hv/vmbus_drv.c +0 -0
index 664a415..665920d 100644

drivers/hv/vmbus_drv.c static void hv_crash_handler(struct pt_regs *regs) · line 2310

Quoted 7 lines
drivers/hv/vmbus_drv.c +1 -1
@@ -2305,7 +2305,7 @@ static void hv_crash_handler(struct pt_regs *regs)
 	vmbus_connection.conn_state = DISCONNECTED;
 	cpu = smp_processor_id();
 	hv_stimer_cleanup(cpu);
-	hv_synic_cleanup(cpu);
+	hv_synic_disable_regs(cpu);
 	hyperv_cleanup();
 };
Signature · 1 line
Vitaly
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Michael Kelley
Quoted 33 lines

From: Michael Kelley <[email protected]>
Sent: Wednesday, November 13, 2019 10:32 PM
To: [email protected]; vkuznets <[email protected]>; KY Srinivasan <[email protected]>; Stephen Hemminger <[email protected]>; [email protected]; Dexuan Cui <[email protected]>; [email protected]
Cc: Michael Kelley <[email protected]>
Subject: [PATCH 1/1] Drivers: hv: vmbus: Fix crash handler reset of Hyper-V synic

The crash handler calls hv_synic_cleanup() to shutdown the Hyper-V synthetic interrupt controller. But if the CPU that calls hv_synic_cleanup() has a VMbus channel interrupt assigned to it (which is likely the case in smaller VM sizes), hv_synic_cleanup() returns an error and the synthetic interrupt controller isn't shutdown. While the lack of being shutdown hasn't caused a known problem, it still should be fixed for highest reliability.

So directly call hv_synic_disable_regs() instead of hv_synic_cleanup(), which ensures that the synic is always shutdown.

---
 drivers/hv/vmbus_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hv/vmbus_drv.c +0 -0
index 664a415..665920d 100644

drivers/hv/vmbus_drv.c static void hv_crash_handler(struct pt_regs *regs)

Quoted 9 lines
drivers/hv/vmbus_drv.c +1 -2
@@ -2305,7 +2305,7 @@ static void hv_crash_handler(struct pt_regs *regs)
 	vmbus_connection.conn_state = DISCONNECTED;
 	cpu = smp_processor_id();
 	hv_stimer_cleanup(cpu);
-	hv_synic_cleanup(cpu);
+	hv_synic_disable_regs(cpu);
 	hyperv_cleanup();
 };
 
--
Applied
#3 lore raw
In reply to Michael Kelley
Quoted 9 lines · Michael Kelley

The crash handler calls hv_synic_cleanup() to shutdown the Hyper-V synthetic interrupt controller. But if the CPU that calls hv_synic_cleanup() has a VMbus channel interrupt assigned to it (which is likely the case in smaller VM sizes), hv_synic_cleanup() returns an error and the synthetic interrupt controller isn't shutdown. While the lack of being shutdown hasn't caused a known problem, it still should be fixed for highest reliability.

Quoted 5 lines

So directly call hv_synic_disable_regs() instead of hv_synic_cleanup(), which ensures that the synic is always shutdown.

Queued up, thank you.

Signature · 2 lines
Thanks,
Sasha