Re: [RFC] rdma/uverbs: Sketch for an ioctl framework

Jason Gunthorpe
2016-05-27T16:50:23Z

On Fri, May 27, 2016 at 12:22:56AM +0000, Hefty, Sean wrote:

> A lock associated with the idr is held while objects are acquired.
> A simple reference count is bumped for each object when used. If
> exclusive access is required, a flag is set. If the exclusive flag
> is set, then any attempt to acquire the object is rejected and the
> ioctl fails.

How is that different from your basic idr+kref locking scheme common
in the kernel?

What is a non-blocking exclusive useful for? Removal?

> Coordination with the removal of the kernel client (i.e. device) is
> done using a rw-lock. Ioctls acquire a read lock, while the removal
> processing acquires the write lock.

uverbs ended up using a more complex srcu scheme for this citing
performance reasons.. I argued for the simpler rwlock at the time..

> synchronization seems sufficient. Any lower-level locking is the
> responsibility of the kernel client.

So there are still object locks, but the core doesn't help with them
at all.

Jason