Load vcpu with acquire semantics as we are making a critical section between creating vcpu and using it.
Details
Details
Diff Detail
Diff Detail
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
Comment Actions
In particular, this is paired with an atomic_store_rel_ptr a few lines below. I think in practice this is probably a no-op as any dependent memory accesses are reads of data that vcpu points to, and if you had a mispredicted read it would never dereference a "wrong" pointer, it would just see a NULL pointer and stop once speculation ran into a fault. That said, I do think this is more correct.
Comment Actions
This is perhaps a use-case for atomic_load_consume_ptr()? I think I agree that an acq fence is not formally required, but it looks wrong at first glance.
Comment Actions
As an aside, we have #define atomic_load_ptr(p) (*(volatile __typeof(*p) *)(p)) - I wonder why atomic_load_acq_ptr isn't similarly defined.