diff options
author | K. Y. Srinivasan <kys@microsoft.com> | 2014-07-07 19:34:25 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-07-09 17:34:35 -0400 |
commit | 9bd2d0dfe4714dd5d7c09a93a5c9ea9e14ceb3fc (patch) | |
tree | ba27cecb93c7af8695d6f68b5125053c82aa8955 /drivers/hv | |
parent | affb1aff300ddee54df307812b38f166e8a865ef (diff) |
Drivers: hv: util: Fix a bug in the KVP code
Add code to poll the channel since we process only one message
at a time and the host may not interrupt us. Also increase the
receive buffer size since some KVP messages are close to 8K bytes in size.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hv')
-rw-r--r-- | drivers/hv/hv_kvp.c | 17 | ||||
-rw-r--r-- | drivers/hv/hv_util.c | 2 |
2 files changed, 15 insertions, 4 deletions
diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c index ea852537307e..521c14625b3a 100644 --- a/drivers/hv/hv_kvp.c +++ b/drivers/hv/hv_kvp.c | |||
@@ -127,6 +127,17 @@ kvp_work_func(struct work_struct *dummy) | |||
127 | kvp_respond_to_host(NULL, HV_E_FAIL); | 127 | kvp_respond_to_host(NULL, HV_E_FAIL); |
128 | } | 128 | } |
129 | 129 | ||
130 | static void poll_channel(struct vmbus_channel *channel) | ||
131 | { | ||
132 | if (channel->target_cpu != smp_processor_id()) | ||
133 | smp_call_function_single(channel->target_cpu, | ||
134 | hv_kvp_onchannelcallback, | ||
135 | channel, true); | ||
136 | else | ||
137 | hv_kvp_onchannelcallback(channel); | ||
138 | } | ||
139 | |||
140 | |||
130 | static int kvp_handle_handshake(struct hv_kvp_msg *msg) | 141 | static int kvp_handle_handshake(struct hv_kvp_msg *msg) |
131 | { | 142 | { |
132 | int ret = 1; | 143 | int ret = 1; |
@@ -155,7 +166,7 @@ static int kvp_handle_handshake(struct hv_kvp_msg *msg) | |||
155 | kvp_register(dm_reg_value); | 166 | kvp_register(dm_reg_value); |
156 | kvp_transaction.active = false; | 167 | kvp_transaction.active = false; |
157 | if (kvp_transaction.kvp_context) | 168 | if (kvp_transaction.kvp_context) |
158 | hv_kvp_onchannelcallback(kvp_transaction.kvp_context); | 169 | poll_channel(kvp_transaction.kvp_context); |
159 | } | 170 | } |
160 | return ret; | 171 | return ret; |
161 | } | 172 | } |
@@ -568,7 +579,7 @@ response_done: | |||
568 | 579 | ||
569 | vmbus_sendpacket(channel, recv_buffer, buf_len, req_id, | 580 | vmbus_sendpacket(channel, recv_buffer, buf_len, req_id, |
570 | VM_PKT_DATA_INBAND, 0); | 581 | VM_PKT_DATA_INBAND, 0); |
571 | 582 | poll_channel(channel); | |
572 | } | 583 | } |
573 | 584 | ||
574 | /* | 585 | /* |
@@ -603,7 +614,7 @@ void hv_kvp_onchannelcallback(void *context) | |||
603 | return; | 614 | return; |
604 | } | 615 | } |
605 | 616 | ||
606 | vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 2, &recvlen, | 617 | vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 4, &recvlen, |
607 | &requestid); | 618 | &requestid); |
608 | 619 | ||
609 | if (recvlen > 0) { | 620 | if (recvlen > 0) { |
diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c index dd761806f0e8..3b9c9ef0deb8 100644 --- a/drivers/hv/hv_util.c +++ b/drivers/hv/hv_util.c | |||
@@ -319,7 +319,7 @@ static int util_probe(struct hv_device *dev, | |||
319 | (struct hv_util_service *)dev_id->driver_data; | 319 | (struct hv_util_service *)dev_id->driver_data; |
320 | int ret; | 320 | int ret; |
321 | 321 | ||
322 | srv->recv_buffer = kmalloc(PAGE_SIZE * 2, GFP_KERNEL); | 322 | srv->recv_buffer = kmalloc(PAGE_SIZE * 4, GFP_KERNEL); |
323 | if (!srv->recv_buffer) | 323 | if (!srv->recv_buffer) |
324 | return -ENOMEM; | 324 | return -ENOMEM; |
325 | if (srv->util_init) { | 325 | if (srv->util_init) { |