From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Gunthorpe Subject: Re: [PATCH v3 for-next 02/33] IB/core: Add kref to IB devices Date: Mon, 27 Apr 2015 10:22:56 -0600 Message-ID: <20150427162256.GA24316@obsidianresearch.com> References: <1427318422-12004-1-git-send-email-somnath.kotur@emulex.com> <9f65de5e-ed5f-48d2-bff2-03ffbe4f4876@CMEXHTCAS2.ad.emulex.com> <553DF294.4070507@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <553DF294.4070507-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> Sender: linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Matan Barak Cc: Or Gerlitz , Somnath Kotur , Roland Dreier , "linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" List-Id: linux-rdma@vger.kernel.org On Mon, Apr 27, 2015 at 11:25:56AM +0300, Matan Barak wrote: > > > On 4/26/2015 11:10 PM, Or Gerlitz wrote: > >On Thu, Mar 26, 2015 at 12:19 AM, Somnath Kotur > > wrote: > >>From: Matan Barak > >> > >>Previously. we used device_mutex lock in order to protect > >>the device's list. That means that in order to guarantee a > >>device isn't freed while we use it, we had to lock all > >>devices. > > > >Matan, looking on the cover letter, it says: "[...] Patch 0002 adds a > >reference count mechanism to IB devices. This mechanism is similar to > >dev_hold and dev_put available for net devices. This is mandatory for > >later patches [...]" > > > >So in that respect, saying here "Previously. we used device_mutex > >lock" is a bit cryptic, @ least one typo must exist in this sentence, > >right? did you want to say "Currently we use device_mutex lock for XXX > >[...] and this should be replaced as of a YYY change which is to be > >introduced [...]" please clarify > > Correct, I'll change that into: > > Currently we use device_mutex lock for protecting the device's list. > In the current approach, in order to guarantee a device isn't freed > we have to lock all devices. > > Adding a kref per IB device. Before an IB device is unregistered, we > wait until it's not held anymore. Why do we need two krefs for this structure? There is already a kref inside the embedded 'struct device dev' Sounds wrong to me without a lot more explanation. Jason -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html