From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGTLa-0008ME-MC for qemu-devel@nongnu.org; Fri, 24 Jun 2016 11:48:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGTLW-0004Ai-7q for qemu-devel@nongnu.org; Fri, 24 Jun 2016 11:48:45 -0400 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]:35506) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGTLV-0004AU-W3 for qemu-devel@nongnu.org; Fri, 24 Jun 2016 11:48:42 -0400 Received: by mail-lf0-x244.google.com with SMTP id w130so22055548lfd.2 for ; Fri, 24 Jun 2016 08:48:41 -0700 (PDT) References: <1464986428-6739-1-git-send-email-alex.bennee@linaro.org> <1464986428-6739-8-git-send-email-alex.bennee@linaro.org> From: Sergey Fedorov Message-ID: <576D5657.5020604@gmail.com> Date: Fri, 24 Jun 2016 18:48:39 +0300 MIME-Version: 1.0 In-Reply-To: <1464986428-6739-8-git-send-email-alex.bennee@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC v3 07/19] translate-all: Add assert_memory_lock annotations List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Alex_Benn=c3=a9e?= , mttcg@listserver.greensocs.com, qemu-devel@nongnu.org, fred.konrad@greensocs.com, a.rigo@virtualopensystems.com, cota@braap.org, bobby.prani@gmail.com Cc: mark.burton@greensocs.com, pbonzini@redhat.com, jan.kiszka@siemens.com, rth@twiddle.net, peter.maydell@linaro.org, claudio.fontana@huawei.com, Riku Voipio , Peter Crosthwaite On 03/06/16 23:40, Alex Bennée wrote: > This adds calls to the assert_memory_lock for all public APIs which are > documented as holding the mmap_lock for user-mode. > > Signed-off-by: Alex Bennée > --- > linux-user/elfload.c | 4 ++++ > translate-all.c | 20 ++++++++++++++++++++ > 2 files changed, 24 insertions(+) > > diff --git a/linux-user/elfload.c b/linux-user/elfload.c > index bb2558f..f72c275 100644 > --- a/linux-user/elfload.c > +++ b/linux-user/elfload.c > @@ -1839,6 +1839,8 @@ static void load_elf_image(const char *image_name, int image_fd, > info->pt_dynamic_addr = 0; > #endif > > + mmap_lock(); > + > /* Find the maximum size of the image and allocate an appropriate > amount of memory to handle that. */ > loaddr = -1, hiaddr = 0; > @@ -1999,6 +2001,8 @@ static void load_elf_image(const char *image_name, int image_fd, > load_symbols(ehdr, image_fd, load_bias); > } > > + mmap_unlock(); > + This change is out of scope of this patch, I think. > close(image_fd); > return; > > diff --git a/translate-all.c b/translate-all.c > index 8b162ff..aba6cb6 100644 > --- a/translate-all.c > +++ b/translate-all.c > @@ -453,6 +453,10 @@ static PageDesc *page_find_alloc(tb_page_addr_t index, int alloc) > void **lp; > int i; > > + if (alloc) { > + assert_memory_lock(); > + } > + > /* Level 1. Always allocated. */ > lp = l1_map + ((index >> V_L1_SHIFT) & (V_L1_SIZE - 1)); > > @@ -819,6 +823,8 @@ static TranslationBlock *tb_alloc(target_ulong pc) > { > TranslationBlock *tb; > > + assert_tb_lock(); > + Hmm, the patch subject doesn't mention tb_lock... > if (tcg_ctx.tb_ctx.nb_tbs >= tcg_ctx.code_gen_max_blocks) { > return NULL; > } Kind regards, Sergey