From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93D40C11D0C for ; Thu, 20 Feb 2020 19:27:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 696B2208C4 for ; Thu, 20 Feb 2020 19:27:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="aVVlxkmE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728368AbgBTT1p (ORCPT ); Thu, 20 Feb 2020 14:27:45 -0500 Received: from mail-qv1-f66.google.com ([209.85.219.66]:42202 "EHLO mail-qv1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728334AbgBTT1p (ORCPT ); Thu, 20 Feb 2020 14:27:45 -0500 Received: by mail-qv1-f66.google.com with SMTP id dc14so2425660qvb.9 for ; Thu, 20 Feb 2020 11:27:45 -0800 (PST) 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=nUozYIkh0i8DU+wPMPYypmV4LSBzg3fvJQVbP0NF19U=; b=aVVlxkmEL23fXzjpVt1O/bNwtvN016VPrPsihJn7xfGuAXQc6nQFH8CGmIjKLsKpRw dlp+/astzBJYJQsd+HcMBsAvwmcxqnPC2L9gNMZuLLBz9iwqwaho58RC27GiJ6XeD1ka nFxvBGqfHERvZAZjeTAKKd1fW5d8Qph6hQz/mSGwcA2O/q98E7vwcKyhuKxpWjHZu63A sAIG7psOeVl3A/UWwaE1bcehaUS5B29jm5M5pxuos0fX175q8RYD/Fsfg5m5/M5/vk+i rE23UcmQC7c7F+vh/0tOpKz8su539jJZoNFLCIwZmDEQrEMp2KVa+jbmlPfMBW4d/hia VXSA== 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=nUozYIkh0i8DU+wPMPYypmV4LSBzg3fvJQVbP0NF19U=; b=J/QE8OkwBSDumW1uUyk2tQXlQ8oUMOe8cFfhi45OQhz3y0WCWg0beM3ya+bfgBMcmM 4ilRAs9kSp71eb2evGJAwfRTRitPHBmM2FWfkRfFvrSBAUO6opxJoKGgP9ucpj9pnuNh xd/uz35IXY4oDSPpxkWtZm0fTuWEG2+NT+oZ0p1fVOuvRt0lmQOamw4h+BNtshaSbvXE jNtEvau86cAuY1wzsdHa1IBcI9f2f6LAFShV6dMGws1Vm1yhVvI5ZqeXHlyhcybOF9+A vfWN64YmRbXm+MHLrREefL/llU3RGz30uIpBjTElZpa1bOgMp9SbBvZh35dHdPYp5M0a KYMA== X-Gm-Message-State: APjAAAX/nlKR3GDL1jSXdTAAhHvqqIXp6y/nAk2MC9Tqce8hJvMdlCkF 1sRSltcOe6hyTt3bapInsWrPNA== X-Google-Smtp-Source: APXvYqzdvdh4nMl++9Dc7ZrNJO23gvdzS8NJbsAVUjtvTxPN8Dtttw4XRUj+5/HNbSpuM4HGiYxzYg== X-Received: by 2002:a0c:ab13:: with SMTP id h19mr26696830qvb.243.1582226864726; Thu, 20 Feb 2020 11:27:44 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-68-57-212.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.57.212]) by smtp.gmail.com with ESMTPSA id m27sm288868qta.21.2020.02.20.11.27.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Feb 2020 11:27:44 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1j4rU7-0007w0-S2; Thu, 20 Feb 2020 15:27:43 -0400 Date: Thu, 20 Feb 2020 15:27:43 -0400 From: Jason Gunthorpe To: "Ertman, David M" Cc: Greg KH , "Kirsher, Jeffrey T" , "davem@davemloft.net" , "netdev@vger.kernel.org" , "linux-rdma@vger.kernel.org" , "nhorman@redhat.com" , "sassmann@redhat.com" , "parav@mellanox.com" , "galpress@amazon.com" , "selvin.xavier@broadcom.com" , "sriharsha.basavapatna@broadcom.com" , "benve@cisco.com" , "bharat@chelsio.com" , "xavier.huwei@huawei.com" , "yishaih@mellanox.com" , "leonro@mellanox.com" , "mkalderon@marvell.com" , "aditr@vmware.com" , "Patil, Kiran" , "Bowers, AndrewX" Subject: Re: [RFC PATCH v4 01/25] virtual-bus: Implementation of Virtual Bus Message-ID: <20200220192743.GD31668@ziepe.ca> References: <20200212191424.1715577-1-jeffrey.t.kirsher@intel.com> <20200212191424.1715577-2-jeffrey.t.kirsher@intel.com> <20200214170240.GA4034785@kroah.com> <20200214203455.GX31668@ziepe.ca> <20200214204500.GC4086224@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Thu, Feb 20, 2020 at 06:55:28PM +0000, Ertman, David M wrote: > > From: Greg KH > > Sent: Friday, February 14, 2020 12:45 PM > > To: Jason Gunthorpe > > Cc: Kirsher, Jeffrey T ; davem@davemloft.net; > > Ertman, David M ; netdev@vger.kernel.org; > > linux-rdma@vger.kernel.org; nhorman@redhat.com; > > sassmann@redhat.com; parav@mellanox.com; galpress@amazon.com; > > selvin.xavier@broadcom.com; sriharsha.basavapatna@broadcom.com; > > benve@cisco.com; bharat@chelsio.com; xavier.huwei@huawei.com; > > yishaih@mellanox.com; leonro@mellanox.com; mkalderon@marvell.com; > > aditr@vmware.com; Patil, Kiran ; Bowers, AndrewX > > > > Subject: Re: [RFC PATCH v4 01/25] virtual-bus: Implementation of Virtual Bus > > > > On Fri, Feb 14, 2020 at 04:34:55PM -0400, Jason Gunthorpe wrote: > > > On Fri, Feb 14, 2020 at 09:02:40AM -0800, Greg KH wrote: > > > > > + put_device(&vdev->dev); > > > > > + ida_simple_remove(&virtbus_dev_ida, vdev->id); > > > > > > > > You need to do this before put_device(). > > > > > > Shouldn't it be in the release function? The ida index should not be > > > re-used until the kref goes to zero.. > > The IDA should not be reused until the virtbus_device is unregistered. We > don't want another device with the same name and same IDA to be > registered, Unregistration of the virtbus_device always happens before release. release is the point when the kref goes to zero and you can be confident there are no other threads reading the index or the device name. Remember, the put_device() above is not guarenteed to be the one that calls to release.. Jason