From: Gregory Haskins <ghaskins@novell.com>
To: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, alacrityvm-devel@lists.sourceforge.net
Subject: [KVM PATCH 1/2] KVM: Directly inject interrupts via irqfd
Date: Wed, 21 Oct 2009 10:34:53 -0400 [thread overview]
Message-ID: <20091021143453.14955.80578.stgit@dev.haskins.net> (raw)
In-Reply-To: <20091021143042.14955.22470.stgit@dev.haskins.net>
IRQFD currently uses a deferred workqueue item to execute the injection
operation. It was originally designed this way because kvm_set_irq()
required the caller to hold the irq_lock mutex, and the eventfd callback
is invoked from within a non-preemptible critical section.
With the advent of lockless injection support in kvm_set_irq, the deferment
mechanism is no longer technically needed. Since context switching to the
workqueue is a source of interrupt latency, lets switch to a direct
method.
Signed-off-by: Gregory Haskins <ghaskins@novell.com>
---
virt/kvm/eventfd.c | 15 +++------------
1 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index 30f70fd..1a529d4 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -49,16 +49,14 @@ struct _irqfd {
poll_table pt;
wait_queue_head_t *wqh;
wait_queue_t wait;
- struct work_struct inject;
struct work_struct shutdown;
};
static struct workqueue_struct *irqfd_cleanup_wq;
static void
-irqfd_inject(struct work_struct *work)
+irqfd_inject(struct _irqfd *irqfd)
{
- struct _irqfd *irqfd = container_of(work, struct _irqfd, inject);
struct kvm *kvm = irqfd->kvm;
kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, irqfd->gsi, 1);
@@ -80,12 +78,6 @@ irqfd_shutdown(struct work_struct *work)
remove_wait_queue(irqfd->wqh, &irqfd->wait);
/*
- * We know no new events will be scheduled at this point, so block
- * until all previously outstanding events have completed
- */
- flush_work(&irqfd->inject);
-
- /*
* It is now safe to release the object's resources
*/
eventfd_ctx_put(irqfd->eventfd);
@@ -126,7 +118,7 @@ irqfd_wakeup(wait_queue_t *wait, unsigned mode, int sync, void *key)
if (flags & POLLIN)
/* An event has been signaled, inject an interrupt */
- schedule_work(&irqfd->inject);
+ irqfd_inject(irqfd);
if (flags & POLLHUP) {
/* The eventfd is closing, detach from KVM */
@@ -179,7 +171,6 @@ kvm_irqfd_assign(struct kvm *kvm, int fd, int gsi)
irqfd->kvm = kvm;
irqfd->gsi = gsi;
INIT_LIST_HEAD(&irqfd->list);
- INIT_WORK(&irqfd->inject, irqfd_inject);
INIT_WORK(&irqfd->shutdown, irqfd_shutdown);
file = eventfd_fget(fd);
@@ -214,7 +205,7 @@ kvm_irqfd_assign(struct kvm *kvm, int fd, int gsi)
* before we registered, and trigger it as if we didn't miss it.
*/
if (events & POLLIN)
- schedule_work(&irqfd->inject);
+ irqfd_inject(irqfd);
/*
* do not drop the file until the irqfd is fully initialized, otherwise
next prev parent reply other threads:[~2009-10-21 14:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-21 14:34 [KVM PATCH 0/2] irqfd enhancements Gregory Haskins
2009-10-21 14:34 ` Gregory Haskins [this message]
2009-10-21 15:26 ` [KVM PATCH 1/2] KVM: Directly inject interrupts via irqfd Gleb Natapov
2009-10-21 15:34 ` Gregory Haskins
2009-10-21 15:36 ` Gleb Natapov
2009-10-21 15:42 ` Gregory Haskins
2009-10-22 15:07 ` Avi Kivity
2009-10-22 15:14 ` Gregory Haskins
2009-10-22 15:19 ` Avi Kivity
2009-10-22 15:33 ` Gregory Haskins
2009-10-21 14:34 ` [KVM PATCH 2/2] KVM: Remove unecessary irqfd-cleanup-wq Gregory Haskins
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=20091021143453.14955.80578.stgit@dev.haskins.net \
--to=ghaskins@novell.com \
--cc=alacrityvm-devel@lists.sourceforge.net \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.