waiting for memory to be available. when we are mapping an anon or uobj page
then we will be holding the lock for that page owner, and sleeping to wait
for memory with a page owner lock held is illegal because the pagedaemon
can wait for that lock, which will lead to deadlock. fixes PR 56932.
for global commands is 0xffffffff. While the driver only supports 16bit
numbers (device minor & 0xffff), we need to use the full value for pass
through commands.
This fixes e.g. logpage requests on the controller level.
These did not cooperate with the hash-locked scheme of the other
atomic operations, with the effect that, for instance, a typical
naive spin lock based on atomic_*,
volatile unsigned locked = 0;
lock()
{
while (atomic_swap_uint(&locked, 1))
continue;
membar_acquire();
}
unlock()
{
membar_release();
atomic_store_relaxed(&locked, 0);
}
would fail to achieve mutual exclusion.
For this case, we need to use atomic_swap_* (or, for 8- or 16-bit
objects, atomic_cas_32 loops, since there is no atomic_swap_8 or
atomic_swap_16).
The new machine/types.h macro __HAVE_HASHLOCKED_ATOMICS says whether
these contortions are necessary.
Note that this _requires_ the use of atomic_store_*(p, v), not
regular stores *p = v, to work with the r/m/w atomic operations.
The more-compatible LOCK ADD $0,-N(%rsp) turns out to be cheaper
than MFENCE anyway. Let's save some space and maintenance and rip
out the hotpatching for it.
clang complains that the option has no effect and it generates hard
float instructions without the option. soft-float not really supported
on x86_64 with clang from what I can tell.
These comments are added with IFNET_LOCK by in_pcb.c:r1.180 and
in6_pcb.c:r1.162. And then, IFNET_LOCK codes are removed in
in_pcb.c:r1.183 and in6_pcb.c:r1.166, however the comments have
remained.