From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1401 invoked by alias); 14 Sep 2009 19:29:32 -0000 Received: (qmail 1393 invoked by uid 22791); 14 Sep 2009 19:29:31 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from imr1.ericy.com (HELO imr1.ericy.com) (198.24.6.9) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 14 Sep 2009 19:29:27 +0000 Received: from eusrcmw750.eamcs.ericsson.se (eusrcmw750.exu.ericsson.se [138.85.77.50]) by imr1.ericy.com (8.13.1/8.13.1) with ESMTP id n8EJTMMW010987; Mon, 14 Sep 2009 14:29:22 -0500 Received: from eusrcmw750.eamcs.ericsson.se ([138.85.77.53]) by eusrcmw750.eamcs.ericsson.se with Microsoft SMTPSVC(6.0.3790.3959); Mon, 14 Sep 2009 14:29:06 -0500 Received: from eusaamw0712.eamcs.ericsson.se ([147.117.20.181]) by eusrcmw750.eamcs.ericsson.se with Microsoft SMTPSVC(6.0.3790.3959); Mon, 14 Sep 2009 14:29:06 -0500 Received: from EUSAACMS0703.eamcs.ericsson.se ([147.117.20.28]) by eusaamw0712.eamcs.ericsson.se ([147.117.20.181]) with mapi; Mon, 14 Sep 2009 15:29:06 -0400 From: Marc Khouzam To: "'Michael Snyder'" , "'Doug Evans'" CC: "'gdb-patches@sourceware.org'" , "'Greg Law'" , "'Pedro Alves'" , "'Hui Zhu'" Date: Mon, 14 Sep 2009 19:29:00 -0000 Subject: RE: [patch] only update dcache after write succeeds Message-ID: References: <20090914191657.E32D6844C3@localhost> <4AAE98F1.3000501@vmware.com> In-Reply-To: <4AAE98F1.3000501@vmware.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-09/txt/msg00443.txt.bz2 =20 > -----Original Message----- > From: Michael Snyder [mailto:msnyder@vmware.com]=20 > Sent: Monday, September 14, 2009 3:27 PM > To: Doug Evans > Cc: gdb-patches@sourceware.org; Marc Khouzam; Greg Law; Pedro=20 > Alves; Hui Zhu > Subject: Re: [patch] only update dcache after write succeeds >=20 > Doug Evans wrote: > > Hi. > >=20 > > Marc, Greg: Can you see if this patch fixes things for you? >=20 > Hey Doug, >=20 > I tested this change, and it does indeed seem to fix the problem > with target record -- but. ;-) >=20 > Part of the reason that it works is that record_xfer_partial > calls error() instead of returning -1. If I change it so that > it returns -1, things get more complicated. Just a note that PRecord used to return -1 which caused memory to be changed even when the query was answered with 'n'. That is why Hui changed it to error() >=20 > The do-while loop that used to follow and now preceeds this code > calls target-beneath, which in our case results in several different > target methods being called, one of which eventually returns > 0. >=20 > That just means that in the present case, calling error is correct. > But I worry about some of the other cases where the target method > returns -1, and whether badness might occur in some other cases. >=20 > Michael >=20 >=20 > > 2009-09-14 Doug Evans > >=20 > > * target.c (memory_xfer_partial): Only update dcache=20 > after we know > > the write succeeded. > >=20 > > Index: target.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > RCS file: /cvs/src/src/gdb/target.c,v > > retrieving revision 1.223 > > diff -u -p -r1.223 target.c > > --- target.c 8 Sep 2009 23:52:45 -0000 1.223 > > +++ target.c 14 Sep 2009 19:11:38 -0000 > > @@ -1289,19 +1289,6 @@ memory_xfer_partial (struct target_ops * > > } > > } > >=20=20 > > - /* Make sure the cache gets updated no matter what - if=20 > we are writing > > - to the stack, even if this write is not tagged as=20 > such, we still need > > - to update the cache. */ > > - > > - if (inf !=3D NULL > > - && readbuf =3D=3D NULL > > - && !region->attrib.cache > > - && stack_cache_enabled_p > > - && object !=3D TARGET_OBJECT_STACK_MEMORY) > > - { > > - dcache_update (target_dcache, memaddr, (void *)=20 > writebuf, reg_len); > > - } > > - > > /* If none of those methods found the memory we wanted, fall back > > to a target partial transfer. Normally a single call to > > to_xfer_partial is enough; if it doesn't recognize an object > > @@ -1331,6 +1318,20 @@ memory_xfer_partial (struct target_ops * > > if (readbuf && !show_memory_breakpoints) > > breakpoint_restore_shadows (readbuf, memaddr, reg_len); > >=20=20 > > + /* Make sure the cache gets updated no matter what - if=20 > we are writing > > + to the stack. Even if this write is not tagged as=20 > such, we still need > > + to update the cache. */ > > + > > + if (res > 0 > > + && inf !=3D NULL > > + && writebuf !=3D NULL > > + && !region->attrib.cache > > + && stack_cache_enabled_p > > + && object !=3D TARGET_OBJECT_STACK_MEMORY) > > + { > > + dcache_update (target_dcache, memaddr, (void *)=20 > writebuf, reg_len); > > + } > > + > > /* If we still haven't got anything, return the last error. We > > give up. */ > > return res; >=20 >=20