On 11/09/17 17:40, Paolo Bonzini wrote:
> On 07/09/2017 11:20, Alexey Kardashevskiy wrote:
>>
>> /* Accessed via RCU. */
>> struct FlatView *current_map;
>>
>> int ioeventfd_nb;
>> struct MemoryRegionIoeventfd *ioeventfds;
>> - struct AddressSpaceDispatch *dispatch;
>> - struct AddressSpaceDispatch *next_dispatch;
>> +
>
> The rough idea of the patch matches my suggestion indeed. However, I am
> not sure why all of the changes in patch 2 are needed.
For this:
struct MemoryRegionSection {
MemoryRegion *mr;
- AddressSpace *address_space;
+ AddressSpaceDispatch *dispatch;
as there are many ASes attached to the same flatview/dispatch.
And because of that, there is also:
struct IOMMUTLBEntry {
- AddressSpace *target_as;
+ AddressSpaceDispatch *target_dispatch;
as the "section" in address_space_get_iotlb_entry() does not have
address_space any more, even though the only user of it -
vhost_device_iotlb_miss() - only checks if (iotlb.target_dispatch != NULL).
> Once you have built the FlatView and the dispatch within it, you can
> still cache its dispatch tree in as->dispatch, and free it with RCU from
> flatview_destroy. This removes the need to use call_rcu from
> flatview_unref.
Ok, I will do that.
> In addition, you could change the computation of FlatView's root to
> resolve 2^64-sized aliases;
Here we reached the boundary of my english :)
Roots are given when AS/Flatview is created, and aliases are resolved already.
> also set it to NULL if the AddressSpace's
> root is disabled or the alias it resolves to is disabled (and so on
> recursively until a non-alias is found). This should remove the need
> for address_space_root() and the change to pci_init_bus_master.
--
Alexey