All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Dennis Dalessandro <dennis.dalessandro@intel.com>
Cc: "Saleem, Shiraz" <shiraz.saleem@intel.com>,
	Weihang Li <liweihang@huawei.com>,
	"dledford@redhat.com" <dledford@redhat.com>,
	"leon@kernel.org" <leon@kernel.org>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"linuxarm@huawei.com" <linuxarm@huawei.com>,
	"selvin.xavier@broadcom.com" <selvin.xavier@broadcom.com>,
	"devesh.sharma@broadcom.com" <devesh.sharma@broadcom.com>,
	"somnath.kotur@broadcom.com" <somnath.kotur@broadcom.com>,
	"sriharsha.basavapatna@broadcom.com" 
	<sriharsha.basavapatna@broadcom.com>,
	"bharat@chelsio.com" <bharat@chelsio.com>,
	"galpress@amazon.com" <galpress@amazon.com>,
	"sleybo@amazon.com" <sleybo@amazon.com>,
	"Latif, Faisal" <faisal.latif@intel.com>,
	"yishaih@mellanox.com" <yishaih@mellanox.com>,
	"mkalderon@marvell.com" <mkalderon@marvell.com>,
	"aelior@marvell.com" <aelior@marvell.com>,
	"benve@cisco.com" <benve@cisco.com>,
	"neescoba@cisco.com" <neescoba@cisco.com>,
	"pkaustub@cisco.com" <pkaustub@cisco.com>,
	"aditr@vmware.com" <aditr@vmware.com>,
	"pv-drivers@vmware.com" <pv-drivers@vmware.com>,
	"monis@mellanox.com" <monis@mellanox.com>,
	"kamalheib1@gmail.com" <kamalheib1@gmail.com>,
	"parav@mellanox.com" <parav@mellanox.com>,
	"markz@mellanox.com" <markz@mellanox.com>,
	"rd.dunlab@gmail.com" <rd.dunlab@gmail.com>
Subject: Re: [PATCH for-next] RDMA/core: Assign the name of device when allocating ib_device
Date: Wed, 29 Apr 2020 10:50:15 -0300	[thread overview]
Message-ID: <20200429135015.GA26002@ziepe.ca> (raw)
In-Reply-To: <9a875620-3f11-22ee-b908-59c8e49e3b24@intel.com>

