Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2539563ybp; Thu, 10 Oct 2019 08:49:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqxea72cKwVfiU/SsXkKDxrBMIiwivw/iApOI6b6RgmmG3sL393zeR1zidEw7RK6TFseWOf7 X-Received: by 2002:a17:906:bfcb:: with SMTP id us11mr8869824ejb.299.1570722582240; Thu, 10 Oct 2019 08:49:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570722582; cv=none; d=google.com; s=arc-20160816; b=W7mq/IDxkowQ6duMHxYXroLnL1USNI+uKAOeC+xrPRx/mp/5znt0hdCCso0hVSypdG FJEk1uYiB+2F3UJj4IpLvaHnFte2SmLOTypXmkK/uWCWGsCqfDe+OC1EvcC13qtjar55 thn+B6gE2wBBpIr3zq/f40P29vY0RIkJXIgBksmJ9m6pU95yZ/n4C61aLfWCYkMz2hEE bVUfnzGlXmkTtkAc9oInCUz40wjVK5FLS3RH+33um4CBEvWQ6PG4BQm24XXreEAFuX4/ UB6+yCIGAf09hiO82YMbNJfBTaFDlL6NHD2B9fRJjJmiqZfG9DxVpA1pzLVNp/tk3MOK KAZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IgNkDcJv0Dsat8rX7/2Xt+TqC2z88O73Ns5IrlBP/xE=; b=r0UgII9CpVoGk0LvEg2jhw/dx6DUZNIhh8SKDfPsd/9TdfVs/lh0OTxl28MTQYECGi SAd8Yo++Dk0xLZ9yah+V40/YYZeacsrTmZ81jkdv7E8EY+QXwjvh9cmZS6+F8dwom/j1 eK+9N1o0LRvOHXTbxX0ehH4Jxuz0Fn32QLWiicyjH1MnE5TrqS4Ean9zmScThvy0Ymy8 UPSseQNvJf3QvBEHdxImamXK6SCZHfgMzGveIrMz4ztAC3rLsw5h2R5uv7xa9Wwx9JlJ mQsUkT56G9pOnxDwmM2B2l/ajOmle2z/zcfJ9U0bstqP7CzBkH6nqxDrV2vECvsi4Zxd r7eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="ICZMR/kX"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i12si3391455ejj.119.2019.10.10.08.49.18; Thu, 10 Oct 2019 08:49:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="ICZMR/kX"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726643AbfJJPqb (ORCPT + 99 others); Thu, 10 Oct 2019 11:46:31 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:35311 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726148AbfJJPqa (ORCPT ); Thu, 10 Oct 2019 11:46:30 -0400 Received: by mail-wm1-f65.google.com with SMTP id y21so7317912wmi.0; Thu, 10 Oct 2019 08:46:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IgNkDcJv0Dsat8rX7/2Xt+TqC2z88O73Ns5IrlBP/xE=; b=ICZMR/kXK4ALkcUdh0QSQSOcz8hympO2L0DXdxYG6WiZRQPIzt56IyYT1bbtChGft6 dAA2Hwc9NWTwEc547la4Bm1t9zBeNY8B6I87cY4IFx+tvm6fHm8ThRn3Kyqux9uH7IaX ME04BtFS5DlcH1gRda+qPqDkYpFIEAfm2UT7m6sjMJY2NbXruBXARNNzcEe5Yj7iIiOy 3kmTk17xeKP6zVeBSK94fFSNq+luFF+1RSApsYCYdufh4gvHsYEljjEpUg0c2TYKPMqS fiJzSLNXndJy+EKXTqlhjCP70qiIebkd2XBgyZ9drZ5nDsSjL4Oa8zD6KQ4yx7ezuV0Z Adrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IgNkDcJv0Dsat8rX7/2Xt+TqC2z88O73Ns5IrlBP/xE=; b=I5lGDkcJSvtsIfxFLGwoZ7XxSXTOXKInUDsrTt1vk/9tz3r9GV5kfCGiubi1lLoqxE fFn/IhJJSuxNtAOHuDWeQOGuZlWvMK5qfsjhr057Gb56PHHIwexZWwdYE4KO5gDBfGtE KmOy46lovj1W8ZuJuU8oH1oELQpjSKsbROREnu7RB5zzv3/1UPuLGN+227WmeGtfaY2F MPNI2uhvxMuvT7wpR7A3fRRBtIf4LfmnVwAv9VhguPUlP/6L/X1MUwY0hgMgQ1mNA06n lBO/NC9bXoxww6FWhQ4BR9NDD+E90oSs9sNYJWz8/43OU2YwE5ynI75S7vstiPTesOLh 4lrg== X-Gm-Message-State: APjAAAVtUhMjYfZ0CLR06wX/TZ6U3sA1rI5/pvTUsiFMAHajul+pV8zZ LI0XYXrajsATnuwGGlm9ux8gkkXO8Zr1ow== X-Received: by 2002:a05:600c:2185:: with SMTP id e5mr8441624wme.78.1570722386439; Thu, 10 Oct 2019 08:46:26 -0700 (PDT) Received: from andrea.corp.microsoft.com ([2a01:110:8012:1010:e9a3:da77:7120:dee0]) by smtp.gmail.com with ESMTPSA id u25sm6719807wml.4.2019.10.10.08.46.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 08:46:25 -0700 (PDT) From: Andrea Parri To: linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, netdev@vger.kernel.org Cc: "K . Y . Srinivasan" , Haiyang Zhang , Stephen Hemminger , Sasha Levin , "David S . Miller" , Michael Kelley , Vitaly Kuznetsov , Dexuan Cui , Andrea Parri Subject: [PATCH v2 3/3] Drivers: hv: vmbus: Add module parameter to cap the VMBus version Date: Thu, 10 Oct 2019 17:46:00 +0200 Message-Id: <20191010154600.23875-4-parri.andrea@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010154600.23875-1-parri.andrea@gmail.com> References: <20191010154600.23875-1-parri.andrea@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: Andrea Parri --- drivers/hv/connection.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c index 2f6961ac8c996..f60d7330ff3fd 100644 --- a/drivers/hv/connection.c +++ b/drivers/hv/connection.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -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; @@ -237,6 +248,8 @@ int vmbus_connect(void) for (i = 0; i < ARRAY_SIZE(vmbus_versions); i++) { version = vmbus_versions[i]; + if (version > max_version) + continue; ret = vmbus_negotiate_version(msginfo, version); if (ret == -ETIMEDOUT) -- 2.23.0