From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34797) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ymlvf-00028o-S6 for qemu-devel@nongnu.org; Mon, 27 Apr 2015 12:30:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ymlve-0003EA-WA for qemu-devel@nongnu.org; Mon, 27 Apr 2015 12:30:43 -0400 Received: from mail-wg0-x22e.google.com ([2a00:1450:400c:c00::22e]:35020) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ymlve-0003Da-Eo for qemu-devel@nongnu.org; Mon, 27 Apr 2015 12:30:42 -0400 Received: by wgyo15 with SMTP id o15so122084472wgy.2 for ; Mon, 27 Apr 2015 09:30:41 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 27 Apr 2015 18:28:26 +0200 Message-Id: <1430152117-100558-19-git-send-email-pbonzini@redhat.com> In-Reply-To: <1430152117-100558-1-git-send-email-pbonzini@redhat.com> References: <1430152117-100558-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 18/29] translate-all: make less of tb_invalidate_phys_page_range depend on is_cpu_write_access List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: famz@redhat.com, stefanha@redhat.com, mst@redhat.com is_cpu_write_access is only set if tb_invalidate_phys_page_range is called from tb_invalidate_phys_page_fast, and hence from notdirty_mem_write. However: - the code bitmap can be built directly in tb_invalidate_phys_page_fast (unconditionally, since is_cpu_write_access would always be passed as 1); - the virtual address is not needed to mark the page as "not containing code" (dirty code bitmap = 1), so we can also remove that use of is_cpu_write_access. For calls of tb_invalidate_phys_page_range that do not come from notdirty_mem_write, the next call to notdirty_mem_write will notice that the page does not contain code anymore, and will fix up the TLB entry. The parameter needs to remain in order to guard accesses to cpu->mem_io_pc. Signed-off-by: Paolo Bonzini --- translate-all.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/translate-all.c b/translate-all.c index 0283edc..855b329 100644 --- a/translate-all.c +++ b/translate-all.c @@ -1082,12 +1082,6 @@ void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end, if (!p) { return; } - if (!p->code_bitmap && - ++p->code_write_count >= SMC_BITMAP_USE_THRESHOLD && - is_cpu_write_access) { - /* build code bitmap */ - build_page_bitmap(p); - } #if defined(TARGET_HAS_PRECISE_SMC) if (cpu != NULL) { env = cpu->env_ptr; @@ -1157,9 +1151,7 @@ void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end, /* if no code remaining, no need to continue to use slow writes */ if (!p->first_tb) { invalidate_page_bitmap(p); - if (is_cpu_write_access) { - tlb_unprotect_code(start); - } + tlb_unprotect_code(start); } #endif #ifdef TARGET_HAS_PRECISE_SMC @@ -1192,6 +1184,11 @@ void tb_invalidate_phys_page_fast(tb_page_addr_t start, int len) if (!p) { return; } + if (!p->code_bitmap && + ++p->code_write_count >= SMC_BITMAP_USE_THRESHOLD) { + /* build code bitmap */ + build_page_bitmap(p); + } if (p->code_bitmap) { unsigned int nr; unsigned long b; -- 1.8.3.1