Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 May 2009 09:49:57 -0700
From:      Marcel Moolenaar <xcllnt@mac.com>
To:        FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>
Subject:   [patch] __syncicache: eliminate D-cache flush
Message-ID:  <6C962FE0-657A-4072-B050-903D54C712D4@mac.com>

index | next in thread | raw e-mail

All,

I'd like to commit the following change, which basically removes
the D-cache flush from syncicache. This gave me a 6% performance
improvement on my SMP xserve (but YMMV):

Index: sys/powerpc/powerpc/syncicache.c
===================================================================
--- sys/powerpc/powerpc/syncicache.c    (revision 192134)
+++ sys/powerpc/powerpc/syncicache.c    (working copy)
@@ -50,23 +50,14 @@
  void
  __syncicache(void *from, int len)
  {
-       int     l, off;
-       char    *p;
+       char    *p, *lim;

-       off = (u_int)from & (cacheline_size - 1);
-       l = len += off;
-       p = (char *)from - off;
+       p = (char *)((uintptr_t)from & (cacheline_size - 1));
+       lim = (char *)from + len;

-       do {
-               __asm __volatile ("dcbst 0,%0" :: "r"(p));
-               p += cacheline_size;
-       } while ((l -= cacheline_size) > 0);
-       __asm __volatile ("sync");
-       p = (char *)from - off;
-       do {
+       while (p < lim) {
                 __asm __volatile ("icbi 0,%0" :: "r"(p));
                 p += cacheline_size;
-       } while ((len -= cacheline_size) > 0);
+       }
         __asm __volatile ("sync; isync");
  }
-

I tested a make buildworld/buildkernel and a make release. I can't
test the image because I'm having difficulty booting from the CD
(I think that's mostly related to using a serial console and none
of the standard Open Firmware key combinations works).

Can someone try and boot (and preferably go through a real install):
	http://people.freebsd.org/~marcel/8.0-CURRENT-200905-powerpc-disc1.iso

In the mean time, I'll try a make buildworld across NFS to see if
we need to implement cpu_flush_dcache() to compensate...

-- 
Marcel Moolenaar
xcllnt@mac.com





help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6C962FE0-657A-4072-B050-903D54C712D4>