public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Matan Barak <matanb-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
Cc: Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Haggai Eran <haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH for-next V6 05/10] IB/core: Add RoCE GID table management
Date: Thu, 23 Jul 2015 13:05:08 -0600	[thread overview]
Message-ID: <20150723190508.GA31577@obsidianresearch.com> (raw)
In-Reply-To: <CAAKD3BA2Qgw87uXiS-M9gO1-jXPfQncyWzscMuusMABPRRzA8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Tue, Jul 21, 2015 at 11:42:29AM +0300, Matan Barak wrote:
> On Fri, Jul 17, 2015 at 10:02 PM, Jason Gunthorpe
> <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> wrote:
> > On Wed, Jun 24, 2015 at 03:59:21PM +0300, Matan Barak wrote:
> >> +
> >> +     /* in rdma_cap_roce_gid_table, this funciton should be protected by a
> >> +      * sleep-able lock.
> >> +      */
> >> +     write_lock(&table->data_vec[ix].lock);
> >
> > I'm having a hard time understanding this comment
> >
> 
> The same function is used for both RoCE and IB. Since RoCE unlocks the
> rwlock, calls the vendor's callback and
> locks it again. If two write_gid(s) are executed simultaneously,  you
> need to protect them from writing to the
> same entry. The vendor's callback might sleep so we require a sleep-able lock.

You might want to retouch that comment a bit..

> >> +int ib_cache_gid_add(struct ib_device *ib_dev, u8 port,
> >> +                  union ib_gid *gid, struct ib_gid_attr *attr)
> >> +{
> >> +     struct ib_gid_table **ports_table =
> >> +             READ_ONCE(ib_dev->cache.gid_cache);
> >> +     /* all table reads depend on ports_table, no need for smp_rmb() */
> >> +     if (!ports_table)
> >> +             return -EOPNOTSUPP;
> >
> > This common pattern does look genuinely odd...
> >
> > The gid_cache is part of the common API, it really shouldn't be kfree'd
> > while held struct ib_devices are around. The kfree for all the cache.c
> > stuff should probably be called from ib_device_release, not from the
> > client release.
> >
> > That is actually something the current code does that is possibly
> > wrong. It is trivially fixed by moving all the kfrees to
> > ib_device_release.
> >
> 
> But cache as a whole is implemented as a client (cache_client).
> Isn't it a bit odd to free a client in ib_device_release?

The cache is part of the core code, it exports core APIs that need to
continue working as long as a ib_device object exists.

It abuses the client stuff to hook registration, that doesn't make it
'wholly implemented as a client'

It is not odd for core code to free its memory in ib_device_release.

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

  parent reply	other threads:[~2015-07-23 19:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-24 12:59 [PATCH for-next V6 00/10] Move RoCE GID management to IB/Core Matan Barak
2015-06-24 12:59 ` [PATCH for-next V6 01/10] net/ipv6: Export addrconf_ifid_eui48 Matan Barak
2015-06-24 12:59 ` [PATCH for-next V6 03/10] net/bonding: Export bond_option_active_slave_get_rcu Matan Barak
     [not found] ` <1435150766-6803-1-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-06-24 12:59   ` [PATCH for-next V6 02/10] net: Add info for NETDEV_CHANGEUPPER event Matan Barak
2015-06-24 12:59   ` [PATCH for-next V6 04/10] IB/core: Add rwsem to allow reading device list or client list Matan Barak
     [not found]     ` <1435150766-6803-5-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-07-13 17:29       ` Jason Gunthorpe
2015-06-24 12:59   ` [PATCH for-next V6 05/10] IB/core: Add RoCE GID table management Matan Barak
     [not found]     ` <1435150766-6803-6-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-07-17 19:02       ` Jason Gunthorpe
     [not found]         ` <20150717190245.GA20632-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-21  8:42           ` Matan Barak
     [not found]             ` <CAAKD3BA2Qgw87uXiS-M9gO1-jXPfQncyWzscMuusMABPRRzA8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-23 19:05               ` Jason Gunthorpe [this message]
2015-06-24 12:59   ` [PATCH for-next V6 06/10] IB/core: Add RoCE table bonding support Matan Barak
2015-06-24 12:59   ` [PATCH for-next V6 07/10] net/mlx4: Postpone the registration of net_device Matan Barak
2015-06-24 12:59   ` [PATCH for-next V6 08/10] IB/mlx4: Implement ib_device callbacks Matan Barak
2015-06-24 12:59   ` [PATCH for-next V6 09/10] IB/mlx4: Replace mechanism for RoCE GID management Matan Barak
2015-06-24 12:59   ` [PATCH for-next V6 10/10] RDMA/ocrdma: Incorporate the moving of GID Table mgmt to IB/Core Matan Barak
2015-06-25  8:34   ` [PATCH for-next V6 00/10] Move RoCE GID management " Or Gerlitz
     [not found]     ` <CAJ3xEMjZgMPWA0jm3ReM4Cb1Q-Gz-vXh=XguSYUMAVD+qPA6Zg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-25 18:13       ` Jason Gunthorpe
     [not found]         ` <20150625181357.GG21033-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-06-29 14:07           ` Or Gerlitz

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=20150723190508.GA31577@obsidianresearch.com \
    --to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=matanb-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
    --cc=matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    /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