On Wed, Apr 29, 2020 at 09:32:16AM -0400, Dennis Dalessandro wrote:
> On 4/27/2020 8:04 PM, Jason Gunthorpe wrote:
> > On Mon, Apr 27, 2020 at 05:55:57PM +0000, Saleem, Shiraz wrote:
> > > > Subject: [PATCH for-next] RDMA/core: Assign the name of device when allocating
> > > > ib_device
> > > > 
> > > > If the name of a device is assigned during ib_register_device(), some drivers have
> > > > to use dev_*() for printing before register device. Bring
> > > > assign_name() into ib_alloc_device(), so that drivers can use ibdev_*() anywhere.
> > > > 
> > > > Signed-off-by: Weihang Li <liweihang@huawei.com>
> > > >   drivers/infiniband/core/device.c               | 85 +++++++++++++-------------
> > > >   drivers/infiniband/hw/bnxt_re/main.c           |  4 +-
> > > >   drivers/infiniband/hw/cxgb4/device.c           |  2 +-
> > > >   drivers/infiniband/hw/cxgb4/provider.c         |  2 +-
> > > >   drivers/infiniband/hw/efa/efa_main.c           |  4 +-
> > > >   drivers/infiniband/hw/hns/hns_roce_hw_v1.c     |  2 +-
> > > >   drivers/infiniband/hw/hns/hns_roce_hw_v2.c     |  2 +-
> > > >   drivers/infiniband/hw/hns/hns_roce_main.c      |  2 +-
> > > >   drivers/infiniband/hw/i40iw/i40iw_verbs.c      |  4 +-
> > > >   drivers/infiniband/hw/mlx4/main.c              |  4 +-
> > > >   drivers/infiniband/hw/mlx5/ib_rep.c            |  8 ++-
> > > >   drivers/infiniband/hw/mlx5/main.c              | 18 +++---
> > > >   drivers/infiniband/hw/mthca/mthca_main.c       |  2 +-
> > > >   drivers/infiniband/hw/mthca/mthca_provider.c   |  2 +-
> > > >   drivers/infiniband/hw/ocrdma/ocrdma_main.c     |  4 +-
> > > >   drivers/infiniband/hw/qedr/main.c              |  4 +-
> > > >   drivers/infiniband/hw/usnic/usnic_ib_main.c    |  4 +-
> > > >   drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c |  4 +-
> > > >   drivers/infiniband/sw/rxe/rxe.c                |  4 +-
> > > >   drivers/infiniband/sw/rxe/rxe.h                |  2 +-
> > > >   drivers/infiniband/sw/rxe/rxe_net.c            |  4 +-
> > > >   drivers/infiniband/sw/rxe/rxe_verbs.c          |  4 +-
> > > >   drivers/infiniband/sw/rxe/rxe_verbs.h          |  2 +-
> > > >   include/rdma/ib_verbs.h                        |  8 +--
> > > >   24 files changed, 95 insertions(+), 86 deletions(-)
> > > 
> > > I think you ll need to update siw driver similarly.
> > > 
> > > rvt_register_device should be adapted to use the revised device registration API.
> > > hfi1/qib also need some rework.
> > 
> > It is necessary to make such a big change? :(
> > 
> > > rvt_alloc_device needs to be adapted for the new one-shot
> > > name + device allocation scheme.
> > > Hoping we can just use move the name setting from rvt_set_ibdev_name
> > 
> > I thought so..
> > 
> 
> The issue is hfi1 calls into rvt_alloc_device() which then calls
> _ib_alloc_device(). We don't have the name set at that point. So the obvious
> thing to do is move the rvt_set_ibdev_name(). However there is a catch.
> 
> The name gets set after allocating the device and the device table because
> we get the unit number as part of the xa_alloc_irq(hfi1_dev_table) call
> which needs the pointer to the devdata.
> 
> One solution would be to pass in the pointer for the driver's dev table and
> let rvt_alloc_device() do the xa_alloc_irq().

Just do:

	ret = xa_alloc_irq(&hfi1_dev_table, &unit, NULL, xa_limit_32b,
			GFP_KERNEL);
        if (ret)
                return ERR_PTR(ret);

	dd = (struct hfi1_devdata *)rvt_alloc_device(sizeof(*dd) + extra,
						     nports, unit);
	if (!dd) {
		xa_erase(&hfi1_dev_table, unit);
		return ERR_PTR(-ENOMEM);
	}
	xa_store(&hfi1_dev_table, unit, dd, GFP_KERNEL);

Jason

  reply	other threads:[~2020-04-29 13:50 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-26  9:31 [PATCH for-next] RDMA/core: Assign the name of device when allocating ib_device Weihang Li
2020-04-27  8:45 ` Gal Pressman
2020-04-27  9:02   ` liweihang
2020-04-27 11:47 ` Leon Romanovsky
2020-04-27 11:52   ` Jason Gunthorpe
2020-04-27 12:03     ` Leon Romanovsky
2020-04-28  8:00       ` liweihang
2020-04-28 11:19         ` Leon Romanovsky
2020-04-28 12:39           ` liweihang
2020-04-29  8:37             ` Leon Romanovsky
2020-04-30  7:55               ` liweihang
2020-04-28  1:29   ` liweihang
2020-04-27 17:55 ` Saleem, Shiraz
2020-04-28  0:04   ` Jason Gunthorpe
2020-04-29 13:32     ` Dennis Dalessandro
2020-04-29 13:50       ` Jason Gunthorpe [this message]
2020-04-29 14:33         ` Dennis Dalessandro
2020-04-29 14:57           ` Jason Gunthorpe
2020-04-29 16:17             ` Dennis Dalessandro
2020-04-28  6:17   ` liweihang
2020-04-27 20:26 ` kbuild test robot
2020-04-27 20:26   ` kbuild test robot
2020-04-28  6:29 ` kbuild test robot
2020-04-28  6:29   ` kbuild test robot

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=20200429135015.GA26002@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=aditr@vmware.com \
    --cc=aelior@marvell.com \
    --cc=benve@cisco.com \
    --cc=bharat@chelsio.com \
    --cc=dennis.dalessandro@intel.com \
    --cc=devesh.sharma@broadcom.com \
    --cc=dledford@redhat.com \
    --cc=faisal.latif@intel.com \
    --cc=galpress@amazon.com \
    --cc=kamalheib1@gmail.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=liweihang@huawei.com \
    --cc=markz@mellanox.com \
    --cc=mkalderon@marvell.com \
    --cc=monis@mellanox.com \
    --cc=neescoba@cisco.com \
    --cc=parav@mellanox.com \
    --cc=pkaustub@cisco.com \
    --cc=pv-drivers@vmware.com \
    --cc=rd.dunlab@gmail.com \
    --cc=selvin.xavier@broadcom.com \
    --cc=shiraz.saleem@intel.com \
    --cc=sleybo@amazon.com \
    --cc=somnath.kotur@broadcom.com \
    --cc=sriharsha.basavapatna@broadcom.com \
    --cc=yishaih@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.