Skip to content

Commit

Permalink
accel/tcg: Use tb_invalidate_phys_range in page_set_flags
Browse files Browse the repository at this point in the history
Flush translation blocks in bulk, rather than page-by-page.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
rth7680 committed Oct 26, 2022
1 parent 43301e0 commit e786509
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions accel/tcg/translate-all.c
Expand Up @@ -1352,7 +1352,7 @@ int page_get_flags(target_ulong address)
void page_set_flags(target_ulong start, target_ulong end, int flags)
{
target_ulong addr, len;
bool reset;
bool reset, inval_tb = false;

/* This function should never be called with addresses outside the
guest address space. If this assert fires, it probably indicates
Expand Down Expand Up @@ -1388,11 +1388,15 @@ void page_set_flags(target_ulong start, target_ulong end, int flags)
&& (reset ||
!(flags & PAGE_EXEC) ||
(flags & ~p->flags & PAGE_WRITE))) {
tb_invalidate_phys_page(addr);
inval_tb = true;
}
/* Using mprotect on a page does not change sticky bits. */
p->flags = (reset ? 0 : p->flags & PAGE_STICKY) | flags;
}

if (inval_tb) {
tb_invalidate_phys_range(start, end);
}
}

void page_reset_target_data(target_ulong start, target_ulong end)
Expand Down

0 comments on commit e786509

Please sign in to comment.