This is required to avoid data corruption bugs, where a getattr slices
itself within a setattr operation, and sets the size to the stall value
it got from the filesystem. That value is smaller than the one set by
setattr, and the call to uvm_vnp_setsize() trigged a spurious truncate.
The result is a chunk of zeroed data in the file.
Such a situation can easily happen when the ioflush thread issue a
VOP_FSYNC/puffs_vnop_sync/flushvncache/dosetattrn while andother process
do a sys_stat/VOP_GETATTR/puffs_vnop_getattr.
This mutex on size operation can be removed the day we decide VOP_GETATTR
has to operated on a locked vnode, since the other operations that touch
size already require that.
(virq_timer_to_evtch, indexed by cpuid) different from the
VIRQ <> event channel one (virq_to_evtch, indexed by event channel ID).
This is fine: fix a "harmless" bug that resulted in the event
channel of VIRQ_TIMER getting lost during bind as it was not stored
in the proper array.
"Harmless" because it is not critical for -current, however in the Xen
save/restore branch this completely cripples restore. Xen clock gets
suspended, but never comes back (fetched channel ID being invalid). Oops.
Add a small comment so we can better see the "get => allocate? => set"
chain of actions when binding/unbinding event channels.
mlelstv@ tracking down the real issue.
sp_tlb_flush() makes various assumptions about the ABI and what GCC
will do with the rest of this function. the inputs were not referenced
by name but only as "%o0" etc inside the asm. the result was that GCC
was not filling in the function parameters before calling it because
they were not used in the function. so, sp_tlb_flush() was getting
random data for it's inputs. oops.
for now, convert 2 asm() calls to pure C, and mark the inputs for
the sta calls. this makes GCC generate the right code, but it still
isn't entirely optimal.
ideally a pure C version would exist, but that adds non-trivial
overhead (15 instructions vs 23 or so.)
one more enhancement to make here would be to assign the %o3, %o4 and
%o5 usage into explicit temp variables, instead of assuming that they
are going to be free to use.