diff options
author | Andrea Parri <parri.andrea@gmail.com> | 2019-10-15 14:46:46 +0300 |
---|---|---|
committer | Sasha Levin <sashal@kernel.org> | 2019-11-22 04:10:44 +0300 |
commit | 931cccc967730d43bb6325506baf51c8f83a9a58 (patch) | |
tree | 3ac845e171b98d698f1ff123385b314bb36a4b9d /drivers/hv | |
parent | 2d4f49b3e1e3a24ce16dfeeb2235688c8aba57ef (diff) |
Drivers: hv: vmbus: Add module parameter to cap the VMBus version
Currently, Linux guests negotiate the VMBus version with Hyper-V
and use the highest available VMBus version they can connect to.
This has some drawbacks: by using the highest available version,
certain code paths are never executed and can not be tested when
the guest runs on the newest host.
Add the module parameter "max_version", to upper-bound the VMBus
versions guests can negotiate.
Suggested-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
Reviewed-by: Wei Liu <wei.liu@kernel.org>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/hv')
-rw-r--r-- | drivers/hv/connection.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c index cadfb34b38d8..0475be4356dd 100644 --- a/drivers/hv/connection.c +++ b/drivers/hv/connection.c @@ -14,6 +14,7 @@ #include <linux/wait.h> #include <linux/delay.h> #include <linux/mm.h> +#include <linux/module.h> #include <linux/slab.h> #include <linux/vmalloc.h> #include <linux/hyperv.h> @@ -55,6 +56,16 @@ static __u32 vmbus_versions[] = { VERSION_WS2008 }; +/* + * Maximal VMBus protocol version guests can negotiate. Useful to cap the + * VMBus version for testing and debugging purpose. + */ +static uint max_version = VERSION_WIN10_V5_2; + +module_param(max_version, uint, S_IRUGO); +MODULE_PARM_DESC(max_version, + "Maximal VMBus protocol version which can be negotiated"); + int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo, u32 version) { int ret = 0; @@ -240,6 +251,8 @@ int vmbus_connect(void) goto cleanup; version = vmbus_versions[i]; + if (version > max_version) + continue; ret = vmbus_negotiate_version(msginfo, version); if (ret == -ETIMEDOUT) |