From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: Gregory Haskins <ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: irqdevice INTR example
Date: Thu, 12 Apr 2007 11:02:25 +0300 [thread overview]
Message-ID: <461DE791.1040707@qumranet.com> (raw)
In-Reply-To: <461D7702.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
Gregory Haskins wrote:
> Hi All,
> Attached are the first three patches in my queue. The first two you are likely familiar with at this point (though I have made some more of the requested changes to 02-irqdevice.patch). The last item (03-preemptible-cpu.patch) adds an implementation to the previously unused kvm_vcpu_intr() callback. This acts as a functional example of the INTR callback mechanism as Avi requested. Note that the work related to IF/NMI/TPR classification of interrupts happens later in my queue and is not mature enough to share yet, but hopefully soon.
>
>
> KVM: Preemptible VCPU
>
> From: <>
>
> This adds support for interrupting an executing CPU
>
> diff --git a/drivers/kvm/condvar.c b/drivers/kvm/condvar.c
> new file mode 100644
> index 0000000..87e464a
> --- /dev/null
> +++ b/drivers/kvm/condvar.c
> @@ -0,0 +1,109 @@
> +/*
> + * Condition Variable
> + *
> + * Copyright (C) 2007, Novell
> + *
> + * Authors:
> + * Gregory Haskins <ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2. See
> + * the COPYING file in the top-level directory.
> + *
> + */
>
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.
> +
> /*
> - * FIXME: Implement this or the CPU wont notice the interrupt until
> - * the next natural VMEXIT. Note that this is how the system
> - * has always worked, so nothing is broken here. This is a future
> - * enhancement
> + * HACK ALERT!
> + *
> + * We want to send a virtual interrupt signal to the task that owns
> + * the guest. However, the signal will only force a VMEXIT (via
> + * a reschedule IPI) if the task is currently in GUEST mode. There
> + * is a race condition between the time that we mark the vcpu as
> + * running and the time the system actually enter guest mode. Since
> + * there doesnt appear to be any way to help with this situation from
> + * the VT hardware, we are forced to wait to make sure the guest
>
We support AMD too.
> + * actually gets interrupted in a reasonable amount of time. If it
> + * does not, we assume that the IPI failed because it was too early
> + * and must try again until it does.
>
Waiting seems totally broken. I'm not even sure what we are waiting for
-- certainly you can't wait for re-entry into guest mode, since there's
not guarantee that's coming. Many times the guest will be sleeping on a
hlt instruction waiting for an interrupt.
If the guest is in guest mode, an IPI is right. If it is elsewhere, we
need to use one of the many (alas) standard wakeup mechanisms to wake up
userspace and let it know the vcpu needs service.
Qemu uses signals, but I think that making the vcpu fd writable is more
generic. For qemu, we can attach a signal to the fd (using fcntl(2));
that has the benefit of leaving the choice of which signal to use to
userspace.
> + *
> + * This condvar/spinlock/timeout/retry eliminate the race in a safe
> + * manner, at the expense of making the INTR delivery synchronous
> */
> + spin_lock(&vcpu->irq.lock);
> +
> + 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);
>
SIGSTOP?! I lost the plot here.
--
error compiling committee.c: too many arguments to function
-------------------------------------------------------------------------
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:02 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 [this message]
[not found] ` <461DE791.1040707-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-04-12 8:18 ` Christoph Hellwig
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=461DE791.1040707@qumranet.com \
--to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
--cc=ghaskins-Et1tbQHTxzrQT0dZR+AlfA@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