From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9992 invoked by alias); 15 Sep 2009 06:58:09 -0000 Received: (qmail 9967 invoked by uid 22791); 15 Sep 2009 06:58:08 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 15 Sep 2009 06:58:03 +0000 Received: from zps37.corp.google.com (zps37.corp.google.com [172.25.146.37]) by smtp-out.google.com with ESMTP id n8F6vxx3023755 for ; Tue, 15 Sep 2009 07:58:00 +0100 Received: from yxe29 (yxe29.prod.google.com [10.190.2.29]) by zps37.corp.google.com with ESMTP id n8F6vu5D021913 for ; Mon, 14 Sep 2009 23:57:57 -0700 Received: by yxe29 with SMTP id 29so4724539yxe.16 for ; Mon, 14 Sep 2009 23:57:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.150.43.18 with SMTP id q18mr11700713ybq.254.1252997873150; Mon, 14 Sep 2009 23:57:53 -0700 (PDT) In-Reply-To: <20090914191657.E32D6844C3@localhost> References: <20090914191657.E32D6844C3@localhost> Date: Tue, 15 Sep 2009 06:58:00 -0000 Message-ID: Subject: Re: [patch] only update dcache after write succeeds From: Doug Evans To: gdb-patches@sourceware.org Cc: Pedro Alves , Michael Snyder , Hui Zhu , Marc Khouzam , Greg Law Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true 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/msg00477.txt.bz2 On Mon, Sep 14, 2009 at 12:16 PM, Doug Evans wrote: > Hi. > > Marc, Greg: Can you see if this patch fixes things for you? > > 2009-09-14 =A0Doug Evans =A0 > > =A0 =A0 =A0 =A0* target.c (memory_xfer_partial): Only update dcache after= we know > =A0 =A0 =A0 =A0the write succeeded. > > 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 =A0 =A08 Sep 2009 23:52:45 -0000 =A0 =A0 =A0 1.223 > +++ target.c =A0 =A014 Sep 2009 19:11:38 -0000 > @@ -1289,19 +1289,6 @@ memory_xfer_partial (struct target_ops * > =A0 =A0 =A0 =A0} > =A0 =A0 } > > - =A0/* Make sure the cache gets updated no matter what - if we are writi= ng > - =A0 =A0 to the stack, even if this write is not tagged as such, we stil= l need > - =A0 =A0 to update the cache. */ > - > - =A0if (inf !=3D NULL > - =A0 =A0 =A0&& readbuf =3D=3D NULL > - =A0 =A0 =A0&& !region->attrib.cache > - =A0 =A0 =A0&& stack_cache_enabled_p > - =A0 =A0 =A0&& object !=3D TARGET_OBJECT_STACK_MEMORY) > - =A0 =A0{ > - =A0 =A0 =A0dcache_update (target_dcache, memaddr, (void *) writebuf, re= g_len); > - =A0 =A0} > - > =A0 /* If none of those methods found the memory we wanted, fall back > =A0 =A0 =A0to a target partial transfer. =A0Normally a single call to > =A0 =A0 =A0to_xfer_partial is enough; if it doesn't recognize an object > @@ -1331,6 +1318,20 @@ memory_xfer_partial (struct target_ops * > =A0 if (readbuf && !show_memory_breakpoints) > =A0 =A0 breakpoint_restore_shadows (readbuf, memaddr, reg_len); > > + =A0/* Make sure the cache gets updated no matter what - if we are writi= ng > + =A0 =A0 to the stack. =A0Even if this write is not tagged as such, we s= till need > + =A0 =A0 to update the cache. =A0*/ > + > + =A0if (res > 0 > + =A0 =A0 =A0&& inf !=3D NULL > + =A0 =A0 =A0&& writebuf !=3D NULL > + =A0 =A0 =A0&& !region->attrib.cache > + =A0 =A0 =A0&& stack_cache_enabled_p > + =A0 =A0 =A0&& object !=3D TARGET_OBJECT_STACK_MEMORY) > + =A0 =A0{ > + =A0 =A0 =A0dcache_update (target_dcache, memaddr, (void *) writebuf, re= g_len); > + =A0 =A0} > + > =A0 /* If we still haven't got anything, return the last error. =A0We > =A0 =A0 =A0give up. =A0*/ > =A0 return res; > Of course I did forget to pass the correct length. 009-09-14 Doug Evans * target.c (memory_xfer_partial): Pass correct length to dcache_upd= ate. 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.225 diff -u -p -r1.225 target.c --- target.c 15 Sep 2009 03:30:06 -0000 1.225 +++ target.c 15 Sep 2009 06:54:16 -0000 @@ -1333,7 +1333,7 @@ memory_xfer_partial (struct target_ops * && stack_cache_enabled_p && object !=3D TARGET_OBJECT_STACK_MEMORY) { - dcache_update (target_dcache, memaddr, (void *) writebuf, reg_len); + dcache_update (target_dcache, memaddr, (void *) writebuf, res); } /* If we still haven't got anything, return the last error. We