From f7d33dfef2eb072a0a2396a4cca6b521918a1a88 Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Thu, 25 Feb 2016 09:27:50 +0000 Subject: [PATCH] hyperv: Wait 5 seconds for hyperv result, instead of 500ms This addresses various devices (network, stoarge) attach failure. Reported by: Hongxiong Xian Tested by: Hongxiong Xian MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5435 --- sys/dev/hyperv/netvsc/hv_rndis_filter.c | 4 ++-- sys/dev/hyperv/vmbus/hv_channel.c | 7 ++++--- sys/dev/hyperv/vmbus/hv_connection.c | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/dev/hyperv/netvsc/hv_rndis_filter.c b/sys/dev/hyperv/netvsc/hv_rndis_filter.c index 9fb78eeeb406..92a758767dc9 100644 --- a/sys/dev/hyperv/netvsc/hv_rndis_filter.c +++ b/sys/dev/hyperv/netvsc/hv_rndis_filter.c @@ -352,7 +352,7 @@ hv_rf_send_offload_request(struct hv_device *device, goto cleanup; } - ret = sema_timedwait(&request->wait_sema, 500); + ret = sema_timedwait(&request->wait_sema, 5 * hz); if (ret != 0) { device_printf(dev, "hv send offload request timeout\n"); goto cleanup; @@ -619,7 +619,7 @@ hv_rf_set_packet_filter(rndis_device *device, uint32_t new_filter) * us when the response has arrived. In the failure case, * sema_timedwait() returns a non-zero status after waiting 5 seconds. */ - ret = sema_timedwait(&request->wait_sema, 500); + ret = sema_timedwait(&request->wait_sema, 5 * hz); if (ret == 0) { /* Response received, check status */ set_complete = &request->response_msg.msg.set_complete; diff --git a/sys/dev/hyperv/vmbus/hv_channel.c b/sys/dev/hyperv/vmbus/hv_channel.c index af7395b445f5..bb777cc4fe45 100644 --- a/sys/dev/hyperv/vmbus/hv_channel.c +++ b/sys/dev/hyperv/vmbus/hv_channel.c @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -194,7 +195,7 @@ hv_vmbus_channel_open( if (ret != 0) goto cleanup; - ret = sema_timedwait(&open_info->wait_sema, 500); /* KYS 5 seconds */ + ret = sema_timedwait(&open_info->wait_sema, 5 * hz); /* KYS 5 seconds */ if (ret) { if(bootverbose) @@ -439,7 +440,7 @@ hv_vmbus_channel_establish_gpadl( } } - ret = sema_timedwait(&msg_info->wait_sema, 500); /* KYS 5 seconds*/ + ret = sema_timedwait(&msg_info->wait_sema, 5 * hz); /* KYS 5 seconds*/ if (ret != 0) goto cleanup; @@ -499,7 +500,7 @@ hv_vmbus_channel_teardown_gpdal( if (ret != 0) goto cleanup; - ret = sema_timedwait(&info->wait_sema, 500); /* KYS 5 seconds */ + ret = sema_timedwait(&info->wait_sema, 5 * hz); /* KYS 5 seconds */ cleanup: /* diff --git a/sys/dev/hyperv/vmbus/hv_connection.c b/sys/dev/hyperv/vmbus/hv_connection.c index 0ff45df6eb99..d8cb3398d2da 100644 --- a/sys/dev/hyperv/vmbus/hv_connection.c +++ b/sys/dev/hyperv/vmbus/hv_connection.c @@ -27,6 +27,7 @@ */ #include +#include #include #include #include @@ -121,7 +122,7 @@ hv_vmbus_negotiate_version(hv_vmbus_channel_msg_info *msg_info, /** * Wait for the connection response */ - ret = sema_timedwait(&msg_info->wait_sema, 500); /* KYS 5 seconds */ + ret = sema_timedwait(&msg_info->wait_sema, 5 * hz); /* KYS 5 seconds */ mtx_lock_spin(&hv_vmbus_g_connection.channel_msg_lock); TAILQ_REMOVE(