linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>, linux-rdma@vger.kernel.org
Subject: Re: Finding the namespace of a struct ib_device
Date: Mon, 7 Sep 2020 10:18:19 +0300	[thread overview]
Message-ID: <20200907071819.GL55261@unreal> (raw)
In-Reply-To: <9f8984ec-31e4-d71e-d55e-5cf115066e96@oracle.com>

On Mon, Sep 07, 2020 at 11:33:38AM +0800, Ka-Cheong Poon wrote:
> On 9/6/20 3:44 PM, Leon Romanovsky wrote:
> > On Fri, Sep 04, 2020 at 10:02:10PM +0800, Ka-Cheong Poon wrote:
> > > On 9/4/20 7:32 PM, Jason Gunthorpe wrote:
> > > > On Fri, Sep 04, 2020 at 12:01:12PM +0800, Ka-Cheong Poon wrote:
> > > > > On 9/4/20 1:39 AM, Jason Gunthorpe wrote:
> > > > > > On Thu, Sep 03, 2020 at 10:02:01PM +0800, Ka-Cheong Poon wrote:
> > > > > > > When a struct ib_client's add() function is called. is there a
> > > > > > > supported method to find out the namespace of the passed in
> > > > > > > struct ib_device?  There is rdma_dev_access_netns() but it does
> > > > > > > not return the namespace.  It seems that it needs to have
> > > > > > > something like the following.
> > > > > > >
> > > > > > > struct net *rdma_dev_to_netns(struct ib_device *ib_dev)
> > > > > > > {
> > > > > > >           return read_pnet(&ib_dev->coredev.rdma_net);
> > > > > > > }
> > > > > > >
> > > > > > > Comments?
> > > > > >
> > > > > > I suppose, but why would something need this?
> > > > >
> > > > >
> > > > > If the client needs to allocate stuff for the namespace
> > > > > related to that device, it needs to know the namespace of
> > > > > that device.  Then when that namespace is deleted, the
> > > > > client can clean up those related stuff as the client's
> > > > > namespace exit function can be called before the remove()
> > > > > function is triggered in rdma_dev_exit_net().  Without
> > > > > knowing the namespace of that device, coordination cannot
> > > > > be done.
> > > >
> > > > Since each device can only be in one namespace, why would a client
> > > > ever need to allocate at a level more granular than a device?
> > >
> > >
> > > A client wants to have namespace specific info.  If the
> > > device belongs to a namespace, it wants to associate those
> > > info with that device.  When a namespace is deleted, the
> > > info will need to be deleted.  You can consider the info
> > > as associated with both a namespace and a device.
> >
> > Can you be more specific about which info you are talking about?
>
>
> Actually, a lot of info can be both namespace and device specific.
> For example, a client wants to have a different PD allocation policy
> with a device when used in different namespaces.
>
>
> > And what is the client that is net namespace-aware from one side,
> > but from another separate data between them "manually"?
>
>
> Could you please elaborate what is meant by "namespace aware from
> one side but from another separate data between them manually"?
> I understand what namespace aware means.  But it is not clear what
> is meant by "separating data manually".  Do you mean having different
> behavior in different namespaces?  If this is the case, there is
> nothing special here.  An admin may choose to have different behavior
> in different namespaces.  There is nothing manual going on in the
> client code.

We are talking about net-namespaces, and as we wrote above, the ib_device
that supports such namespace can exist only in a single one

The client that implemented such support can check its namespace while
"client->add" is called. It should be equal to be seen by ib_device.

See:
 rdma_dev_change_netns ->
 	enable_device_and_get ->
		add_client_context ->
			client->add(device)


"Manual" means that client will store results of first client->add call
(in init_net NS) and will use globally stored data for other NS, which
is not netdev way to work with namespaces. The expectation that they are
separated without shared data between.

Thanks

>
>
> --
> K. Poon
> ka-cheong.poon@oracle.com
>
>

  reply	other threads:[~2020-09-07  7:18 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03 14:02 Finding the namespace of a struct ib_device Ka-Cheong Poon
2020-09-03 17:39 ` Jason Gunthorpe
2020-09-04  4:01   ` Ka-Cheong Poon
2020-09-04 11:32     ` Jason Gunthorpe
2020-09-04 14:02       ` Ka-Cheong Poon
2020-09-06  7:44         ` Leon Romanovsky
2020-09-07  3:33           ` Ka-Cheong Poon
2020-09-07  7:18             ` Leon Romanovsky [this message]
2020-09-07  8:24               ` Ka-Cheong Poon
2020-09-07  9:04                 ` Leon Romanovsky
2020-09-07  9:28                   ` Ka-Cheong Poon
2020-09-07 10:22                     ` Leon Romanovsky
2020-09-07 13:48                       ` Ka-Cheong Poon
2020-09-29 16:57                         ` RDMA subsystem namespace related questions (was Re: Finding the namespace of a struct ib_device) Ka-Cheong Poon
2020-09-29 17:40                           ` Jason Gunthorpe
2020-09-30 10:32                             ` Ka-Cheong Poon
2020-10-02 14:04                               ` Jason Gunthorpe
2020-10-05 10:27                                 ` Ka-Cheong Poon
2020-10-05 13:16                                   ` Jason Gunthorpe
2020-10-05 13:57                                     ` Ka-Cheong Poon
2020-10-05 14:25                                       ` Jason Gunthorpe
2020-10-05 15:02                                         ` Ka-Cheong Poon
2020-10-05 15:45                                           ` Jason Gunthorpe
2020-10-06  9:36                                             ` Ka-Cheong Poon
2020-10-06 12:46                                               ` Jason Gunthorpe
2020-10-07  8:38                                                 ` Ka-Cheong Poon
2020-10-07 11:16                                                   ` Leon Romanovsky
2020-10-08 10:22                                                     ` Ka-Cheong Poon
2020-10-08 10:36                                                       ` Leon Romanovsky
2020-10-08 11:08                                                         ` Ka-Cheong Poon
2020-10-08 16:08                                                           ` Jason Gunthorpe
2020-10-08 16:21                                                             ` Chuck Lever
2020-10-08 16:46                                                               ` Jason Gunthorpe
2020-10-09  4:49                                                             ` Ka-Cheong Poon
2020-10-09 14:39                                                               ` Jason Gunthorpe
2020-10-09 14:48                                                                 ` Chuck Lever
2020-10-09 14:57                                                                   ` Jason Gunthorpe
2020-10-09 15:00                                                                     ` Chuck Lever
2020-10-09 15:07                                                                       ` Jason Gunthorpe
2020-10-09 15:27                                                                         ` Chuck Lever
2020-10-09 15:34                                                                           ` Jason Gunthorpe
2020-10-09 15:52                                                                             ` Chuck Lever
2020-10-12  8:20                                                                             ` Ka-Cheong Poon
2020-10-16 18:54                                                                               ` Jason Gunthorpe
2020-10-16 20:49                                                                                 ` Chuck Lever
2020-10-19 18:31                                                                                   ` Jason Gunthorpe
2020-10-07 12:28                                                   ` Jason Gunthorpe
2020-10-08 10:49                                                     ` Ka-Cheong Poon

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=20200907071819.GL55261@unreal \
    --to=leon@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=ka-cheong.poon@oracle.com \
    --cc=linux-rdma@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).