[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v1 4/5] vpci: use separate rangeset for BAR unmapping



On Sat, May 31, 2025 at 08:54:02AM -0400, Stewart Hildebrand wrote:
> Introduce a new per-BAR rangeset, unmap_mem, for p2m unmapping. Rename
> existing mem rangeset to map_mem, which is now only used for mapping.
> Populate unmap_mem by moving just-mapped ranges from map_mem to
> unmap_mem. In modify_bars(), skip recalculating the ranges when
> unmapping as they are already stored in unmap_mem.

I'm afraid the copying of ranges from map_mem to unmap_mem is not fully
correct.

The calculations in modify_bars() take into account overlaps between
BARs.  Given the following set of actions:

1. Map dev#0 BAR0.
2. Cache mapped regions for dev#0 BAR0.
3. Map dev#1 BAR0 that overlaps with dev#0 BAR0.
4. Unmap dev#0 BAR0 using the cached regions.

The unmap of dev#0 BAR0 will also have the side-effect of unmapping
dev#1 BAR0, which is wrong.  That's why modify_bars() must be called
for every map and unmap operation.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.