From patchwork Wed Mar 21 01:30:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10298259 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 26D7860385 for ; Wed, 21 Mar 2018 01:30:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C12C2972F for ; Wed, 21 Mar 2018 01:30:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F27DF29731; Wed, 21 Mar 2018 01:30:17 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 525BB2972F for ; Wed, 21 Mar 2018 01:30:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751458AbeCUBaQ (ORCPT ); Tue, 20 Mar 2018 21:30:16 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36637 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751456AbeCUBaP (ORCPT ); Tue, 20 Mar 2018 21:30:15 -0400 Received: by mail-wm0-f65.google.com with SMTP id x82so6932045wmg.1 for ; Tue, 20 Mar 2018 18:30:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=wlr4RDMYoI51laqYKt9ULvmHYzxNHN6jKCo7kWRaufA=; b=DjHw89za/RBBEiFghFc78o6bFSHvI2DXIWhFAqJepXC5tT6pUhPsc5Ejcn6PJj/hN+ HYfiG4RE8UYqFGeF5Gut2PjB7enPA6zv3afPNwo8hxuklqiosL2PZB3FokOkAjldMELg BNKWXgJu+HNm+QXDfFC/PbmLuTBfXpxSC2s/p6jnNJgfX6taRQ6yAhjFdnhpe7AzpZjT U6LZkU6mBQveOjVEfqDVJqZCujJ+6wpxlKQPm5mE8tJVZk3oQsVZmQl1RmdfJRDBMkRZ BxAvuNKVnYkQ/7qv0G9488cOtj2ycLzatwKUnjuzOpJ8fr80Lx7RrUsRM9fug1e1Exlk KWKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=wlr4RDMYoI51laqYKt9ULvmHYzxNHN6jKCo7kWRaufA=; b=iWyIX7bO8hXBk300TfZx8y8+BXbAYFpevo0IZI8cHzFrDQWw+XEMteH+FHsyqfMfyY vwHCPTcXHY/54qbx01yE0B28o+w37wF9cVy+6BhjOaByEqoz05H4d3/L2DvCDk8UYo/c KMy5ECOk+XKnu+BoQmlklyccCBYycQKpQPuLPlFBLPvz8OIaRQZdNqStqjLuJXAE0vE5 dHoqZo+sHbNCk+X+4amFaK/5WAoc/aNjlhpKFhcDQt6BxQUAuC2LFb0vq0mNYeaWSZxd Y/bp+DCsY/AKNv+FqMIarsVw5Bp32LPri0WIWOF2WNzl9kgRuydbg7wE1nGKizlNFfqh OA9g== X-Gm-Message-State: AElRT7HseORz2A/W5TfJK3ATBgmABduRthptUCM4Z26fFB6WUZYMApNX DvTPgHa2RRCdJ95mJyxtRYgGxg== X-Google-Smtp-Source: AG47ELv+J8G9I2k+r7mM0XGbcjqxD5Qon5FO1wPWfOUGsl2NYwT1fi5HA7NQ2TuWS/RoEF0p+jdtOQ== X-Received: by 10.28.90.215 with SMTP id o206mr1162590wmb.67.1521595814065; Tue, 20 Mar 2018 18:30:14 -0700 (PDT) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [174.3.196.123]) by smtp.gmail.com with ESMTPSA id f23sm3852665wra.51.2018.03.20.18.30.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Mar 2018 18:30:12 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1eySZs-0003OH-BY; Tue, 20 Mar 2018 19:30:08 -0600 Date: Tue, 20 Mar 2018 19:30:08 -0600 From: Jason Gunthorpe To: Parav Pandit Cc: Leon Romanovsky , Doug Ledford , Leon Romanovsky , RDMA mailing list , Mark Bloch Subject: Re: [PATCH rdma-rc 1/2] RDMA/restrack: Add ability to create non-traceable restrack objects Message-ID: <20180321013008.GC6235@ziepe.ca> References: <20180320134537.1523-1-leon@kernel.org> <20180320134537.1523-2-leon@kernel.org> <20180320223642.GA6235@ziepe.ca> <20180320235843.GB6235@ziepe.ca> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) 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 On Wed, Mar 21, 2018 at 12:11:59AM +0000, Parav Pandit wrote: > > > Right way to do ib core to have open() and close() callback. > > > > Probably.. But since we already accepted the patches that cause this bug for this > > merge window we may be stuck accepting a hack. > > > > The hack is to let mlx5 opt out of resource tracking for it's internal objects. > There are some patches from Steve that I didn't review deeply, but > those patches let some internal data structure of the provider > driver to be exposed to user for debugging purpose, which is very > useful. > > Given UMR QP is one such core QP that might need debugging as well > in future and some other internal UD QPs that Bodong is working on. > Given that it might be useful to debug such internal QP as > well. Having them resource tracked is useful instead of opting out. > So not tracking them further creates blockers to not able to debug > them in future. Yes, that seems to be likely. Someone will ultimately have to add new methods and revise mlx5. It really shouldn't be creating resources prior to registering.. > > At least that way we still protect the ULPs on other non-broken drivers. > Not sure if any other drivers have dangling resources after ib_unregister_device() is called. > Otherwise Leon' patch would have notrack() API invoked in other provider drivers too. It is more the ULPs that worry me. ULPs leaving dangling resources after client unregister seems kind of likely. > > Maybe restrack_init should be moved to the register as well in this patch? > That alleast avoids the confusing code. What if we add this hunk to the patch? Leon? Jason --- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 0ab99e62cc5ce0..247f2be0a1516b 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -464,6 +464,12 @@ int ib_register_device(struct ib_device *device, struct ib_udata uhw = {.outlen = 0, .inlen = 0}; struct device *parent = device->dev.parent; + /* + * Nothing is permitted to create objects prior to calling + * register_device. + */ + rdma_restrack_clean(&device->res); + WARN_ON_ONCE(device->dma_device); if (device->dev.dma_ops) { /*