|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Question regarding Locking in the MMIO Handling Framework on Arm
Hello everyone,I have a question regarding the locking in the MMIO handling framework on Arm. Is it sufficient to have read_lock() only in find_mmio_handler()? Ifregister_mmio_handler() is executed in parallel with find_mmio_handler() (which I assume was the reason for introducing the rwlock), aren't we still exposed to a race condition? find_mmio_handler() returns a pointer to a handler, but the object it points to could be changed by a subsequent call to register_mmio_handler(). If register_mmio_handler() runs between find_mmio_handler() and handle_{write,read}(), we could end up operating on a different handler than the one that was originally found. In other words, shouldn't we acquire the read_lock() in try_handle_mmio() and keep it held for the entire duration of try_handle_mmio()? It seems this is not an issue at the moment because register_mmio_handler() is only called during domain creation. If that's the case, do we really need the rwlock at all? One more thing: it looks like BUG_ON(vmmio->num_entries >= vmmio->max_num_entries);in register_mmio_handler() would be better placed inside the write_lock() section. As again in the case if register_mmio_handler() will start to be called in parallel we will have an issue. Thanks in advance. ~ Oleksii
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |