qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] A bit optimization for tlb_set_page() (resend)
@ 2010-05-06  5:36 Jun Koi
  2010-05-08 18:53 ` [Qemu-devel] " Jan Kiszka
  2010-06-30 18:31 ` [Qemu-devel] " Aurelien Jarno
  0 siblings, 2 replies; 3+ messages in thread
From: Jun Koi @ 2010-05-06  5:36 UTC (permalink / raw)
  To: qemu-devel, Jan Kiszka

This patch avoids handling write watchpoints on read-only memory access.
It also breaks the searching loop for watchpoint once the setup for
handling watchpoint later is done.

Signed-off-by: Jun Koi <junkoi2004@gmail.com>


diff --git a/exec.c b/exec.c
index 14d1fd7..6fd859f 100644
--- a/exec.c
+++ b/exec.c
@@ -2236,10 +2236,12 @@ void tlb_set_page(CPUState *env, target_ulong vaddr,
        watchpoint trap routines.  */
     QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
         if (vaddr == (wp->vaddr & TARGET_PAGE_MASK)) {
-            iotlb = io_mem_watch + paddr;
-            /* TODO: The memory case can be optimized by not trapping
-               reads of pages with a write breakpoint.  */
-            address |= TLB_MMIO;
+            /* Avoid trapping reads of pages with a write breakpoint. */
+            if ((prot & PAGE_WRITE) || (wp->flags & BP_MEM_READ)) {
+                iotlb = io_mem_watch + paddr;
+                address |= TLB_MMIO;
+                break;
+            }
         }
     }

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

* [Qemu-devel] Re: [PATCH] A bit optimization for tlb_set_page() (resend)
  2010-05-06  5:36 [Qemu-devel] [PATCH] A bit optimization for tlb_set_page() (resend) Jun Koi
@ 2010-05-08 18:53 ` Jan Kiszka
  2010-06-30 18:31 ` [Qemu-devel] " Aurelien Jarno
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2010-05-08 18:53 UTC (permalink / raw)
  To: Jun Koi; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1193 bytes --]

Jun Koi wrote:
> This patch avoids handling write watchpoints on read-only memory access.
> It also breaks the searching loop for watchpoint once the setup for
> handling watchpoint later is done.
> 
> Signed-off-by: Jun Koi <junkoi2004@gmail.com>
> 

Works fine.

Acked-by: Jan Kiszka <jan.kiszka@siemens.com>

> 
> diff --git a/exec.c b/exec.c
> index 14d1fd7..6fd859f 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -2236,10 +2236,12 @@ void tlb_set_page(CPUState *env, target_ulong vaddr,
>         watchpoint trap routines.  */
>      QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
>          if (vaddr == (wp->vaddr & TARGET_PAGE_MASK)) {
> -            iotlb = io_mem_watch + paddr;
> -            /* TODO: The memory case can be optimized by not trapping
> -               reads of pages with a write breakpoint.  */
> -            address |= TLB_MMIO;
> +            /* Avoid trapping reads of pages with a write breakpoint. */
> +            if ((prot & PAGE_WRITE) || (wp->flags & BP_MEM_READ)) {
> +                iotlb = io_mem_watch + paddr;
> +                address |= TLB_MMIO;
> +                break;
> +            }
>          }
>      }



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

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

* Re: [Qemu-devel] [PATCH] A bit optimization for tlb_set_page() (resend)
  2010-05-06  5:36 [Qemu-devel] [PATCH] A bit optimization for tlb_set_page() (resend) Jun Koi
  2010-05-08 18:53 ` [Qemu-devel] " Jan Kiszka
@ 2010-06-30 18:31 ` Aurelien Jarno
  1 sibling, 0 replies; 3+ messages in thread
From: Aurelien Jarno @ 2010-06-30 18:31 UTC (permalink / raw)
  To: Jun Koi; +Cc: Jan Kiszka, qemu-devel

On Thu, May 06, 2010 at 02:36:59PM +0900, Jun Koi wrote:
> This patch avoids handling write watchpoints on read-only memory access.
> It also breaks the searching loop for watchpoint once the setup for
> handling watchpoint later is done.
> 
> Signed-off-by: Jun Koi <junkoi2004@gmail.com>

Thanks, applied.

> diff --git a/exec.c b/exec.c
> index 14d1fd7..6fd859f 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -2236,10 +2236,12 @@ void tlb_set_page(CPUState *env, target_ulong vaddr,
>         watchpoint trap routines.  */
>      QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
>          if (vaddr == (wp->vaddr & TARGET_PAGE_MASK)) {
> -            iotlb = io_mem_watch + paddr;
> -            /* TODO: The memory case can be optimized by not trapping
> -               reads of pages with a write breakpoint.  */
> -            address |= TLB_MMIO;
> +            /* Avoid trapping reads of pages with a write breakpoint. */
> +            if ((prot & PAGE_WRITE) || (wp->flags & BP_MEM_READ)) {
> +                iotlb = io_mem_watch + paddr;
> +                address |= TLB_MMIO;
> +                break;
> +            }
>          }
>      }
> 
> 
> 

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

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

end of thread, other threads:[~2010-06-30 18:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-06  5:36 [Qemu-devel] [PATCH] A bit optimization for tlb_set_page() (resend) Jun Koi
2010-05-08 18:53 ` [Qemu-devel] " Jan Kiszka
2010-06-30 18:31 ` [Qemu-devel] " Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).