From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: Izik Eidus <izike-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Cc: kvm-devel <kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: [PATCH 2/2] make the injection of interrupts run at sleepable mode.
Date: Tue, 16 Oct 2007 11:41:56 +0200 [thread overview]
Message-ID: <47148764.706@qumranet.com> (raw)
In-Reply-To: <4713DAD3.90904-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Izik Eidus wrote:
> diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
> index 74b427f..0b12a98 100644
> --- a/drivers/kvm/kvm.h
> +++ b/drivers/kvm/kvm.h
> @@ -68,6 +68,7 @@
> * vcpu->requests bit members
> */
> #define KVM_TLB_FLUSH 0
> +#define VMX_INJECT_RMODE_IRQ 1
>
> /*
> * Address types:
> @@ -319,6 +320,7 @@ struct kvm_vcpu {
> int guest_mode;
> unsigned long requests;
> unsigned long irq_summary; /* bit vector: 1 per word in irq_pending */
> + int inject_rmode_irq;
> DECLARE_BITMAP(irq_pending, KVM_NR_INTERRUPTS);
> unsigned long regs[NR_VCPU_REGS]; /* for rsp: vcpu_load_rsp_rip() */
> unsigned long rip; /* needs vcpu_load_rsp_rip() */
> @@ -520,6 +522,7 @@ struct kvm_x86_ops {
> void (*inject_pending_irq)(struct kvm_vcpu *vcpu);
> void (*inject_pending_vectors)(struct kvm_vcpu *vcpu,
> struct kvm_run *run);
> + void (*vmx_inject_rmode_irq)(struct kvm_vcpu *vcpu, int irq);
> };
>
> extern struct kvm_x86_ops *kvm_x86_ops;
> diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
> index f58d49b..0e2bbe5 100644
> --- a/drivers/kvm/kvm_main.c
> +++ b/drivers/kvm/kvm_main.c
> @@ -2178,6 +2178,10 @@ again:
> if (unlikely(r))
> goto out;
>
> +vmx_inject_rmode:
> + if (test_and_clear_bit(VMX_INJECT_RMODE_IRQ, &vcpu->requests))
> + kvm_x86_ops->vmx_inject_rmode_irq(vcpu, vcpu->inject_rmode_irq);
> +
> preempt_disable();
>
> kvm_x86_ops->prepare_guest_switch(vcpu);
> @@ -2194,10 +2198,22 @@ again:
> goto out;
> }
>
> - if (irqchip_in_kernel(vcpu->kvm))
> + if (irqchip_in_kernel(vcpu->kvm)) {
> kvm_x86_ops->inject_pending_irq(vcpu);
> - else if (!vcpu->mmio_read_completed)
> + if (test_bit(VMX_INJECT_RMODE_IRQ, &vcpu->requests)) {
> + local_irq_enable();
> + preempt_enable();
> + goto vmx_inject_rmode;
> + }
> + }
> + else if (!vcpu->mmio_read_completed) {
> kvm_x86_ops->inject_pending_vectors(vcpu, kvm_run);
> + if (test_bit(VMX_INJECT_RMODE_IRQ, &vcpu->requests)) {
> + local_irq_enable();
> + preempt_enable();
> + goto vmx_inject_rmode;
> + }
> + }
>
>
This exposes a minor implementation details (how real mode irqs are
injected on intel) to the core code. How about we move all interrupt
injection out of the critical section? That will improve latency as well.
--
error compiling committee.c: too many arguments to function
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
next prev parent reply other threads:[~2007-10-16 9:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-15 21:25 [PATCH 2/2] make the injection of interrupts run at sleepable mode Izik Eidus
[not found] ` <4713DAD3.90904-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-16 1:31 ` Glauber de Oliveira Costa
[not found] ` <5d6222a80710151831p7ad47090qb478b304f6478859-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-10-16 6:32 ` Izik Eidus
2007-10-16 9:41 ` Avi Kivity [this message]
2007-10-17 2:00 ` [PATCH 2/2] make the injection of interrupts run atsleepable mode Dong, Eddie
[not found] ` <10EA09EFD8728347A513008B6B0DA77A023A7914-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-17 6:54 ` Izik Eidus
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=47148764.706@qumranet.com \
--to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
--cc=izike-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