Re: [PATCH v5 4/4] KVM: PPC: e500: Save/restore SPE state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 31, 2011 at 12:11:48PM +0200, Alexander Graf wrote:
> Scott, to verify that I don't completely screw up the lazy FPU work
> back when I did it, I wrote some small test program that would just
> initialize an fpu register with a value and then constantly loop to
> verify if it's still the same.  I ran that program with different
> values on the host and guest sides.  That exposed quite a lot of
> glitches.
> 
> It would be nice if you could provide something similar for the SPE
> patches, so we have some more faith in it :).

Here it is.  As expected, it fails with v4 of the SPE patch once you run
two instances in parallel on the guest.  It passes with v5, with multiple
instances in both the host and the guest.

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <stdint.h>

int main(void)
{
	double reg, tmp;
	uint64_t val;

	srand(time(NULL) ^ (getpid() << 16));
	val = rand();
	val <<= 32;
	val |= rand();

	printf("pid %d: val is %#llx\n", getpid(), val);

	asm volatile("evldd %0, %2;"
	             "1: evldd %1, %2;"
	             "evcmpeq 0, %0, %1;"
	             "bso 1b" :
	             "=r" (reg), "=r" (tmp) :
	             "m" (val));

	printf("FAIL: pid %d: val %#llx reg %#llx tmp %#llx\n",
	       val, *(uint64_t *)&reg, *(uint64_t *)&tmp);
	return 1;
}

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM Development]     [KVM ARM]     [KVM ia64]     [Linux Virtualization]     [Linux USB Devel]     [Linux Video]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux