All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] translate-all: remove redundant page_find from tb_invalidate_phys_page
@ 2015-04-08 21:37 Emilio G. Cota
  2015-04-22 13:25 ` Paolo Bonzini
  2015-05-05 23:51 ` Richard Henderson
  0 siblings, 2 replies; 3+ messages in thread
From: Emilio G. Cota @ 2015-04-08 21:37 UTC (permalink / raw)
  To: qemu-devel

The callers have just looked up the page descriptor, so there's no
point in searching again for it.

Signed-off-by: Emilio G. Cota <cota@braap.org>
---
 translate-all.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/translate-all.c b/translate-all.c
index 11763c6..4d05898 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -1246,14 +1246,13 @@ void tb_invalidate_phys_page_fast(tb_page_addr_t start, int len)
     }
 }
 
 #if !defined(CONFIG_SOFTMMU)
-static void tb_invalidate_phys_page(tb_page_addr_t addr,
+static void tb_invalidate_phys_page(PageDesc *p, tb_page_addr_t addr,
                                     uintptr_t pc, void *puc,
                                     bool locked)
 {
     TranslationBlock *tb;
-    PageDesc *p;
     int n;
 #ifdef TARGET_HAS_PRECISE_SMC
     TranslationBlock *current_tb = NULL;
     CPUState *cpu = current_cpu;
@@ -1264,12 +1263,8 @@ static void tb_invalidate_phys_page(tb_page_addr_t addr,
     int current_flags = 0;
 #endif
 
     addr &= TARGET_PAGE_MASK;
-    p = page_find(addr >> TARGET_PAGE_BITS);
-    if (!p) {
-        return;
-    }
     tb = p->first_tb;
 #ifdef TARGET_HAS_PRECISE_SMC
     if (tb && pc != 0) {
         current_tb = tb_find_pc(pc);
@@ -1817,9 +1812,9 @@ void page_set_flags(target_ulong start, target_ulong end, int flags)
            the code inside.  */
         if (!(p->flags & PAGE_WRITE) &&
             (flags & PAGE_WRITE) &&
             p->first_tb) {
-            tb_invalidate_phys_page(addr, 0, NULL, false);
+            tb_invalidate_phys_page(p, addr, 0, NULL, false);
         }
         p->flags = flags;
     }
 }
@@ -1911,9 +1906,9 @@ int page_unprotect(target_ulong address, uintptr_t pc, void *puc)
             prot |= p->flags;
 
             /* and since the content will be modified, we must invalidate
                the corresponding translated code. */
-            tb_invalidate_phys_page(addr, pc, puc, true);
+            tb_invalidate_phys_page(p, addr, pc, puc, true);
 #ifdef DEBUG_TB_CHECK
             tb_invalidate_check(addr);
 #endif
         }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] translate-all: remove redundant page_find from tb_invalidate_phys_page
  2015-04-08 21:37 [Qemu-devel] [PATCH] translate-all: remove redundant page_find from tb_invalidate_phys_page Emilio G. Cota
@ 2015-04-22 13:25 ` Paolo Bonzini
  2015-05-05 23:51 ` Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2015-04-22 13:25 UTC (permalink / raw)
  To: Emilio G. Cota, qemu-devel



On 08/04/2015 23:37, Emilio G. Cota wrote:
> The callers have just looked up the page descriptor, so there's no
> point in searching again for it.
> 
> Signed-off-by: Emilio G. Cota <cota@braap.org>
> ---
>  translate-all.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/translate-all.c b/translate-all.c
> index 11763c6..4d05898 100644
> --- a/translate-all.c
> +++ b/translate-all.c
> @@ -1246,14 +1246,13 @@ void tb_invalidate_phys_page_fast(tb_page_addr_t start, int len)
>      }
>  }
>  
>  #if !defined(CONFIG_SOFTMMU)
> -static void tb_invalidate_phys_page(tb_page_addr_t addr,
> +static void tb_invalidate_phys_page(PageDesc *p, tb_page_addr_t addr,
>                                      uintptr_t pc, void *puc,
>                                      bool locked)
>  {
>      TranslationBlock *tb;
> -    PageDesc *p;
>      int n;
>  #ifdef TARGET_HAS_PRECISE_SMC
>      TranslationBlock *current_tb = NULL;
>      CPUState *cpu = current_cpu;
> @@ -1264,12 +1263,8 @@ static void tb_invalidate_phys_page(tb_page_addr_t addr,
>      int current_flags = 0;
>  #endif
>  
>      addr &= TARGET_PAGE_MASK;
> -    p = page_find(addr >> TARGET_PAGE_BITS);
> -    if (!p) {
> -        return;
> -    }
>      tb = p->first_tb;
>  #ifdef TARGET_HAS_PRECISE_SMC
>      if (tb && pc != 0) {
>          current_tb = tb_find_pc(pc);
> @@ -1817,9 +1812,9 @@ void page_set_flags(target_ulong start, target_ulong end, int flags)
>             the code inside.  */
>          if (!(p->flags & PAGE_WRITE) &&
>              (flags & PAGE_WRITE) &&
>              p->first_tb) {
> -            tb_invalidate_phys_page(addr, 0, NULL, false);
> +            tb_invalidate_phys_page(p, addr, 0, NULL, false);
>          }
>          p->flags = flags;
>      }
>  }
> @@ -1911,9 +1906,9 @@ int page_unprotect(target_ulong address, uintptr_t pc, void *puc)
>              prot |= p->flags;
>  
>              /* and since the content will be modified, we must invalidate
>                 the corresponding translated code. */
> -            tb_invalidate_phys_page(addr, pc, puc, true);
> +            tb_invalidate_phys_page(p, addr, pc, puc, true);
>  #ifdef DEBUG_TB_CHECK
>              tb_invalidate_check(addr);
>  #endif
>          }
> 

This one looks good.

Thanks,

Paolo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] translate-all: remove redundant page_find from tb_invalidate_phys_page
  2015-04-08 21:37 [Qemu-devel] [PATCH] translate-all: remove redundant page_find from tb_invalidate_phys_page Emilio G. Cota
  2015-04-22 13:25 ` Paolo Bonzini
@ 2015-05-05 23:51 ` Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2015-05-05 23:51 UTC (permalink / raw)
  To: Emilio G. Cota, qemu-devel

On 04/08/2015 02:37 PM, Emilio G. Cota wrote:
> The callers have just looked up the page descriptor, so there's no
> point in searching again for it.
> 
> Signed-off-by: Emilio G. Cota <cota@braap.org>
> ---
>  translate-all.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)

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


r~

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-05 23:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-08 21:37 [Qemu-devel] [PATCH] translate-all: remove redundant page_find from tb_invalidate_phys_page Emilio G. Cota
2015-04-22 13:25 ` Paolo Bonzini
2015-05-05 23:51 ` Richard Henderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.