From: Paolo Bonzini <pbonzini@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: avi@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH stub] kvm: caching API for interrupts
Date: Mon, 30 Jul 2012 08:57:54 +0200 [thread overview]
Message-ID: <50163072.6010106@redhat.com> (raw)
In-Reply-To: <20120729202922.GA13772@redhat.com>
Il 29/07/2012 22:29, Michael S. Tsirkin ha scritto:
> On Sun, Jul 29, 2012 at 10:03:45PM +0200, Paolo Bonzini wrote:
>> Il 29/07/2012 22:00, Michael S. Tsirkin ha scritto:
>>> 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.
>>
>> seqlock?
>
> AFAIK seqlock only works if uses of stale data have no side-effects,
> this is not the case here. We could use an rwlock I think.
If you can inject an interrupt using stale data (I think so, that would
be a race in the guest between setting the route and getting the
interrupt) you can use seqlock to get a consistent copy of the entry:
struct kvm_irq_cache ent, *list;
rcu_read_lock();
...
do {
seq = read_seqcount_begin(&list->cnt);
ent = *list;
} while (!read_seqcount_retry(&list->cnt, seq));
rcu_read_unlock();
Paolo
next prev parent reply other threads:[~2012-07-30 6:57 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 [this message]
2012-07-30 7:09 ` Gleb Natapov
2012-07-30 8:34 ` 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=50163072.6010106@redhat.com \
--to=pbonzini@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).