[PATCH] [RFC] Emulate "lwsync" to run standard user land on e500 cores

James Yang James.Yang at freescale.com
Sat Oct 26 02:25:26 EST 2013


On Fri, 25 Oct 2013, Scott Wood wrote:

> Has anyone measured how much this slows things down with a typical
> userspace?

Not a measurement of the patch in question but an older similar patch 
on 3.0.51 (8572 running Debian 5.0.3):

$ ./test-lwsync 
cycles per emulated lwsync = 371
cycles per sync = 36

----------------------------------------------------------
#include <stdio.h>

int main (void) {
        unsigned long atb_start, atb_stop;
        unsigned long i;

        asm volatile ("mfspr %0,526" : "=r" (atb_start));
        for (i = 0; i < 100; i++) {
                asm volatile ("lwsync");
        }
        asm volatile ("mfspr %0,526" : "=r" (atb_stop));
        printf("cycles per emulated lwsync = %lu\n", (atb_stop - 
atb_start) / 100);

        asm volatile ("mfspr %0,526" : "=r" (atb_start));
        for (i = 0; i < 100; i++) {
                asm volatile ("sync");
        }
        asm volatile ("mfspr %0,526" : "=r" (atb_stop));

        printf("cycles per sync = %lu\n", (atb_stop - atb_start) / 
100);

        return 0;
}
----------------------------------------------------------







More information about the Linuxppc-dev mailing list