aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/hv/Vmbus.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2010-01-08 12:06:40 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-01-20 18:05:26 -0500
commit7692fd4d441afac728cb83fdd33349d5ba07406c (patch)
treeb9cf1374bf424bcf46bf43d9ab5d9f36a59c5d0c /drivers/staging/hv/Vmbus.c
parentd31a2ff03f31cbecb92bdc5b1ab9d62fb70971d7 (diff)
Staging: hv: fix smp problems in the hyperv core code
This fixes a number of SMP problems that were in the hyperv core code. Patch originally written by K. Y. Srinivasan <ksrinivasan@novell.com> but forward ported to the latest in-kernel code and tweaked slightly by me. Novell, Inc. hereby disclaims all copyright in any derivative work copyright associated with this patch. Signed-off-by: K. Y. Srinivasan <ksrinivasan@novell.com> Cc: Hank Janssen <hjanssen@microsoft.com> Cc: Haiyang Zhang <haiyangz@microsoft.com>. Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/hv/Vmbus.c')
-rw-r--r--drivers/staging/hv/Vmbus.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/staging/hv/Vmbus.c b/drivers/staging/hv/Vmbus.c
index a4dd06f6d45..35a023e9f9d 100644
--- a/drivers/staging/hv/Vmbus.c
+++ b/drivers/staging/hv/Vmbus.c
@@ -129,7 +129,7 @@ static int VmbusOnDeviceAdd(struct hv_device *dev, void *AdditionalInfo)
129 129
130 /* strcpy(dev->name, "vmbus"); */ 130 /* strcpy(dev->name, "vmbus"); */
131 /* SynIC setup... */ 131 /* SynIC setup... */
132 ret = HvSynicInit(*irqvector); 132 on_each_cpu(HvSynicInit, (void *)irqvector, 1);
133 133
134 /* Connect to VMBus in the root partition */ 134 /* Connect to VMBus in the root partition */
135 ret = VmbusConnect(); 135 ret = VmbusConnect();
@@ -150,7 +150,7 @@ static int VmbusOnDeviceRemove(struct hv_device *dev)
150 DPRINT_ENTER(VMBUS); 150 DPRINT_ENTER(VMBUS);
151 VmbusChannelReleaseUnattachedChannels(); 151 VmbusChannelReleaseUnattachedChannels();
152 VmbusDisconnect(); 152 VmbusDisconnect();
153 HvSynicCleanup(); 153 on_each_cpu(HvSynicCleanup, NULL, 1);
154 DPRINT_EXIT(VMBUS); 154 DPRINT_EXIT(VMBUS);
155 155
156 return ret; 156 return ret;
@@ -173,7 +173,8 @@ static void VmbusOnCleanup(struct hv_driver *drv)
173 */ 173 */
174static void VmbusOnMsgDPC(struct hv_driver *drv) 174static void VmbusOnMsgDPC(struct hv_driver *drv)
175{ 175{
176 void *page_addr = gHvContext.synICMessagePage[0]; 176 int cpu = smp_processor_id();
177 void *page_addr = gHvContext.synICMessagePage[cpu];
177 struct hv_message *msg = (struct hv_message *)page_addr + 178 struct hv_message *msg = (struct hv_message *)page_addr +
178 VMBUS_MESSAGE_SINT; 179 VMBUS_MESSAGE_SINT;
179 struct hv_message *copied; 180 struct hv_message *copied;
@@ -230,11 +231,12 @@ static void VmbusOnEventDPC(struct hv_driver *drv)
230static int VmbusOnISR(struct hv_driver *drv) 231static int VmbusOnISR(struct hv_driver *drv)
231{ 232{
232 int ret = 0; 233 int ret = 0;
234 int cpu = smp_processor_id();
233 void *page_addr; 235 void *page_addr;
234 struct hv_message *msg; 236 struct hv_message *msg;
235 union hv_synic_event_flags *event; 237 union hv_synic_event_flags *event;
236 238
237 page_addr = gHvContext.synICMessagePage[0]; 239 page_addr = gHvContext.synICMessagePage[cpu];
238 msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT; 240 msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT;
239 241
240 DPRINT_ENTER(VMBUS); 242 DPRINT_ENTER(VMBUS);
@@ -248,7 +250,7 @@ static int VmbusOnISR(struct hv_driver *drv)
248 } 250 }
249 251
250 /* TODO: Check if there are events to be process */ 252 /* TODO: Check if there are events to be process */
251 page_addr = gHvContext.synICEventPage[0]; 253 page_addr = gHvContext.synICEventPage[cpu];
252 event = (union hv_synic_event_flags *)page_addr + VMBUS_MESSAGE_SINT; 254 event = (union hv_synic_event_flags *)page_addr + VMBUS_MESSAGE_SINT;
253 255
254 /* Since we are a child, we only need to check bit 0 */ 256 /* Since we are a child, we only need to check bit 0 */