From patchwork Thu Sep 20 16:34:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10608175 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9A849913 for ; Thu, 20 Sep 2018 16:35:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 882B72E0DD for ; Thu, 20 Sep 2018 16:35:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C2CD2E0D4; Thu, 20 Sep 2018 16:35:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A0732DFF3 for ; Thu, 20 Sep 2018 16:35:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728106AbeITWTb (ORCPT ); Thu, 20 Sep 2018 18:19:31 -0400 Received: from mail-eopbgr70047.outbound.protection.outlook.com ([40.107.7.47]:23682 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726128AbeITWTb (ORCPT ); Thu, 20 Sep 2018 18:19:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Oy7twy9R6MkIiQAwq5iWbXIr/1jvuaBnTcXUhSZILB8=; b=F423WNMZJo4ktx+4o/21Q7ZeR9BMuu8J0nLldECcgBrVnbzW6EhblUYakscHl9+jXOmcoZPp6+zSVhdi+AOQHv4EERnSrmxMgwW8bADgejZI1lIlJWC9Hl9/i7VBWhzB+OOK8TeIaSyzKutdJ8/XD2Wna4gt4ku5/sKqFySBy/o= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jgg@mellanox.com; Received: from mlx.ziepe.ca (174.3.196.123) by VI1PR05MB4463.eurprd05.prod.outlook.com (2603:10a6:803:43::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.18; Thu, 20 Sep 2018 16:35:08 +0000 Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1g31uq-00014r-5Q; Thu, 20 Sep 2018 10:34:56 -0600 Date: Thu, 20 Sep 2018 10:34:56 -0600 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: stable@linux-rdma.org Subject: [PATCH rdma-core] verbs: If the uverbs module is not loaded allow get_devices to retry init Message-ID: <20180920163456.GA4120@ziepe.ca> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [174.3.196.123] X-ClientProxiedBy: YQBPR0101CA0055.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c00:1::32) To VI1PR05MB4463.eurprd05.prod.outlook.com (2603:10a6:803:43::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0e291399-dfdd-463e-8410-08d61f17075c X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:VI1PR05MB4463; X-Microsoft-Exchange-Diagnostics: 1;VI1PR05MB4463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cpxcfNV5LEZx2sdhDJQ/Uc/mTtoeL7v1R5MT1LUlo+AwV4Zij96GqoPm1W1P/PIeac8g6FGCQYscwVJeYrWwN5Jn3ZJUHjvUT27Fs1lQBODLyQKI0LQa4m5FDKVbxNlgDi0KmP4Jit9AW2OVuFXjanEn2Gd4kh8tQYRkKXon+yxDrG9GFht3yUWzfg+S5/aC7mGNprFW44yHqd600MgxwT2R6oQgzd+4QSjvoWK83HrxDYRibYXbDmh04p79p5rtcHobCEYN3j602C52Dqdgom5j+V4KlSC4NXARUF5TVZSdzmmn6YdGFsHW6q8uvI5rLRJ2OftoFjM+S+jr5mh5jw2GN7;4:V+kfPoFAS/UzBrriGaikFOZSiusCOq4UQzwekBVGRDQGFHmiGoKL7lBpIwV8Nc87qmMYyV1AfnmanzftVUh3u0xWXFZKpUsmZxDEYK+xs0jqVfgQiFh7M3AEmbZQ4F5p/tpnBrUqZ4Vw5T/G5iT5rxwd4D9hLiIjSGczbd922o39PwjtqOIl6fQCG924Hx6ivQ9ktKlec5c438gPPTItaPUwaSeP2RZIq30PYvK8GVObVWom+MPb0S9aPeavJgp2DlRpuzXp+Gd89uylCxvG5A== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231355)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(201708071742011)(7699051);SRVR:VI1PR05MB4463;BCL:0;PCL:0;RULEID:;SRVR:VI1PR05MB4463; X-Forefront-PRVS: 0801F2E62B X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(346002)(396003)(136003)(376002)(39860400002)(366004)(199004)(189003)(122856001)(58126008)(83796002)(8676002)(81166006)(2351001)(2361001)(106356001)(36756003)(81156014)(8936002)(97736004)(105586002)(86362001)(33656002)(4326008)(6116002)(23726003)(57986006)(9746002)(50466002)(68736007)(1076002)(14444005)(52116002)(9786002)(7736002)(476003)(69596002)(386003)(186003)(305945005)(33896004)(3846002)(316002)(478600001)(9686003)(6916009)(26005)(16586007)(46656002)(486006)(66066001)(53936002)(2906002)(5660300001)(47776003)(18370500001)(24400500001)(42262002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR05MB4463;H:mlx.ziepe.ca;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1;VI1PR05MB4463;23:Oroh1AyGVsYvjAIGDaiJeYND0TV79dCHFW4fQkp9OT3kuKiY0jVkFU2Sgc8hHcJKJ5sPpkDtjgiwojXcJmbNqOYHESX9sv/KVZBzn3C+vfFfuB/crbTnHrEsOSR++KOY0zokLIzjdFxWP5+hnrzSlwh3UgdhPnFDKNNWo5KqbC1fHsLZEG/ON7trI3ueFIZq/RpXcM49qdSXb1l0EM1lbgBujCZhI7fZvjxUCBZdKvopmRKswJ+VVOSPzDr1TWRNPZPxI+/pbarZqxhotlCw54FTv7gOeBZqRIEGRYgC3Es0q2Dy2ZMUd40agfRuCaaLoY0yfAWS+udQHzCV3bNUwAO+YblQsYktN3tEheI9qr6EIXEHdXlYLX8A6WAt672HDnrIKLf26sdzNYBV/+EL6c12oZdAns77l8hlYrOduyKZhphKCwmVsN4dMUgu5cxAvENhG27u/m1SVWlkPjiIi9csf6d5b+MOwxi0eaIiOZZTibEMZcRCby0J4STaEbwv5fMyh+TCmr8hHnBCJPeC9SYqyOspaa14XAUTTXEW9X7uAHY4w/PbISNZaXCVXDT6pe3eZkoGW39Kv1EoPaHJHGyzCVIHOQky0cjPfSZeta1bYu82JXX0PmCpCpzKeUmAsKyyJK8mMgBcit4CKU8hkF4UwtW7kEYbq5OtEMIJcbW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lGXA2p1UhBTkvU3EJ/PnzSlbzdyltYjk79D7jmutTAl94KVuPo4BhYcIQlzCmbY9RdNS4sWm5W52NfDUdHQwjN28rjOApfD6Fs2nEKNIwxzL0e25XExxn/tw4BxmKvRJDae0Rv57ErZ7FgXcKGCmjDR+6gjG92S67S/LO0KcL31gQRU93jhx4YiC1HNEiKRa+/DtLNHbXKRrOyqccVwmd0mNWXu8/mkJSKgdfzrargECU+WdxtFewpoXK6PiewZblC3gaAXriACBtOQugoXM3OMWFG1ia+ItreSlyQTEXQ42TDFiIJAZWz26pTVY1lL7DuUK9VB01UvNii7IW46U+4Z9rUSP5Ut4rAWmvQc0GAxaaFyPzS5zYxdothoBICUOeTaiZxbBNqhany411fZkTO3Kq8VPn/p8MgeGfyWkL+3iiPTCMid7VYmjeJP/hfr5NQ==;5:qqEh3Pt8Fh2a/lguuHXAzbbnGXZnQ94gfnfy3dTVXNYWIUTGYAYGZDYMA0Sf/qznO6tZTl+03mrbQs4r0WdQiuIu6JufS7IX/SLmrGEe3v1EYISdC9jHM+DNYviJH5UIVL01preIVHjJgF0+qAAdUx5ZZIGGkdiRU57JI9ZDhEQ=;7:BF8B0VMDkb9vuIrEHOtsoACEGHiUy1ojWxmb6He5KkZUYFedgGhhCQTlYUiPbVkRiAk2Fp8lMUCs/oQ0GisCUlSDxkn4M6t0XyKDqEFTeYLLzYCz3iRuAoxfbePqZ3uz7qUxd5S5ufHiNyD1Anoz3jhqczghaepelBQNUS1BeynNlOc3F4LEXXqof4LqtdkVKAf7inWp8qxKAfz2GgHcUtgtrJIHSN751QMmD/dEMs7YtUdkice/4jQlucBY1tJl SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2018 16:35:08.7706 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0e291399-dfdd-463e-8410-08d61f17075c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4463 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently if uverbs is not loaded libibverbs latches into a permanent disabled state on the first try to ibv_get_device_list. This is not compatible with hot-plug which could insert the uverbs module at any later point. Recheck for uverbs presence until we get a successful init or a hard failure during init. Cc: stable@linux-rdma.org Fixes: c632072027a8 ("verbs: Refresh cahced ibv_device list") Signed-off-by: Jason Gunthorpe Reviewed-by: Leon Romanovsky --- libibverbs/device.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/libibverbs/device.c b/libibverbs/device.c index 448795a993af21..3900afd3f90bd3 100644 --- a/libibverbs/device.c +++ b/libibverbs/device.c @@ -64,7 +64,22 @@ LATEST_SYMVER_FUNC(ibv_get_device_list, 1_1, "IBVERBS_1.1", pthread_mutex_lock(&dev_list_lock); if (!initialized) { - int ret = ibverbs_init(); + char value[8]; + int ret; + + /* + * The uverbs module is not loaded, this is a ENOSYS return + * but it is not a hard failure, we can try again to see if it + * has become loaded since. + */ + if (ibv_read_sysfs_file(ibv_get_sysfs_path(), + "class/infiniband_verbs/abi_version", + value, sizeof(value)) < 0) { + errno = -ENOSYS; + goto out; + } + + ret = ibverbs_init(); initialized = (ret < 0) ? ret : 1; }