From: Dennis Dalessandro <dennis.dalessandro@intel.com>
To: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Cc: dledford@redhat.com, linux-rdma@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 0/5] IB/hfi1: Remove write() and use ioctl() for user access
Date: Thu, 12 May 2016 15:07:38 -0400 [thread overview]
Message-ID: <20160512190738.GA15146@phlsvsds.ph.intel.com> (raw)
In-Reply-To: <20160512173445.GA13553@obsidianresearch.com>
On Thu, May 12, 2016 at 11:34:45AM -0600, Jason Gunthorpe wrote:
>On Thu, May 12, 2016 at 10:18:27AM -0700, Dennis Dalessandro wrote:
>
>> There is also a driver software version being exported via a sysfs
>> file. This is needed so that user space applications (psm) can
>> determine if it needs to do ioctl() or write().
>
>Why? Don't do this, just call ioctl() and if it fails then use write().
Is it really that big of a deal to export a version number?
There are cases where psm could be built with a different kernel (depends on
a header file) than the currently running one. This allows psm to check the
current running version with what it was built against. This could be useful
for other scenarios in the future as well. Not just the write vs ioctl.
>> This does not add anything for compat_ioctl() as it is my understanding that
>> 32 bit applications that attempt to call the ioctl() will just fail. Which is
>> the intended behavior.
>
>qib works fine with a 64 bit kernel and 32 bit user space, don't
>break it.
We will handle this issue when we get to the qib patches. I want to hammer
out what the solution for hfi1 looks like first.
>> There is also a question of if we need to set kobj.parent [1], I'm
>
>It is needed, you need to audit this stuff, there might be more wrong
>than that.
>> not sure this is the case since the cdev in question lives
>> in /dev, not /dev/infiniband.
>
>Irrelevant. kobj.parent is needed because the cdev is embedded within
>another reference counted structure. You need to consider how all this
>works when the driver is removed while the cdev is still open (or
>driver remove is racing with the cdev release).
The driver can't be removed while the cdev is still open. I tested with a
test code that opens /dev/hfi1_0 and spins. The use count as reported by
lsmod ticks up and the driver can not be unloaded until I ctrl+c the test
program.
Are you saying the driver's cdev release function could race with the
drivers moudle_exit()? I don't think this happens. I put a sleep in the
release function and ctrl+c my test program and it hangs until the sleep
expires. I tried to rmmod the driver (during the window) and it fails as
in use.
-Denny
next prev parent reply other threads:[~2016-05-12 19:07 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-12 17:18 [PATCH v2 0/5] IB/hfi1: Remove write() and use ioctl() for user access Dennis Dalessandro
2016-05-12 17:18 ` [PATCH v2 1/5] IB/hfi1: Export drivers user sw version via sysfs Dennis Dalessandro
2016-05-12 17:18 ` [PATCH v2 2/5] IB/hfi1: Remove unused user command Dennis Dalessandro
2016-05-12 17:18 ` [PATCH v2 3/5] IB/hfi1: Add ioctl() interface for user commands Dennis Dalessandro
2016-05-12 17:43 ` Jason Gunthorpe
2016-05-12 18:12 ` Hefty, Sean
2016-05-12 19:27 ` Dennis Dalessandro
2016-05-12 19:40 ` Jason Gunthorpe
2016-05-12 19:48 ` Doug Ledford
2016-05-12 21:28 ` Jason Gunthorpe
2016-05-13 14:33 ` Dennis Dalessandro
2016-05-13 20:54 ` ira.weiny
2016-05-12 17:18 ` [PATCH v2 4/5] IB/hfi1: Remove write(), use ioctl() for user cmds Dennis Dalessandro
2016-05-12 17:18 ` [PATCH v2 5/5] IB/hfi1: Add trace message in user IOCTL handling Dennis Dalessandro
2016-05-12 17:34 ` [PATCH v2 0/5] IB/hfi1: Remove write() and use ioctl() for user access Jason Gunthorpe
2016-05-12 19:07 ` Dennis Dalessandro [this message]
2016-05-12 19:25 ` Jason Gunthorpe
2016-05-12 19:53 ` Dennis Dalessandro
2016-05-12 20:31 ` Doug Ledford
2016-05-12 21:27 ` 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=20160512190738.GA15146@phlsvsds.ph.intel.com \
--to=dennis.dalessandro@intel.com \
--cc=dledford@redhat.com \
--cc=jgunthorpe@obsidianresearch.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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).