public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: paulmck@linux.vnet.ibm.com, Gleb Natapov <gleb@redhat.com>,
	kvm@vger.kernel.org, mtosatti@redhat.com
Subject: Re: [PATCHv2] KVM: optimize apic interrupt delivery
Date: Wed, 12 Sep 2012 10:41:50 +0300	[thread overview]
Message-ID: <50503CBE.6070004@redhat.com> (raw)
In-Reply-To: <20120911223952.GB28821@redhat.com>

On 09/12/2012 01:39 AM, Michael S. Tsirkin wrote:
> On Tue, Sep 11, 2012 at 11:04:59PM +0300, Avi Kivity wrote:
>> On 09/11/2012 08:13 PM, Paul E. McKenney wrote:
>> > > Is there a risk of DOS if RCU is delayed while
>> > > lots of memory is queued up in this way?
>> > > If yes is this a generic problem with kfree_rcu
>> > > that should be addressed in core kernel?
>> >
>> > There is indeed a risk.  The kfree_rcu() implementation cannot really
>> > decide what to do here, especially given that it is callable with irqs
>> > disabled.
>> >
>> > The usual approach is to keep a per-CPU counter and count it down from
>> > some number for each kfree_rcu().  When it reaches zero, invoke
>> > synchronize_rcu() as well as kfree_rcu(), and then reset it to the
>> > "some number" mentioned above.
>> >
>> > In theory, I could create an API that did this.  In practice, I have no
>> > idea how to choose the number -- much depends on the size of the object
>> > being freed, for example.
>> 
>> Perhaps approach it from the other direction?  If we are under memory
>> pressure, start synchronize_rcu()ing, much like the shrinker operates.
>> 
> 
> Tricky ...
> 
> For now, how about we call synchronize_rcu_expedited in kvm and call it a day?

I prefer to let the rcu people fix it.

> Also has an advantage that apic map is guaranteed to be in sync
> with guest - while it seems that it's already correct as is,
> synchronous operation is way simpler.

It works exactly the same way.  Interrupts started in parallel with an
ID update will use either map.  Interrupts started afterwards will use
the new map.

> 
> We can add a tracepoint so that we can detect it if this starts
> happening a lot for some guest.
>

No point, guests don't update their APIC ID (or related) after booting.

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

  reply	other threads:[~2012-09-12  7:41 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-11 13:02 [PATCHv2] KVM: optimize apic interrupt delivery Gleb Natapov
2012-09-11 13:26 ` Avi Kivity
2012-09-11 14:02   ` Michael S. Tsirkin
2012-09-11 14:46   ` Gleb Natapov
2012-09-11 15:51     ` Avi Kivity
2012-09-11 14:10 ` Michael S. Tsirkin
2012-09-11 17:13   ` Paul E. McKenney
2012-09-11 20:04     ` Avi Kivity
2012-09-11 22:39       ` Michael S. Tsirkin
2012-09-12  7:41         ` Avi Kivity [this message]
2012-09-11 22:33     ` Michael S. Tsirkin
2012-09-12  1:03       ` Paul E. McKenney
2012-09-12  7:45         ` Avi Kivity
2012-09-12 12:34           ` Gleb Natapov
     [not found]             ` <505081E9.8080505@redhat.com>
2012-09-12 12:44               ` Gleb Natapov
2012-09-12 15:13                 ` Paul E. McKenney
2013-11-26 16:24                   ` Michael S. Tsirkin
2013-11-26 19:35                     ` Paul E. McKenney
2013-11-27  8:00                       ` Gleb Natapov
2013-11-27 17:06                         ` Paul E. McKenney
2013-11-28  8:55                           ` Gleb Natapov
2013-12-05 23:00                             ` Paul E. McKenney
2013-12-06 11:32                               ` Gleb Natapov
2013-11-26 20:07                     ` Marcelo Tosatti
2012-09-12 12:17     ` 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=50503CBE.6070004@redhat.com \
    --to=avi@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=paulmck@linux.vnet.ibm.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