From patchwork Fri Aug 10 02:14:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10562179 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 AAFC813BB for ; Fri, 10 Aug 2018 02:14:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B0FE2BB93 for ; Fri, 10 Aug 2018 02:14:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8DAA12BBA4; Fri, 10 Aug 2018 02:14:55 +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 10DCD2BB93 for ; Fri, 10 Aug 2018 02:14:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727069AbeHJEme (ORCPT ); Fri, 10 Aug 2018 00:42:34 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:41329 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725198AbeHJEmd (ORCPT ); Fri, 10 Aug 2018 00:42:33 -0400 Received: by mail-pl0-f65.google.com with SMTP id w19-v6so3355652ply.8 for ; Thu, 09 Aug 2018 19:14:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id; bh=Fkz8NwybmryQmRNiVCqEZD11TPiVI/o/AZkIb3bLXAY=; b=ZlTs6zxQpLgPhxZpX2Kn1sh29l/nntXxuI/FV1EoZhjkz/4NgYPzdd0Xrx60PBBeAP oAsJaSmeo2/xdukeJ7XeQcsAlXohk2Ssd30XtTX89NTPJCT5PBDxatm+8YAPVry2kuds DXgTQOiG77PuXs1t0oguULf/WC34izgbBrPhdus/bQrxX0s5HUzCQUQITtXtJYhvuchA QAT2Ux+f5lZcmXGYz2w6VtNX2vReNmEepdihRr4MKuuxfmwtOFZF5K21K6rxg6CaFe6P NTcs1boqyOirxkiFzyMBiW2bjqiMTJpobpzxNw9j1IUahpgI7/2vLfaeKSHi/tF211SC i0iQ== 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; bh=Fkz8NwybmryQmRNiVCqEZD11TPiVI/o/AZkIb3bLXAY=; b=gTR2NRfaIA+ShINj60/Y72gJt0rbZIA899NC5i1SuIOcDPmfxhpjDRpL4Sc9zX/NZt qLA0zKbb8mT+dl0AlxI2AnBsA0VBRxskzQWJ2JfRmc6hiDkbGBMx/8qeMFabSUsU1k8H 97Zdj2n3kfjPWaNP0XwyA5RPehOhSe7NBeU0RWH1OnjQVPOjc1YRglsIRt/4sFfPsMt9 Zli5TjaxdiePR1doi5yfb/LDDkHdL1ltEhil/f4KL6yYwGEVIia021Gzr035+vcJnRWN VWI8RvBWP4oHbLMzEL9m7kIk+ltGeS7IEzVvAlc5xQDT4Fq2KrERKXkoFMtGYndCa+h5 wP8g== X-Gm-Message-State: AOUpUlEinUDR1dC8hLQHPgmtHpc9WkvtJCUNS3qkmk127tCksAKyNADl /ihjwG5RuBnrC70b+ejqun//ZNHxHuQ= X-Google-Smtp-Source: AA+uWPwDdydiUGmUoo48SpG/oqZjgreE8hLMmsiazdm1DbVDQT27+Z/OKWzvt0J9qdi6DUHAIzO7cg== X-Received: by 2002:a17:902:8e86:: with SMTP id bg6-v6mr4227206plb.108.1533867292772; Thu, 09 Aug 2018 19:14:52 -0700 (PDT) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [174.3.196.123]) by smtp.gmail.com with ESMTPSA id g15-v6sm19223773pfg.98.2018.08.09.19.14.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Aug 2018 19:14:51 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.90_1) (envelope-from ) id 1fnwx1-0003g5-7X; Thu, 09 Aug 2018 20:14:51 -0600 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org, Leon Romanovsky , "Guy Levi(SW)" , Yishai Hadas , "Ruhl, Michael J" Cc: Jason Gunthorpe Subject: [PATCH v1 00/10] Allow dissociation after destroy for the ioctl methods Date: Thu, 9 Aug 2018 20:14:34 -0600 Message-Id: <20180810021444.14014-1-jgg@ziepe.ca> X-Mailer: git-send-email 2.18.0 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 From: Jason Gunthorpe The previous series fixed this for the write methods, but the ioctl methods had an additional problem where the ioctl parser relies on datastructures stored in the driver's rodata. This series solves this by revising how the parsing tree is stored in memory. A new datastructure called 'uverbs_api' is introduced that builds the rodata description into a proper kernel radix tree with an optimized small value 'bkey' for attributes. The new datastructure is designed to allow a driver to disassociate from the runtime api description so that non-driver methods like destroy can continue to work. The major rework in datastructures and parsing of ioctl provides a nice code simplification, source code size reduction and I measure approximately a 6% reduction in ioctl syscall time overhead. The downside is that this uses a bit more memory in the radix tree, but that is likely negligible for RDMA. This data structure design is intended to support future series that will rework how the rodata description is stored to add more features, reduce its size, and reduce the complexity required to build the rodata. v1: - For loop bug fig from Leon - Missing check in lookup_get_fd_uobject from Leon - Use rcu_assign_pointer when setting handler for sparse, from Leon - Dead code from Michael - Various comment and commit message edits More testing has shown that the prior series introduced a bug related to module unload of drivers when working with the mlx5 driver specific objects. This series is needed to fix that bug, so I would like to apply it on Friday. Jason Gunthorpe (10): IB/uverbs: Have the core code create the uverbs_root_spec IB/uverbs: Build the specs into a radix tree at runtime IB/uverbs: Use uverbs_api to manage the object type inside the uobject IB/uverbs: Provide implementation private memory for the uverbs_attr_bundle IB/uverbs: Remove the ib_uverbs_attr pointer from each attr IB/uverbs: Add a simple allocator to uverbs_attr_bundle IB/uverbs: Use uverbs_alloc for allocations IB/uverbs: Use uverbs_api to unmarshal ioctl commands IB/uverbs: Remove struct uverbs_root_spec and all supporting code IB/uverbs: Do not check for device disassociation during ioctl drivers/infiniband/core/Makefile | 5 +- drivers/infiniband/core/rdma_core.c | 145 ++-- drivers/infiniband/core/rdma_core.h | 60 +- drivers/infiniband/core/uverbs.h | 2 +- drivers/infiniband/core/uverbs_ioctl.c | 675 ++++++++++-------- drivers/infiniband/core/uverbs_ioctl_merge.c | 664 ----------------- drivers/infiniband/core/uverbs_main.c | 40 +- drivers/infiniband/core/uverbs_std_types.c | 33 - .../core/uverbs_std_types_counters.c | 20 +- drivers/infiniband/core/uverbs_uapi.c | 346 +++++++++ drivers/infiniband/hw/mlx5/devx.c | 83 +-- drivers/infiniband/hw/mlx5/main.c | 45 +- drivers/infiniband/hw/mlx5/mlx5_ib.h | 1 + include/rdma/ib_verbs.h | 4 +- include/rdma/uverbs_ioctl.h | 301 ++++---- include/rdma/uverbs_std_types.h | 30 +- include/rdma/uverbs_types.h | 9 +- 17 files changed, 1083 insertions(+), 1380 deletions(-) delete mode 100644 drivers/infiniband/core/uverbs_ioctl_merge.c create mode 100644 drivers/infiniband/core/uverbs_uapi.c