staging: hv: convert vmbus_on_msg_dpc to not call osd_schedule_callback
The additional abstraction is unneeded. This also fixes a sleeping while atomic issue as osd_schedule_callback can sleep which is not allowed for vmbus_on_msg_dpc running in a tasklet. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=16701 Reviewed-By: Hank Janssen <hjanssen@microsoft.com> Cc: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: Timo Teräs <timo.teras@iki.fi> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
f4528696d8
commit
bf6506f60c
2 changed files with 21 additions and 11 deletions
|
@ -753,7 +753,6 @@ void vmbus_onmessage(void *context)
|
||||||
hdr->msgtype, size);
|
hdr->msgtype, size);
|
||||||
print_hex_dump_bytes("", DUMP_PREFIX_NONE,
|
print_hex_dump_bytes("", DUMP_PREFIX_NONE,
|
||||||
(unsigned char *)msg->u.payload, size);
|
(unsigned char *)msg->u.payload, size);
|
||||||
kfree(msg);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -762,9 +761,6 @@ void vmbus_onmessage(void *context)
|
||||||
else
|
else
|
||||||
DPRINT_ERR(VMBUS, "Unhandled channel message type %d",
|
DPRINT_ERR(VMBUS, "Unhandled channel message type %d",
|
||||||
hdr->msgtype);
|
hdr->msgtype);
|
||||||
|
|
||||||
/* Free the msg that was allocated in VmbusOnMsgDPC() */
|
|
||||||
kfree(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -203,6 +203,21 @@ static void VmbusOnCleanup(struct hv_driver *drv)
|
||||||
hv_cleanup();
|
hv_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct onmessage_work_context {
|
||||||
|
struct work_struct work;
|
||||||
|
struct hv_message msg;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void vmbus_onmessage_work(struct work_struct *work)
|
||||||
|
{
|
||||||
|
struct onmessage_work_context *ctx;
|
||||||
|
|
||||||
|
ctx = container_of(work, struct onmessage_work_context,
|
||||||
|
work);
|
||||||
|
vmbus_onmessage(&ctx->msg);
|
||||||
|
kfree(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* vmbus_on_msg_dpc - DPC routine to handle messages from the hypervisior
|
* vmbus_on_msg_dpc - DPC routine to handle messages from the hypervisior
|
||||||
*/
|
*/
|
||||||
|
@ -212,20 +227,19 @@ static void vmbus_on_msg_dpc(struct hv_driver *drv)
|
||||||
void *page_addr = hv_context.synic_message_page[cpu];
|
void *page_addr = hv_context.synic_message_page[cpu];
|
||||||
struct hv_message *msg = (struct hv_message *)page_addr +
|
struct hv_message *msg = (struct hv_message *)page_addr +
|
||||||
VMBUS_MESSAGE_SINT;
|
VMBUS_MESSAGE_SINT;
|
||||||
struct hv_message *copied;
|
struct onmessage_work_context *ctx;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (msg->header.message_type == HVMSG_NONE) {
|
if (msg->header.message_type == HVMSG_NONE) {
|
||||||
/* no msg */
|
/* no msg */
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
copied = kmemdup(msg, sizeof(*copied), GFP_ATOMIC);
|
ctx = kmalloc(sizeof(*ctx), GFP_ATOMIC);
|
||||||
if (copied == NULL)
|
if (ctx == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
INIT_WORK(&ctx->work, vmbus_onmessage_work);
|
||||||
osd_schedule_callback(gVmbusConnection.WorkQueue,
|
memcpy(&ctx->msg, msg, sizeof(*msg));
|
||||||
vmbus_onmessage,
|
queue_work(gVmbusConnection.WorkQueue, &ctx->work);
|
||||||
(void *)copied);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
msg->header.message_type = HVMSG_NONE;
|
msg->header.message_type = HVMSG_NONE;
|
||||||
|
|
Loading…
Add table
Reference in a new issue