From: Jason Gunthorpe <jgg@ziepe.ca>
To: "Wan, Kaike" <kaike.wan@intel.com>
Cc: "Dalessandro, Dennis" <dennis.dalessandro@intel.com>,
"dledford@redhat.com" <dledford@redhat.com>,
"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
"Marciniszyn, Mike" <mike.marciniszyn@intel.com>
Subject: Re: [PATCH for-next 3/3] IB/hfi1: Use the ibdev in hfi1_devdata as the parent of cdev
Date: Fri, 20 Mar 2020 13:32:27 -0300 [thread overview]
Message-ID: <20200320163227.GS20941@ziepe.ca> (raw)
In-Reply-To: <MW3PR11MB46651022C7EFD74C856675E1F4F50@MW3PR11MB4665.namprd11.prod.outlook.com>
On Fri, Mar 20, 2020 at 04:09:36PM +0000, Wan, Kaike wrote:
> > 2) WTF? Why is it changing the devt inside a struct ib_device??
> This is needed to create /dev/hfi1_xxx. See below.
Well, you can't do this, that belongs to the ib_device, not the
driver.
> > Why is it calling kobject_set_name()? Look in Documentation/kobject.txt.
> > This function isn't supposed to be used.
> There is no need to set the kobject name in cdev. Will be removed.
So the hfi1_0 name is actually the name of the ib device? But that
makes no sense, now the name of the char dev is not going to be stable
in sysfs after the ib_device is renamed.
> > Shouldn't there be a struct device to anchor this in sysfs? I'm very confused
> > how this is working, where did the hif1_xx sysfs directory come
> > from?
> Yes, ib_device is the struct device the cdev is anchored to. All we
> do here is to imitate what is done in cdev_device_add(), as
> suggested by you previously.
I said to use cdev_device_add because that is the right thing to do.
> If this is not desirable, we could keep the current approach to
> create the struct device dynamically through device_create(). In
> that case, all we need to do is to clean up the code. Which one do
> you prefer?
The issue here was parentage. There should not be a virtual device
involved.
The hfi1 user_class device should be parented to the ib_device, look
at how things like umad work to do this properly.
And of course refcounting is tricky, so the cdev and this other device
must be in the same struct, again refer to umad.
Jason
next prev parent reply other threads:[~2020-03-20 16:32 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-16 21:04 [PATCH for-next 0/3] Clean up and improvements for 5.7 Dennis Dalessandro
2020-03-16 21:04 ` [PATCH for-next 1/3] IB/rdmavt: Delete unused routine Dennis Dalessandro
2020-03-16 21:05 ` [PATCH for-next 2/3] IB/hfi1: Remove kobj from hfi1_devdata Dennis Dalessandro
2020-03-16 21:05 ` [PATCH for-next 3/3] IB/hfi1: Use the ibdev in hfi1_devdata as the parent of cdev Dennis Dalessandro
2020-03-18 13:31 ` Jason Gunthorpe
2020-03-18 16:02 ` Wan, Kaike
2020-03-18 16:34 ` Jason Gunthorpe
2020-03-18 17:13 ` Wan, Kaike
2020-03-18 23:18 ` Jason Gunthorpe
2020-03-20 12:19 ` Wan, Kaike
2020-03-20 16:09 ` Wan, Kaike
2020-03-20 16:32 ` Jason Gunthorpe [this message]
2020-03-20 17:30 ` Wan, Kaike
2020-03-20 17:33 ` Jason Gunthorpe
2020-03-18 23:28 ` [PATCH for-next 0/3] Clean up and improvements for 5.7 Jason Gunthorpe
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=20200320163227.GS20941@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=dennis.dalessandro@intel.com \
--cc=dledford@redhat.com \
--cc=kaike.wan@intel.com \
--cc=linux-rdma@vger.kernel.org \
--cc=mike.marciniszyn@intel.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).