On Thu, 2010-01-14 at 15:11 +0200, Avi Kivity wrote: > > Strangely, autotest only caught this on AMD and even it took a while. > > Lucas, can you integrate something like the following into autotest, > > so we exercise the preemption code harder? All right Avi, just added it to our TODO list, thanks! > > #!/usr/bin/python > > > > import sys, os, re, random, ctypes, time > > > > tasks = sys.argv[1:] > > > > threads = [int(t) > > for k in tasks > > for t in os.listdir('/proc/%s/task' % (k,))] > > > > cpus = [int(c[3:]) > > for c in os.listdir('/sys/devices/system/cpu') > > if re.match(r'cpu[0-9]+', c)] > > > > rand = random.Random() > > > > sched_setaffinity = ctypes.CDLL('libc.so.6').sched_setaffinity > > > > while True: > > pid = rand.choice(threads) > > cpu = rand.choice(cpus) > > mask = 1 << cpu > > sched_setaffinity(ctypes.c_int(pid), ctypes.c_size_t(4), > > ctypes.byref(ctypes.c_int(mask))) > > try: > > time.sleep(0.01) > > except: > > break > > -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html