From: Gleb Natapov <gleb@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: kvm@vger.kernel.org, mst@redhat.com
Subject: Re: [RFC PATCH 2/2] Cache msi irq destination.
Date: Mon, 13 Aug 2012 12:34:50 +0300 [thread overview]
Message-ID: <20120813093450.GO3341@redhat.com> (raw)
In-Reply-To: <5028C9BC.9060905@redhat.com>
On Mon, Aug 13, 2012 at 12:32:44PM +0300, Avi Kivity wrote:
> On 08/13/2012 12:16 PM, Gleb Natapov wrote:
> > Signed-off-by: Gleb Natapov <gleb@redhat.com>
> >
> > -int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src,
> > +int kvm_irq_delivery_to_apic(struct kvm_kernel_irq_routing_entry *e,
> > + struct kvm *kvm, struct kvm_lapic *src,
> > struct kvm_lapic_irq *irq)
>
> Would be nicer to put e at the end, and explain that it is optional.
>
Just a prototype to see how it goes :)
> > {
> > - int i, r = -1;
> > - struct kvm_vcpu *vcpu, *lowest = NULL;
> > + int i, r = -1, c = 0;
> > + struct kvm_vcpu *vcpu, *cache = NULL, *lowest = NULL;
> >
> > if (irq->dest_mode == 0 && irq->dest_id == 0xff &&
> > kvm_is_dm_lowest_prio(irq))
> > @@ -82,6 +83,8 @@ int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src,
> > if (!kvm_is_dm_lowest_prio(irq)) {
> > if (r < 0)
> > r = 0;
> > + c++;
> > + cache = vcpu;
> > r += kvm_apic_set_irq(vcpu, irq);
> > } else if (kvm_lapic_enabled(vcpu)) {
> > if (!lowest)
> > @@ -93,6 +96,8 @@ int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src,
> >
> > if (lowest)
> > r = kvm_apic_set_irq(lowest, irq);
> > + else if (e && c == 1)
> > + e->vcpu = cache; /* cache it */
> >
> > return r;
> > }
> > @@ -118,7 +123,9 @@ int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e,
> > irq.shorthand = 0;
> >
> > /* TODO Deal with RH bit of MSI message address */
> > - return kvm_irq_delivery_to_apic(kvm, NULL, &irq);
> > + if (e->vcpu)
> > + return kvm_apic_set_irq(e->vcpu, &irq);
> > + return kvm_irq_delivery_to_apic(e, kvm, NULL, &irq);
> > }
> >
> > int kvm_send_userspace_msi(struct kvm *kvm, struct kvm_msi *msi)
> > @@ -131,6 +138,7 @@ int kvm_send_userspace_msi(struct kvm *kvm, struct kvm_msi *msi)
> > route.msi.address_lo = msi->address_lo;
> > route.msi.address_hi = msi->address_hi;
> > route.msi.data = msi->data;
> > + route.vcpu = NULL;
> >
> > return kvm_set_msi(&route, kvm, KVM_USERSPACE_IRQ_SOURCE_ID, 1);
> > }
> >
>
> Missing cache invalidate on apicid write?
>
Yes. Need to call to kvm_set_irq_routing() in strategic places. Same for
ioapic.
> Otherwise nice and simple.
>
>
> --
> error compiling committee.c: too many arguments to function
--
Gleb.
next prev parent reply other threads:[~2012-08-13 9:34 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-13 9:16 [RFC PATCH 0/2] irq destination caching prototype Gleb Natapov
2012-08-13 9:16 ` [RFC PATCH 1/2] Call irq_rt callback under rcu_read_lock() Gleb Natapov
2012-08-13 9:16 ` [RFC PATCH 2/2] Cache msi irq destination Gleb Natapov
2012-08-13 9:32 ` Avi Kivity
2012-08-13 9:34 ` Gleb Natapov [this message]
2012-08-13 9:34 ` [RFC PATCH 0/2] irq destination caching prototype Michael S. Tsirkin
2012-08-13 9:36 ` Gleb Natapov
2012-08-13 9:46 ` Michael S. Tsirkin
2012-08-13 9:48 ` Gleb Natapov
2012-08-13 9:36 ` Avi Kivity
2012-08-13 10:12 ` Michael S. Tsirkin
2012-08-13 10:16 ` Gleb Natapov
2012-08-13 10:21 ` Avi Kivity
2012-08-13 10:24 ` Gleb Natapov
2012-08-13 10:31 ` Avi Kivity
2012-08-13 10:35 ` Gleb Natapov
2012-08-13 10:38 ` Michael S. Tsirkin
2012-08-13 10:58 ` Avi Kivity
2012-08-13 11:01 ` Gleb Natapov
2012-08-13 11:03 ` Avi Kivity
2012-08-13 11:12 ` Gleb Natapov
2012-08-13 11:22 ` Michael S. Tsirkin
2012-08-13 11:29 ` Gleb Natapov
2012-08-13 11:43 ` Gleb Natapov
2012-08-13 12:14 ` Avi Kivity
2012-08-13 11:30 ` Avi Kivity
2012-08-13 11:41 ` Gleb Natapov
2012-08-13 12:13 ` Avi Kivity
2012-08-13 12:59 ` Michael S. Tsirkin
2012-08-13 11:19 ` Michael S. Tsirkin
2012-08-13 9:43 ` Avi Kivity
2012-08-13 9:51 ` Michael S. Tsirkin
2012-08-13 9:53 ` Gleb Natapov
2012-08-13 10:33 ` Gleb Natapov
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=20120813093450.GO3341@redhat.com \
--to=gleb@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).