2019-11-14 06:33:05

by Michael Kelley (LINUX)

[permalink] [raw]
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.

Signed-off-by: Michael Kelley <[email protected]>
---
drivers/hv/vmbus_drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 664a415..665920d 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -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();
};

--
1.8.3.1


2019-11-14 10:07:29

by Vitaly Kuznetsov

[permalink] [raw]
Subject: Re: [PATCH 1/1] Drivers: hv: vmbus: Fix crash handler reset of Hyper-V synic

Michael Kelley <[email protected]> writes:

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

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().

>
> Signed-off-by: Michael Kelley <[email protected]>
> ---
> drivers/hv/vmbus_drv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index 664a415..665920d 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -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();
> };

Reviewed-by: Vitaly Kuznetsov <[email protected]>

--
Vitaly

2019-11-15 06:58:31

by Dexuan Cui

[permalink] [raw]
Subject: RE: [PATCH 1/1] Drivers: hv: vmbus: Fix crash handler reset of Hyper-V synic

> 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.
>
> Signed-off-by: Michael Kelley <[email protected]>
> ---
> drivers/hv/vmbus_drv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index 664a415..665920d 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -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();
> };
>
> --

Reviewed-by: Dexuan Cui <[email protected]>

2019-11-19 13:27:56

by Sasha Levin

[permalink] [raw]
Subject: Re: [PATCH 1/1] Drivers: hv: vmbus: Fix crash handler reset of Hyper-V synic

On Thu, Nov 14, 2019 at 06:32:01AM +0000, Michael Kelley wrote:
>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.
>
>Signed-off-by: Michael Kelley <[email protected]>

Queued up, thank you.

--
Thanks,
Sasha