diff mbox

[v2,1/3] tcg: code_bitmap is not used by user-mode emulation

Message ID 1459280892-8789-2-git-send-email-sergey.fedorov@linaro.org
State New
Headers show

Commit Message

sergey.fedorov@linaro.org March 29, 2016, 7:48 p.m. UTC
From: Paolo Bonzini <pbonzini@redhat.com>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[Sergey Fedorov: eliminate the field entirely in user-mode]
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
---

Notes:
    Changes in v2:
     * The field is eliminated entirely in user-mode

 translate-all.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Richard Henderson March 29, 2016, 8:05 p.m. UTC | #1
On 03/29/2016 12:48 PM, Sergey Fedorov wrote:
> From: Paolo Bonzini <pbonzini@redhat.com>
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> [Sergey Fedorov: eliminate the field entirely in user-mode]
> Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
> ---
> 
> Notes:
>     Changes in v2:
>      * The field is eliminated entirely in user-mode

Reviewed-by: Richard Henderson  <rth@twiddle.net>


r~
Alex Bennée March 31, 2016, 1:49 p.m. UTC | #2
Sergey Fedorov <sergey.fedorov@linaro.org> writes:

> From: Paolo Bonzini <pbonzini@redhat.com>
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> [Sergey Fedorov: eliminate the field entirely in user-mode]
> Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

> ---
>
> Notes:
>     Changes in v2:
>      * The field is eliminated entirely in user-mode
>
>  translate-all.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/translate-all.c b/translate-all.c
> index e9f409b762ab..c131ce2f183e 100644
> --- a/translate-all.c
> +++ b/translate-all.c
> @@ -75,8 +75,9 @@ typedef struct PageDesc {
>      /* in order to optimize self modifying code, we count the number
>         of lookups we do to a given page to use a bitmap */
>      unsigned int code_write_count;
> +#ifdef CONFIG_SOFTMMU
>      unsigned long *code_bitmap;
> -#if defined(CONFIG_USER_ONLY)
> +#else
>      unsigned long flags;
>  #endif
>  } PageDesc;
> @@ -784,8 +785,10 @@ void tb_free(TranslationBlock *tb)
>
>  static inline void invalidate_page_bitmap(PageDesc *p)
>  {
> +#ifdef CONFIG_SOFTMMU
>      g_free(p->code_bitmap);
>      p->code_bitmap = NULL;
> +#endif
>      p->code_write_count = 0;
>  }
>
> @@ -1018,6 +1021,7 @@ void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr)
>      tcg_ctx.tb_ctx.tb_phys_invalidate_count++;
>  }
>
> +#ifdef CONFIG_SOFTMMU
>  static void build_page_bitmap(PageDesc *p)
>  {
>      int n, tb_start, tb_end;
> @@ -1046,6 +1050,7 @@ static void build_page_bitmap(PageDesc *p)
>          tb = tb->page_next[n];
>      }
>  }
> +#endif
>
>  /* Called with mmap_lock held for user mode emulation.  */
>  TranslationBlock *tb_gen_code(CPUState *cpu,
> @@ -1294,6 +1299,7 @@ void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end,
>  #endif
>  }
>
> +#ifdef CONFIG_SOFTMMU
>  /* len must be <= 8 and start must be a multiple of len */
>  void tb_invalidate_phys_page_fast(tb_page_addr_t start, int len)
>  {
> @@ -1331,8 +1337,7 @@ void tb_invalidate_phys_page_fast(tb_page_addr_t start, int len)
>          tb_invalidate_phys_page_range(start, start + len, 1);
>      }
>  }
> -
> -#if !defined(CONFIG_SOFTMMU)
> +#else
>  /* Called with mmap_lock held.  */
>  static void tb_invalidate_phys_page(tb_page_addr_t addr,
>                                      uintptr_t pc, void *puc,


--
Alex Bennée
diff mbox

Patch

diff --git a/translate-all.c b/translate-all.c
index e9f409b762ab..c131ce2f183e 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -75,8 +75,9 @@  typedef struct PageDesc {
     /* in order to optimize self modifying code, we count the number
        of lookups we do to a given page to use a bitmap */
     unsigned int code_write_count;
+#ifdef CONFIG_SOFTMMU
     unsigned long *code_bitmap;
-#if defined(CONFIG_USER_ONLY)
+#else
     unsigned long flags;
 #endif
 } PageDesc;
@@ -784,8 +785,10 @@  void tb_free(TranslationBlock *tb)
 
 static inline void invalidate_page_bitmap(PageDesc *p)
 {
+#ifdef CONFIG_SOFTMMU
     g_free(p->code_bitmap);
     p->code_bitmap = NULL;
+#endif
     p->code_write_count = 0;
 }
 
@@ -1018,6 +1021,7 @@  void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr)
     tcg_ctx.tb_ctx.tb_phys_invalidate_count++;
 }
 
+#ifdef CONFIG_SOFTMMU
 static void build_page_bitmap(PageDesc *p)
 {
     int n, tb_start, tb_end;
@@ -1046,6 +1050,7 @@  static void build_page_bitmap(PageDesc *p)
         tb = tb->page_next[n];
     }
 }
+#endif
 
 /* Called with mmap_lock held for user mode emulation.  */
 TranslationBlock *tb_gen_code(CPUState *cpu,
@@ -1294,6 +1299,7 @@  void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end,
 #endif
 }
 
+#ifdef CONFIG_SOFTMMU
 /* len must be <= 8 and start must be a multiple of len */
 void tb_invalidate_phys_page_fast(tb_page_addr_t start, int len)
 {
@@ -1331,8 +1337,7 @@  void tb_invalidate_phys_page_fast(tb_page_addr_t start, int len)
         tb_invalidate_phys_page_range(start, start + len, 1);
     }
 }
-
-#if !defined(CONFIG_SOFTMMU)
+#else
 /* Called with mmap_lock held.  */
 static void tb_invalidate_phys_page(tb_page_addr_t addr,
                                     uintptr_t pc, void *puc,