On Tue, 7 Jun 2016, David Brownlee wrote:
Any good MP-safe suggestions?
Other than having the mutex be for a nullable pointer to the device
which persists after driver detach and is reattached when the driver
reattaches, which adds an extra pointer dereference for every use...
:/
Well, yeah, except then you'd need one of these pointers for every
possible module-provided device, right? And the pointers would need to
be somewhere permantently allocated, not within each module...
I suppose that, within the device's open() routine, we could use
mutex_tryenter() to grab the refcount mutex or fail-immediately. In
this case, the open() routine could immediately return with EAGAIN (or
maybe EINTR, which is already a documented possible error from open()).
At least this mechanism wouldn't let the process resume at some later
time and at some unmapped memory address.
:)
+------------------+--------------------------+------------------------+
| Paul Goyette | PGP Key fingerprint: | E-mail addresses: |
| (Retired) | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org |
+------------------+--------------------------+------------------------+