From patchwork Tue Aug 15 22:13:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dexuan Cui X-Patchwork-Id: 801790 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=microsoft.com header.i=@microsoft.com header.b="EF1EGoPj"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xX6Fp41gSz9sPm for ; Wed, 16 Aug 2017 08:14:06 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752770AbdHOWNx (ORCPT ); Tue, 15 Aug 2017 18:13:53 -0400 Received: from mail-hk2apc01on0104.outbound.protection.outlook.com ([104.47.124.104]:37792 "EHLO APC01-HK2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752439AbdHOWNu (ORCPT ); Tue, 15 Aug 2017 18:13:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=l60hh5W7Pmiz/zedgMaPu8VJ2EVWTP4r+cMKqUoxMtk=; b=EF1EGoPjeMJ9FBr54xImIIyC8XkO8gSbBolkf0zWvLIFDJYOw+2wvw/JomQPx0yPVnFqNSrE7NQu4NfJEfmzoqiPnfguNw57w1XNpZBEZkQ+h6Mc7qGcH8GHx+ELtbJVjsQzpnmTvfk7zu6wN6OP9sjBmSIti7M4LYO3/1Kk3Dw= Received: from KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM (10.170.167.145) by KL1P15301MB0037.APCP153.PROD.OUTLOOK.COM (10.170.167.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1385.3; Tue, 15 Aug 2017 22:13:30 +0000 Received: from KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM ([10.170.167.145]) by KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM ([10.170.167.145]) with mapi id 15.01.1385.003; Tue, 15 Aug 2017 22:13:30 +0000 From: Dexuan Cui To: "davem@davemloft.net" , "netdev@vger.kernel.org" , "'gregkh@linuxfoundation.org'" <'gregkh@linuxfoundation.org'>, "devel@linuxdriverproject.org" CC: KY Srinivasan , Haiyang Zhang , Stephen Hemminger , George Zhang , Jorgen Hansen , Michal Kubecek , Asias He , Stefan Hajnoczi , Vitaly Kuznetsov , Cathy Avery , "jasowang@redhat.com" , "Rolf Neugebauer" , Dave Scott , Marcelo Cerri , "apw@canonical.com" , "olaf@aepfle.de" , "joe@perches.com" , "linux-kernel@vger.kernel.org" , Dan Carpenter Subject: [PATCH net-next 1/3] VMCI: only load on VMware hypervisor Thread-Topic: [PATCH net-next 1/3] VMCI: only load on VMware hypervisor Thread-Index: AdMWE2FRTyA4wSwRRmSHRnOjNGe3sA== Date: Tue, 15 Aug 2017 22:13:29 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Ref=https://api.informationprotection.azure.com/api/72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Owner=decui@microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2017-08-15T15:13:27.4642230-07:00; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=General; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Application=Microsoft Azure Information Protection; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Extended_MSFT_Method=Automatic; Sensitivity=General authentication-results: spf=none (sender IP is ) smtp.mailfrom=decui@microsoft.com; x-originating-ip: [167.220.1.80] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; KL1P15301MB0037; 6:sWg/IY/8RZEXqFYJAx6l/nMobJRqwxE+iMHEyXgjWJ0LrnytJWx35odVqJtO0kixwaUQe+doL/wXrq5dXT/RJdqQxXeai6d9pesir0DcXBeyp7QYV/Kf9aUlIWXdJh7vzTXg9NH0QelrelwrrZOm0/I/L0hJjutMCggxsGIQ1zA8TnY94IdUL7lZd6SIZohyaiviFEnhzBZuFTaTli61FjrjKRUU+QPWSFBwymagettP1ZrKjxBaRUL4lk+PQf5/0lVb78OfItS+7zjILiF/C3iRb+lCwBaXtTSoMkY+f8vg9gDuW/r5Xiy5O8N4RvlYTFVegKTeEEXlEEvY3BK9vw==; 5:h3vbci+2dhv5UHTvyHFMv7faB+SMASG58eYebTm0ti/2jgEZPZX1tMkDxdW2o4YKg/mqRwKW5+j29G0QS5orhaC2iu8kw5FVtQ7f8gJ0FkPIkokQuCKtHDwkajaSzt38m/AEc3wy9saJlokkmVtYGQ==; 24:dBiLVkl4W/eBA+n/mKG0AIwAeT0V7BHlyQazE2FYf06iYEHCoDtUmtfDjlWaQYczoKX4ZgTht3LSkNISuwO5SNTc87X2GJiZWYjXCscwYMI=; 7:MTjrBAmt85fX2Xgj4wEajkwNZaI1zSBGOsC3nyMoG5Ba6KD2LfCQvSfzSyVgcrIQaPokUkgfCAKB8m1e1jckvxL5zdQGSz+MExqLFgcWXqXH5SUCagkqx/f7I8CTzA/GAPksurKNH+7BoPeEQ81DN5liiQytiL1IF/hWAGwJ2pCXf1cqjku6/Tunt60chDRuk1zvABhFXFcZxdPrOMS31TOyiF2/95+a6yL6Eek46UU= x-ms-office365-filtering-correlation-id: 8b4f6142-f342-40f6-3875-08d4e42adc4d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(2017052603031)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:KL1P15301MB0037; x-ms-traffictypediagnostic: KL1P15301MB0037: x-exchange-antispam-report-test: UriScan:(61668805478150)(89211679590171); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(61425038)(6040450)(2401047)(8121501046)(5005006)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(3002001)(6055026)(61426038)(61427038)(6041248)(20161123558100)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:KL1P15301MB0037; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:KL1P15301MB0037; x-forefront-prvs: 04004D94E2 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(39860400002)(47760400005)(199003)(189002)(478600001)(33656002)(2906002)(6506006)(101416001)(10290500003)(6436002)(14454004)(105586002)(5660300001)(106356001)(4326008)(3280700002)(2501003)(3660700001)(74316002)(68736007)(25786009)(54356999)(50986999)(77096006)(7416002)(8676002)(81166006)(81156014)(8936002)(10090500001)(2900100001)(3846002)(86612001)(86362001)(55016002)(9686003)(6116002)(102836003)(66066001)(189998001)(7696004)(5005710100001)(97736004)(8990500004)(7736002)(53936002)(305945005)(54906002); DIR:OUT; SFP:1102; SCL:1; SRVR:KL1P15301MB0037; H:KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Aug 2017 22:13:29.2202 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1P15301MB0037 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 Cc: Alok Kataria Cc: Andy King Cc: Adit Ranadive Cc: George Zhang Cc: Jorgen Hansen Cc: K. Y. Srinivasan Cc: Haiyang Zhang Cc: Stephen Hemminger --- 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 #include #include +#include #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",