Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1400289

Re: [PATCH v2 0/5] IB/hfi1: Remove write() and use ioctl() for user access

From Dennis Dalessandro <dennis.dalessandro@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 0/5] IB/hfi1: Remove write() and use ioctl() for user access
Date 2016-05-12 21:10 +0200
Message-ID <ry49I-3um-7@gated-at.bofh.it> (permalink)
References <ry2rf-1NT-3@gated-at.bofh.it> <ry2KC-20V-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/5] IB/hfi1: Remove write() and use ioctl() for user  access Dennis Dalessandro <dennis.dalessandro@intel.com> - 2016-05-12 19:20 +0200
  [PATCH v2 3/5] IB/hfi1: Add ioctl() interface for user commands Dennis Dalessandro <dennis.dalessandro@intel.com> - 2016-05-12 19:20 +0200
    Re: [PATCH v2 3/5] IB/hfi1: Add ioctl() interface for user commands Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-05-12 19:50 +0200
      RE: [PATCH v2 3/5] IB/hfi1: Add ioctl() interface for user commands "Hefty, Sean" <sean.hefty@intel.com> - 2016-05-12 20:20 +0200
      Re: [PATCH v2 3/5] IB/hfi1: Add ioctl() interface for user commands Dennis Dalessandro <dennis.dalessandro@intel.com> - 2016-05-12 21:30 +0200
        Re: [PATCH v2 3/5] IB/hfi1: Add ioctl() interface for user commands Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-05-12 21:50 +0200
          Re: [PATCH v2 3/5] IB/hfi1: Add ioctl() interface for user commands Doug Ledford <dledford@redhat.com> - 2016-05-12 21:50 +0200
            Re: [PATCH v2 3/5] IB/hfi1: Add ioctl() interface for user commands Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-05-12 23:30 +0200
              Re: [PATCH v2 3/5] IB/hfi1: Add ioctl() interface for user commands Dennis Dalessandro <dennis.dalessandro@intel.com> - 2016-05-13 16:40 +0200
          Re: [PATCH v2 3/5] IB/hfi1: Add ioctl() interface for user commands "ira.weiny" <ira.weiny@intel.com> - 2016-05-13 23:00 +0200
  [PATCH v2 1/5] IB/hfi1: Export drivers user sw version via sysfs Dennis Dalessandro <dennis.dalessandro@intel.com> - 2016-05-12 19:20 +0200
  [PATCH v2 2/5] IB/hfi1: Remove unused user command Dennis Dalessandro <dennis.dalessandro@intel.com> - 2016-05-12 19:20 +0200
  [PATCH v2 4/5] IB/hfi1: Remove write(), use ioctl() for user cmds Dennis Dalessandro <dennis.dalessandro@intel.com> - 2016-05-12 19:20 +0200
  [PATCH v2 5/5] IB/hfi1: Add trace message in user IOCTL handling Dennis Dalessandro <dennis.dalessandro@intel.com> - 2016-05-12 19:20 +0200
  Re: [PATCH v2 0/5] IB/hfi1: Remove write() and use ioctl() for user  access Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-05-12 19:40 +0200
    Re: [PATCH v2 0/5] IB/hfi1: Remove write() and use ioctl() for user access Dennis Dalessandro <dennis.dalessandro@intel.com> - 2016-05-12 21:10 +0200
      Re: [PATCH v2 0/5] IB/hfi1: Remove write() and use ioctl() for user  access Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-05-12 21:30 +0200
        Re: [PATCH v2 0/5] IB/hfi1: Remove write() and use ioctl() for user access Dennis Dalessandro <dennis.dalessandro@intel.com> - 2016-05-12 22:00 +0200
          Re: [PATCH v2 0/5] IB/hfi1: Remove write() and use ioctl() for user  access Doug Ledford <dledford@redhat.com> - 2016-05-12 22:40 +0200
          Re: [PATCH v2 0/5] IB/hfi1: Remove write() and use ioctl() for user  access Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-05-12 23:30 +0200

csiph-web