mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
xen: mapcache: Fix finding matching entry
If we have request without lock and hit unlocked or invalid entry during the search, we remap it immediately, even if we have matching entry in next entries in bucket. This leads to duplication of mappings of the same size, and to possibility of selecting the wrong element during invalidation and underflow it's entry->lock counter Signed-off-by: Aleksandr Partanen <alex.pentagrid@gmail.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
This commit is contained in:
parent
a9e0c9c0f1
commit
a4b20f737c
1 changed files with 3 additions and 3 deletions
|
@ -376,12 +376,12 @@ tryagain:
|
|||
|
||||
entry = &mc->entry[address_index % mc->nr_buckets];
|
||||
|
||||
while (entry && (lock || entry->lock) && entry->vaddr_base &&
|
||||
(entry->paddr_index != address_index || entry->size != cache_size ||
|
||||
while (entry && (!entry->vaddr_base ||
|
||||
entry->paddr_index != address_index || entry->size != cache_size ||
|
||||
!test_bits(address_offset >> XC_PAGE_SHIFT,
|
||||
test_bit_size >> XC_PAGE_SHIFT,
|
||||
entry->valid_mapping))) {
|
||||
if (!free_entry && !entry->lock) {
|
||||
if (!free_entry && (!entry->lock || !entry->vaddr_base)) {
|
||||
free_entry = entry;
|
||||
free_pentry = pentry;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue