From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O6xOT-0005fA-Kr for qemu-devel@nongnu.org; Tue, 27 Apr 2010 22:52:57 -0400 Received: from [140.186.70.92] (port=38151 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O6xOS-0005eY-BS for qemu-devel@nongnu.org; Tue, 27 Apr 2010 22:52:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O6xON-0006Sp-7j for qemu-devel@nongnu.org; Tue, 27 Apr 2010 22:52:56 -0400 Received: from mail-iw0-f192.google.com ([209.85.223.192]:35587) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O6xON-0006SY-4W for qemu-devel@nongnu.org; Tue, 27 Apr 2010 22:52:51 -0400 Received: by iwn30 with SMTP id 30so2841623iwn.28 for ; Tue, 27 Apr 2010 19:52:50 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <4BD72E96.8050406@web.de> From: Jun Koi Date: Wed, 28 Apr 2010 11:52:30 +0900 Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Re: [PATCH] A bit optimization for tlb_set_page() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: qemu-devel@nongnu.org On Wed, Apr 28, 2010 at 8:48 AM, Jun Koi wrote: > On Wed, Apr 28, 2010 at 3:36 AM, Jan Kiszka wrote: >> Jun Koi wrote: >>> It is not necessary to continue searching for watchpoint when we >>> already found one and setup for handling watchpoint in a search loop >>> in tlb_set_page(). >>> This patch breaks that search loop on then. >> >> Acked-by: Jan Kiszka >> >>> >>> Signed-off-by: Jun Koi >>> >>> diff --git a/exec.c b/exec.c >>> index 14d1fd7..6329775 100644 >>> --- a/exec.c >>> +++ b/exec.c >>> @@ -2240,6 +2240,7 @@ void tlb_set_page(CPUState *env, target_ulong vad= dr, >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0/* TODO: The memory case can be optimized by= not trapping >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reads of pages with a write breakpoint.= =A0*/ >> >> PS: Don't you also want to address this todo while you are at it? :) >> Do you have any comment on below patch? Thanks, J Dont handle write watchpoints on read-only memory access. This patch also breaks the searching loop for watchpoint once the setup facilities for handling watchpoint later is done. Signed-off-by: Jun Koi diff --git a/exec.c b/exec.c index 14d1fd7..3f2d9ed 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 =3D=3D (wp->vaddr & TARGET_PAGE_MASK)) { - iotlb =3D io_mem_watch + paddr; - /* TODO: The memory case can be optimized by not trapping - reads of pages with a write breakpoint. */ - address |=3D TLB_MMIO; + /* Avoid trapping reads of pages with a write breakpoint. */ + if (!((prot & PAGE_WRITE =3D=3D 0) && (wp->flags & BP_MEM_WRITE !=3D 0))) { + iotlb =3D io_mem_watch + paddr; + address |=3D TLB_MMIO; + break; + } } }