From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O71A2-0008B3-1X for qemu-devel@nongnu.org; Wed, 28 Apr 2010 02:54:18 -0400 Received: from [140.186.70.92] (port=40553 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O719z-0008AU-Ef for qemu-devel@nongnu.org; Wed, 28 Apr 2010 02:54:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O719l-0005p9-Eb for qemu-devel@nongnu.org; Wed, 28 Apr 2010 02:54:15 -0400 Received: from fmmailgate01.web.de ([217.72.192.221]:50750) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O719l-0005nx-0X for qemu-devel@nongnu.org; Wed, 28 Apr 2010 02:54:01 -0400 Message-ID: <4BD7DB82.2080809@web.de> Date: Wed, 28 Apr 2010 08:53:54 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <4BD72E96.8050406@web.de> In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig58DE074ED11DA64ADE784CD0" Sender: jan.kiszka@web.de 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: Jun Koi Cc: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig58DE074ED11DA64ADE784CD0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Jun Koi wrote: > 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 = vaddr, >>>> /* TODO: The memory case can be optimized by not trappi= ng >>>> reads of pages with a write breakpoint. */ >>> PS: Don't you also want to address this todo while you are at it? :) >>> >=20 > Do you have any comment on below patch? >=20 > Thanks, > J >=20 >=20 > 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. >=20 > Signed-off-by: Jun Koi >=20 > 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 v= addr, > 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))) { Patch is line-wrapped. Besides that if ((wp->flags & BP_MEM_READ) || (prot & PAGE_WRITE)) is more readable IMHO. > + iotlb =3D io_mem_watch + paddr; > + address |=3D TLB_MMIO; > + break; > + } > } > } Thanks, Jan --------------enig58DE074ED11DA64ADE784CD0 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAkvX24IACgkQitSsb3rl5xT5RwCg3cmbiOXTvufpt2MGSPhxUgXy uoUAoIEe6FY2UBjS4XGbNAqs18j2mxl7 =IExz -----END PGP SIGNATURE----- --------------enig58DE074ED11DA64ADE784CD0--