All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH stub] kvm: caching API for interrupts
Date: Mon, 30 Jul 2012 11:34:23 +0300	[thread overview]
Message-ID: <5016470F.5000101@redhat.com> (raw)
In-Reply-To: <20120729200058.GA13557@redhat.com>

On 07/29/2012 11:00 PM, Michael S. Tsirkin wrote:
> I've been looking at adding caching for IRQs so that we don't need to
> scan all VCPUs on each interrupt.  One issue I had a problem with, is
> how the cache structure can be used from both a thread (to fill out the
> cache) and interrupt (to actually send if cache is valid).
> 
> For now just added a lock field in the cache so we don't need to worry
> about this, and with such a lock in place we don't have to worry about
> RCU as cache can be invalidated simply under this lock.
> 
> For now this just declares the structure and updates the APIs
> so it's not intended to be applied, but just to give you
> the idea.
> 
> Comments, flames wellcome.

I hope you aren't expecting any of the latter.

> 
> +struct kvm_irq_cache {
> +	spinlock_t lock;
> +	bool valid;
> +	struct kvm_vcpu *dest;
> +	/* For now we only cache lapic irqs */
> +	struct kvm_lapic_irq irq;
> +	/* Protected by kvm->irq_cache_lock */
> +	struct list_head list;
> +};
> +

Why an external structure?

Why not add something to kvm_kernel_irq_routing_entry?  It is already
protected by rcu.

The atomic context code could look like this:


  if (kire->cache.valid) {
      kvm_apic_set_irq(kire->cache.vcpu, &kire->cache.irq);
      return;
  }
  queue_work(process_irq_slowpath);

The slow path tries to fills the cache, and processes the interrupt in
any case.

-- 
error compiling committee.c: too many arguments to function



      parent reply	other threads:[~2012-07-30  8:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-29 20:00 [PATCH stub] kvm: caching API for interrupts Michael S. Tsirkin
2012-07-29 20:03 ` Paolo Bonzini
2012-07-29 20:29   ` Michael S. Tsirkin
2012-07-30  6:57     ` Paolo Bonzini
2012-07-30  7:09 ` Gleb Natapov
2012-07-30  8:34 ` Avi Kivity [this message]

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=5016470F.5000101@redhat.com \
    --to=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 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.