From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPZ5Z-0001jJ-HX for qemu-devel@nongnu.org; Wed, 12 Aug 2015 12:41:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZPZ5Y-0008Ai-5G for qemu-devel@nongnu.org; Wed, 12 Aug 2015 12:41:17 -0400 Received: from mail-wi0-x232.google.com ([2a00:1450:400c:c05::232]:37226) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPZ5X-0008AV-Ux for qemu-devel@nongnu.org; Wed, 12 Aug 2015 12:41:16 -0400 Received: by wibhh20 with SMTP id hh20so37837648wib.0 for ; Wed, 12 Aug 2015 09:41:15 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Wed, 12 Aug 2015 18:40:59 +0200 Message-Id: <1439397664-70734-8-git-send-email-pbonzini@redhat.com> In-Reply-To: <1439397664-70734-1-git-send-email-pbonzini@redhat.com> References: <1439397664-70734-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 07/10] tcg: comment on which functions have to be called with mmap_lock held List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mttcg@greensocs.com, fred.konrad@greensocs.com Signed-off-by: Paolo Bonzini --- translate-all.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/translate-all.c b/translate-all.c index 7aa5664..7727091 100644 --- a/translate-all.c +++ b/translate-all.c @@ -172,11 +172,13 @@ void cpu_gen_init(void) } /* return non zero if the very first instruction is invalid so that - the virtual CPU can trigger an exception. - - '*gen_code_size_ptr' contains the size of the generated code (host - code). -*/ + * the virtual CPU can trigger an exception. + * + * '*gen_code_size_ptr' contains the size of the generated code (host + * code). + * + * Called with mmap_lock held for user-mode emulation. + */ int cpu_gen_code(CPUArchState *env, TranslationBlock *tb, int *gen_code_size_ptr) { TCGContext *s = &tcg_ctx; @@ -421,6 +423,9 @@ static void page_init(void) #endif } +/* If alloc=1: + * Called with mmap_lock held for user-mode emulation. + */ static PageDesc *page_find_alloc(tb_page_addr_t index, int alloc) { PageDesc *pd; @@ -1036,6 +1041,7 @@ static void build_page_bitmap(PageDesc *p) } #endif +/* Called with mmap_lock held for user mode emulation. */ TranslationBlock *tb_gen_code(CPUState *cpu, target_ulong pc, target_ulong cs_base, int flags, int cflags) @@ -1083,6 +1089,8 @@ TranslationBlock *tb_gen_code(CPUState *cpu, * 'is_cpu_write_access' should be true if called from a real cpu write * access: the virtual CPU will exit the current TB if code is modified inside * this TB. + * + * Called with mmap_lock held for user-mode emulation */ void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t end) { @@ -1099,6 +1107,8 @@ void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t end) * 'is_cpu_write_access' should be true if called from a real cpu write * access: the virtual CPU will exit the current TB if code is modified inside * this TB. + * + * Called with mmap_lock held for user-mode emulation */ void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end, int is_cpu_write_access) @@ -1247,6 +1257,7 @@ void tb_invalidate_phys_page_fast(tb_page_addr_t start, int len) } } #else +/* Called with mmap_lock held. */ static void tb_invalidate_phys_page(tb_page_addr_t addr, uintptr_t pc, void *puc, bool locked) @@ -1316,7 +1327,10 @@ static void tb_invalidate_phys_page(tb_page_addr_t addr, } #endif -/* add the tb in the target page and protect it if necessary */ +/* add the tb in the target page and protect it if necessary + * + * Called with mmap_lock held for user-mode emulation. + */ static inline void tb_alloc_page(TranslationBlock *tb, unsigned int n, tb_page_addr_t page_addr) { @@ -1372,7 +1386,8 @@ static inline void tb_alloc_page(TranslationBlock *tb, } /* add a new TB and link it to the physical page tables. phys_page2 is - (-1) to indicate that only one page contains the TB. */ + * (-1) to indicate that only one page contains the TB. + */ static void tb_link_page(TranslationBlock *tb, tb_page_addr_t phys_pc, tb_page_addr_t phys_page2) { -- 1.8.3.1