Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1712496 > unrolled thread
| Started by | Dexuan Cui <decui@microsoft.com> |
|---|---|
| First post | 2017-08-16 00:20 +0200 |
| Last post | 2017-08-16 21:50 +0200 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH net-next 1/3] VMCI: only load on VMware hypervisor Dexuan Cui <decui@microsoft.com> - 2017-08-16 00:20 +0200
Re: [PATCH net-next 1/3] VMCI: only load on VMware hypervisor David Miller <davem@davemloft.net> - 2017-08-16 20:10 +0200
Re: [PATCH net-next 1/3] VMCI: only load on VMware hypervisor David Miller <davem@davemloft.net> - 2017-08-16 21:00 +0200
Re: [PATCH net-next 1/3] VMCI: only load on VMware hypervisor "Jorgen S. Hansen" <jhansen@vmware.com> - 2017-08-16 21:50 +0200
| From | Dexuan Cui <decui@microsoft.com> |
|---|---|
| Date | 2017-08-16 00:20 +0200 |
| Subject | [PATCH net-next 1/3] VMCI: only load on VMware hypervisor |
| Message-ID | <ueSlP-79T-1@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2017-08-16 20:10 +0200 |
| Message-ID | <ufaVt-1YD-41@gated-at.bofh.it> |
| In reply to | #1712496 |
From: Dexuan Cui <decui@microsoft.com> Date: Tue, 15 Aug 2017 22:13:29 +0000 > + /* > + * Check if we are running on VMware's hypervisor and bail out > + * if we are not. > + */ > + if (x86_hyper != &x86_hyper_vmware) > + return -ENODEV; This symbol is only available when CONFIG_HYPERVISOR_GUEST is defined. But this driver does not have a Kconfig dependency on that symbol so the build can fail in some configurations.
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2017-08-16 21:00 +0200 |
| Message-ID | <ufbHQ-2eE-11@gated-at.bofh.it> |
| In reply to | #1713203 |
From: Dexuan Cui <decui@microsoft.com> Date: Wed, 16 Aug 2017 18:51:36 +0000 > It looks typically modern Linux distros have CONFIG_HYPERVISOR_GUEST=y > by default It doesn't matter what any distribution does or does not do. People are going to do 'randconfig' builds over thousands and thousands of configuration combinations to test your changes, and those tests will fail. > Do you want me to submit a v2 for this patch with the Kconfig change? Of course, there is no way I can apply your series as-is.
[toc] | [prev] | [next] | [standalone]
| From | "Jorgen S. Hansen" <jhansen@vmware.com> |
|---|---|
| Date | 2017-08-16 21:50 +0200 |
| Message-ID | <ufcue-2Ob-7@gated-at.bofh.it> |
| In reply to | #1712496 |
> On Aug 16, 2017, at 12:13 AM, Dexuan Cui <decui@microsoft.com> wrote: > > > 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. The VMCI driver (vmw_vmci.ko) is used both by the VMware guest support (VMware Tools primarily) and by our Workstation product. Always disabling the VMCI driver on Hyper-V means that user won’t be able to run Workstation nested in Linux VMs on Hyper-V. Since the VMCI driver itself isn’t the problem here, maybe we could move the check to vmw_vsock_vmci_transport.ko? Ideally, there should be some way for a user to have access to both protocols, but for now disabling the VMCI socket transport for Hyper-V (possibly with a module option to skip that check and always load it) but leaving the VMCI driver functional would be better, Thanks, Jorgen
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web