netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
To: Haggai Eran <haggaie@mellanox.com>
Cc: Doug Ledford <dledford@redhat.com>,
	linux-rdma@vger.kernel.org, netdev@vger.kernel.org,
	Liran Liss <liranl@mellanox.com>,
	Guy Shapiro <guysh@mellanox.com>,
	Shachar Raindel <raindel@mellanox.com>,
	Yotam Kenneth <yotamke@mellanox.com>
Subject: Re: [PATCH v1 01/12] IB/core: pass client data to remove() callbacks
Date: Wed, 8 Jul 2015 15:34:10 -0600	[thread overview]
Message-ID: <20150708213410.GA19624@obsidianresearch.com> (raw)
In-Reply-To: <20150708202910.GA16812@obsidianresearch.com>

On Wed, Jul 08, 2015 at 02:29:10PM -0600, Jason Gunthorpe wrote:
> On Mon, Jun 22, 2015 at 03:42:30PM +0300, Haggai Eran wrote:
> > An ib_client callback that is called with the lists_rwsem locked only for
> > read is protected from changes to the IB client lists, but not from
> > ib_unregister_device() freeing its client data. This is because
> > ib_unregister_device() will remove the device from the device list with
> > lists_rwsem locked for write, but perform the rest of the cleanup,
> > including the call to remove() without that lock.
> 
> I was going to look at this, but, uh.. it seems mangled, doesn't
> apply, doesn't seem fixable from here.

Okay, I see, it sits on top of the patch from Matan's last
posting.. My bad.

Hum... I have to say I don't really like this, changing the ordering
of client_data = NULL with respect to client->remove doesn't seem like
a great idea - and the rds changes look scary to me, at least I
couldn't confidently say they were OK..

And that isn't really the issue - this has nothing to do with
client_data, it is all about not having a callback running when doing
remove.

It looks like the way out of this is to have ib_get_net_dev_by_params
iterate over the client_data_list and use a dedicated flag in that
struct to indicate that client&device combination is
remove-in-progress.

This would be a bit more efficient as well, and I would suggest
passing the context in as an arg to the callback.

client_data_list would change a bit to become write locked first by
write(lists_rwsem), and then second by the spin lock, so holding
read(lists_rwsem) while iterating is enough locking, and you'd hold
lists_rwsem while kfreeing.

Jason

  reply	other threads:[~2015-07-08 21:34 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-22 12:42 [PATCH v1 00/12] Demux IB CM requests in the rdma_cm module Haggai Eran
2015-06-22 12:42 ` [PATCH v1 01/12] IB/core: pass client data to remove() callbacks Haggai Eran
2015-07-08 20:29   ` Jason Gunthorpe
2015-07-08 21:34     ` Jason Gunthorpe [this message]
     [not found]       ` <20150708213410.GA19624-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-14 14:54         ` Haggai Eran
2015-06-22 12:42 ` [PATCH v1 02/12] IB/core: Find the network device matching connection parameters Haggai Eran
2015-07-08 20:33   ` Jason Gunthorpe
     [not found]     ` <20150708203325.GB16812-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-09 10:18       ` Haggai Eran
     [not found] ` <1434976961-27424-1-git-send-email-haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-06-22 12:42   ` [PATCH v1 03/12] IB/ipoib: Return IPoIB devices " Haggai Eran
     [not found]     ` <1434976961-27424-4-git-send-email-haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-07-08 23:41       ` Jason Gunthorpe
     [not found]         ` <20150708234111.GC16812-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-09  9:57           ` Haggai Eran
2015-06-22 12:42   ` [PATCH v1 05/12] IB/cm: Share listening CM IDs Haggai Eran
     [not found]     ` <1434976961-27424-6-git-send-email-haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-07-13 17:48       ` Jason Gunthorpe
     [not found]         ` <20150713174837.GH23832-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-14  8:45           ` Haggai Eran
     [not found]             ` <55A4CC1B.1060201-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-07-14 17:38               ` Jason Gunthorpe
2015-06-22 12:42   ` [PATCH v1 06/12] IB/cma: Refactor RDMA IP CM private-data parsing code Haggai Eran
2015-06-22 12:42   ` [PATCH v1 07/12] IB/cma: Helper functions to access port space IDRs Haggai Eran
2015-06-22 12:42   ` [PATCH v1 08/12] IB/cma: Add net_dev and private data checks to RDMA CM Haggai Eran
     [not found]     ` <1434976961-27424-9-git-send-email-haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-07-13 18:14       ` Jason Gunthorpe
     [not found]         ` <20150713181414.GJ23832-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-15 10:57           ` Haggai Eran
2015-07-15 18:49             ` Jason Gunthorpe
     [not found]               ` <20150715184934.GD23588-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-15 20:27                 ` Liran Liss
     [not found]                   ` <HE1PR05MB1418C82958B3CCF0D3531E5BB19A0-eBadYZ65MZ87O8BmmlM1zNqRiQSDpxhJvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2015-07-15 21:03                     ` Jason Gunthorpe
     [not found]                       ` <20150715210342.GA32516-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-16 12:01                         ` Liran Liss
2015-07-16 18:22                           ` Jason Gunthorpe
2015-06-22 12:42   ` [PATCH v1 09/12] IB/cma: validate routing of incoming requests Haggai Eran
2015-06-22 12:42   ` [PATCH v1 10/12] IB/cma: use found net_dev for passive connections Haggai Eran
2015-06-22 12:42   ` [PATCH v1 11/12] IB/cma: Share ib_cm_ids between rdma_cm_ids Haggai Eran
     [not found]     ` <1434976961-27424-12-git-send-email-haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-07-13 18:06       ` Jason Gunthorpe
2015-07-14  8:47         ` Haggai Eran
2015-06-22 12:42   ` [PATCH v1 12/12] IB/cm: Remove compare_data checks Haggai Eran
2015-06-22 12:42 ` [PATCH v1 04/12] IB/cm: Expose service ID in request events Haggai Eran

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150708213410.GA19624@obsidianresearch.com \
    --to=jgunthorpe@obsidianresearch.com \
    --cc=dledford@redhat.com \
    --cc=guysh@mellanox.com \
    --cc=haggaie@mellanox.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=liranl@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=raindel@mellanox.com \
    --cc=yotamke@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).