Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1534217

[PATCH 09/15] hv: change clockevents unbind tactics

From kys@exchange.microsoft.com
Newsgroups linux.kernel
Subject [PATCH 09/15] hv: change clockevents unbind tactics
Date 2016-12-01 16:40 +0100
Message-ID <sJBCO-5Lz-29@gated-at.bofh.it> (permalink)
References <sJBCN-5Lz-9@gated-at.bofh.it> <sJBCN-5Lz-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Vitaly Kuznetsov <vkuznets@redhat.com>

To get prepared to CPU offlining support we need co change the way how we
unbind clockevent devices. As one CPU may go online/offline multiple times
we need to bind it in hv_synic_init() and unbind it in hv_synic_cleanup().
There is an additional corner case: when we unload the module completely we
need to switch to some other clockevent mechanism before stopping VMBus or
we will hang. We can't call hv_synic_cleanup() before unloading VMBus as
we won't be able to send UNLOAD request and get a response so
hv_synic_clockevents_cleanup() has to live. Luckily, we can always call
clockevents_unbind_device(), even if it wasn't bound before and there is
no issue if we call it twice.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 drivers/hv/hv.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index a2567a4..c11393c 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -575,7 +575,7 @@ void hv_synic_clockevents_cleanup(void)
 	if (!(ms_hyperv.features & HV_X64_MSR_SYNTIMER_AVAILABLE))
 		return;
 
-	for_each_online_cpu(cpu)
+	for_each_present_cpu(cpu)
 		clockevents_unbind_device(hv_context.clk_evt[cpu], cpu);
 }
 
@@ -594,8 +594,10 @@ void hv_synic_cleanup(void *arg)
 		return;
 
 	/* Turn off clockevent device */
-	if (ms_hyperv.features & HV_X64_MSR_SYNTIMER_AVAILABLE)
+	if (ms_hyperv.features & HV_X64_MSR_SYNTIMER_AVAILABLE) {
+		clockevents_unbind_device(hv_context.clk_evt[cpu], cpu);
 		hv_ce_shutdown(hv_context.clk_evt[cpu]);
+	}
 
 	rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, shared_sint.as_uint64);
 
-- 
1.7.4.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/15] Drivers: hv: CPU management fixes and a new uio driver  kys@exchange.microsoft.com - 2016-12-01 16:40 +0100
  [PATCH 01/15] Drivers: hv: vmbus: Raise retry/wait limits in vmbus_post_msg() kys@exchange.microsoft.com - 2016-12-01 16:40 +0100
    [PATCH 10/15] hv: switch to cpuhp state machine for synic init/cleanup kys@exchange.microsoft.com - 2016-12-01 16:40 +0100
    [PATCH 14/15] uio-hv-generic: new userspace i/o driver for VMBus kys@exchange.microsoft.com - 2016-12-01 16:40 +0100
    [PATCH 09/15] hv: change clockevents unbind tactics kys@exchange.microsoft.com - 2016-12-01 16:40 +0100
    [PATCH 15/15] Tools: hv: kvp: configurable external scripts path kys@exchange.microsoft.com - 2016-12-01 16:40 +0100
    [PATCH 06/15] hv: acquire vmbus_connection.channel_mutex in vmbus_free_channels() kys@exchange.microsoft.com - 2016-12-01 16:40 +0100
      Re: [PATCH 06/15] hv: acquire vmbus_connection.channel_mutex in  vmbus_free_channels() Greg KH <gregkh@linuxfoundation.org> - 2016-12-01 21:40 +0100
        RE: [PATCH 06/15] hv: acquire vmbus_connection.channel_mutex in  vmbus_free_channels() KY Srinivasan <kys@microsoft.com> - 2016-12-02 07:30 +0100
    [PATCH 03/15] hyperv: Fix spelling of HV_UNKOWN kys@exchange.microsoft.com - 2016-12-01 16:40 +0100
    [PATCH 11/15] hv: make CPU offlining prevention fine-grained kys@exchange.microsoft.com - 2016-12-01 16:40 +0100

csiph-web