Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next 1/3] VMCI: only load on VMware hypervisor
@ 2017-08-15 22:13 Dexuan Cui
  2017-08-16 18:06 ` David Miller
  2017-08-16 19:44 ` Jorgen S. Hansen
  0 siblings, 2 replies; 7+ messages in thread
From: Dexuan Cui @ 2017-08-15 22:13 UTC (permalink / raw)
  To: davem@davemloft.net, netdev@vger.kernel.org,
	'gregkh@linuxfoundation.org',
	devel@linuxdriverproject.org
  Cc: Michal Kubecek, olaf@aepfle.de, Stephen Hemminger,
	jasowang@redhat.com, Rolf Neugebauer, Haiyang Zhang, Dave Scott,
	linux-kernel@vger.kernel.org, apw@canonical.com, George Zhang,
	Stefan Hajnoczi, Marcelo Cerri, joe@perches.com, Asias He,
	Vitaly Kuznetsov, Jorgen Hansen, Dan Carpenter


Without the patch, vmw_vsock_vmci_transport.ko and vmw_vmci.ko can
automatically load when an application creates an AF_VSOCK socket.

This is the expected good behavior on VMware hypervisor, but as we
are going to add hv_sock.ko (i.e. Hyper-V transport for AF_VSOCK), we
should make sure vmw_vsock_vmci_transport.ko doesn't load on Hyper-V,
otherwise there is a -EBUSY conflict when both vmw_vsock_vmci_transport.ko
and hv_sock.ko try to call vsock_core_init() on Hyper-V.

On the other hand, hv_sock.ko can only load on Hyper-V, because it
depends on hv_vmbus.ko, which detects Hyper-V in hv_acpi_init().

KVM's vsock_virtio_transport doesn't have the issue because it doesn't
define MODULE_ALIAS_NETPROTO(PF_VSOCK).

Signed-off-by: Dexuan Cui <decui@microsoft.com>
Cc: Alok Kataria <akataria@vmware.com>
Cc: Andy King <acking@vmware.com>
Cc: Adit Ranadive <aditr@vmware.com>
Cc: George Zhang <georgezhang@vmware.com>
Cc: Jorgen Hansen <jhansen@vmware.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
---
 drivers/misc/vmw_vmci/vmci_driver.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/misc/vmw_vmci/vmci_driver.c b/drivers/misc/vmw_vmci/vmci_driver.c
index d7eaf1e..1789ea7 100644
--- a/drivers/misc/vmw_vmci/vmci_driver.c
+++ b/drivers/misc/vmw_vmci/vmci_driver.c
@@ -19,6 +19,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/hypervisor.h>
 
 #include "vmci_driver.h"
 #include "vmci_event.h"
@@ -58,6 +59,13 @@ static int __init vmci_drv_init(void)
 	int vmci_err;
 	int error;
 
+	/*
+	 * Check if we are running on VMware's hypervisor and bail out
+	 * if we are not.
+	 */
+	if (x86_hyper != &x86_hyper_vmware)
+		return -ENODEV;
+
 	vmci_err = vmci_event_init();
 	if (vmci_err < VMCI_SUCCESS) {
 		pr_err("Failed to initialize VMCIEvent (result=%d)\n",
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-08-17  8:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-15 22:13 [PATCH net-next 1/3] VMCI: only load on VMware hypervisor Dexuan Cui
2017-08-16 18:06 ` David Miller
2017-08-16 18:51   ` Dexuan Cui
2017-08-16 18:54     ` David Miller
2017-08-16 19:44 ` Jorgen S. Hansen
2017-08-16 22:33   ` Dexuan Cui
2017-08-17  8:10     ` Dexuan Cui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox