On 12/23/22 15:23, Chuang Xu wrote:
static inline FlatView *address_space_to_flatview(AddressSpace *as)
{
+ /*
+ * Before using any flatview, sanity check we're not during a memory
+ * region transaction or the map can be invalid. Note that this can
+ * also be called during commit phase of memory transaction, but that
+ * should also only happen when the depth decreases to 0 first.
+ */
+ assert(memory_region_transaction_get_depth() == 0 || rcu_read_locked());
return qatomic_rcu_read(&as->current_map);
}
This is not valid because the transaction could happen in *another*
thread. In that case memory_region_transaction_depth() will be > 0, but
RCU is needed.
Paolo