qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC v3 07/19] translate-all: Add assert_memory_lock an


From: Sergey Fedorov
Subject: Re: [Qemu-devel] [RFC v3 07/19] translate-all: Add assert_memory_lock annotations
Date: Fri, 24 Jun 2016 18:48:39 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0

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 <address@hidden>
> ---
>  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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]