From: Christoph Hellwig <hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
To: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: irqdevice INTR example
Date: Thu, 12 Apr 2007 09:18:53 +0100 [thread overview]
Message-ID: <20070412081853.GA5647@infradead.org> (raw)
In-Reply-To: <461DE791.1040707-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
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
next prev parent reply other threads:[~2007-04-12 8:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-12 4:02 irqdevice INTR example Gregory Haskins
[not found] ` <461D7702.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-04-12 8:02 ` Avi Kivity
[not found] ` <461DE791.1040707-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-04-12 8:18 ` Christoph Hellwig [this message]
2007-04-12 11:55 ` Gregory Haskins
[not found] ` <461DE5C9.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-04-12 12:49 ` Avi Kivity
[not found] ` <461E2AD5.7070905-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-04-12 13:43 ` Gregory Haskins
[not found] ` <461DFF1C.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-04-12 14:14 ` Avi Kivity
[not found] ` <461E3EDB.3080002-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-04-12 16:01 ` Gregory Haskins
2007-04-13 13:05 ` Fwd: " Gregory Haskins
[not found] ` <461E1F73.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-04-14 14:30 ` Avi Kivity
[not found] ` <4620E56A.7040207-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-04-15 22:32 ` Gregory Haskins
2007-04-15 23:32 ` Gregory Haskins
[not found] ` <46226FBC.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-04-16 5:46 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070412081853.GA5647@infradead.org \
--to=hch-wegcikhe2lqwvfeawa7xhq@public.gmane.org \
--cc=avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
--cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox