From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O7jxl-0006Jc-Pt for qemu-devel@nongnu.org; Fri, 30 Apr 2010 02:44:38 -0400 Received: from [140.186.70.92] (port=45892 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O7jxV-0006Fv-0q for qemu-devel@nongnu.org; Fri, 30 Apr 2010 02:44:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O7jxP-0005km-T4 for qemu-devel@nongnu.org; Fri, 30 Apr 2010 02:44:19 -0400 Received: from fmmailgate01.web.de ([217.72.192.221]:43882) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O7jxM-0005kJ-Kz for qemu-devel@nongnu.org; Fri, 30 Apr 2010 02:44:15 -0400 Message-ID: <4BDA7C3A.206@web.de> Date: Fri, 30 Apr 2010 08:44:10 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <4BD72E96.8050406@web.de> <4BD7DB82.2080809@web.de> In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigF6B7788D502C90F017000D5E" 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) --------------enigF6B7788D502C90F017000D5E Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Jun Koi wrote: > On Wed, Apr 28, 2010 at 3:53 PM, Jan Kiszka wrote: >> 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 wrot= e: >>>>> 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 lo= op >>>>>> 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_ulon= g vaddr, >>>>>> /* TODO: The memory case can be optimized by not trap= ping >>>>>> reads of pages with a write breakpoint. */ >>>>> 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 trappin= g >>> - reads of pages with a write breakpoint. */ >>> - address |=3D TLB_MMIO; >>> + /* Avoid trapping reads of pages with a write breakpoint= =2E */ >>> + if (!((prot & PAGE_WRITE =3D=3D 0) && (wp->flags & >>> BP_MEM_WRITE !=3D 0))) { >> Patch is line-wrapped. >=20 > That is the fault of Gmail. >=20 >> Besides that >> >> if ((wp->flags & BP_MEM_READ) || (prot & PAGE_WRITE)) >> >> is more readable IMHO. >=20 > Agreed. Please see my updated patch. >=20 Looks ok, but you will likely have to resend it with proper subject and without any traces of this thread. Otherwise the patch won't be found by any maintainer. Jan > Thanks, > Jun >=20 >=20 >=20 > Dont handle write watchpoints on read-only memory access. > This patch also breaks the searching loop for watchpoint once the > setup for handling watchpoint later is done. >=20 > Signed-off-by: Jun Koi >=20 >=20 > 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 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) || (wp->flags & BP_MEM_READ)) { > + iotlb =3D io_mem_watch + paddr; > + address |=3D TLB_MMIO; > + break; > + } > } > } --------------enigF6B7788D502C90F017000D5E 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 iEYEARECAAYFAkvafDoACgkQitSsb3rl5xTZvwCg1nCpzQIZayiaPc+mLpJ9h/vr z9gAoL2wkabe1WEGlK+gJaPzRKU/VSCi =1+1p -----END PGP SIGNATURE----- --------------enigF6B7788D502C90F017000D5E--