On Thu, Apr 12, 2007 at 11:02:25AM +0300, Avi Kivity wrote:
> If you want condition variables, activate your cryogenically-cooled suit
> and post on it on lkml. This cannot be added to the kernel via kvm.
Better just rip it out. The code would be a lot simpler with opencoded
waitqueue use, and faster aswell due to getting rid of the indirect calls.
e.g. this:
+ if (vcpu->irq.task) {
+ struct timespec tmo = {
+ .tv_sec = 0,
+ .tv_nsec = 100000 /* 100us */
+ };
+
+ BUG_ON(vcpu->irq.task == current);
+
+ while (vcpu->irq.task) {
+ send_sig(SIGSTOP, vcpu->irq.task, 0);
+ condvar_wait(&vcpu->irq.cv, &vcpu->irq.lock,
+ timespec_to_jiffies(&tmo));
+ }
+
+ vcpu->irq.pending = 1;
+ }
+
would simply become
if (vcpu->irq.task) {
struct timespec tmo = {
.tv_sec = 0,
.tv_nsec = 100000 /* 100us */
};
BUG_ON(vcpu->irq.task == current);
for (;;) {
send_sig(SIGSTOP, vcpu->irq.task, 0);
prepare_to_wait(&vcpu->irq.wq, &wait,
TASK_UNINTERRUPTIBLE);
if (!vcpu->irq.task)
break;
spin_unlock(&vcpu->irq.lock);
schedule_timeout(timespec_to_jiffies(&tmo));
spin_lock(&vcpu->irq.lock);
}
finish_wait(&vcpu->irq.wq, &wait, TASK_UNINTERRUPTIBLE);
vcpu->irq.pending = 1;
}
with equal behaviour. although the send_sig in the loop and the very short
sleep time still look rather odd to me.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
kvm-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/kvm-devel