From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Gleb Natapov <gleb@redhat.com>, kvm@vger.kernel.org, mtosatti@redhat.com
Subject: Re: [PATCHv2] KVM: optimize apic interrupt delivery
Date: Tue, 26 Nov 2013 18:24:13 +0200 [thread overview]
Message-ID: <20131126162402.GA24806@redhat.com> (raw)
In-Reply-To: <20120912151354.GO4257@linux.vnet.ibm.com>
On Wed, Sep 12, 2012 at 08:13:54AM -0700, Paul E. McKenney wrote:
> On Wed, Sep 12, 2012 at 03:44:26PM +0300, Gleb Natapov wrote:
> > On Wed, Sep 12, 2012 at 03:36:57PM +0300, Avi Kivity wrote:
> > > On 09/12/2012 03:34 PM, Gleb Natapov wrote:
> > > > On Wed, Sep 12, 2012 at 10:45:22AM +0300, Avi Kivity wrote:
> > > >> On 09/12/2012 04:03 AM, Paul E. McKenney wrote:
> > > >> >> > > Paul, I'd like to check something with you here:
> > > >> >> > > this function can be triggered by userspace,
> > > >> >> > > any number of times; we allocate
> > > >> >> > > a 2K chunk of memory that is later freed by
> > > >> >> > > kfree_rcu.
> > > >> >> > >
> > > >> >> > > 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.
> > > >> >>
> > > >> >> In our case it's a 2K object. Is it a practical risk?
> > > >> >
> > > >> > How many kfree_rcu()s per second can a given user cause to happen?
> > > >>
> > > >> Not much more than a few hundred thousand per second per process (normal
> > > >> operation is zero).
> > > >>
> > > > I managed to do 21466 per second.
> > >
> > > Strange, why so slow?
> > >
> > Because ftrace buffer overflows :) With bigger buffer I get 169940.
>
> Ah, good, should not be a problem. In contrast, if you ran kfree_rcu() in
> a tight loop, you could probably do in excess of 100M per CPU per second.
> Now -that- might be a problem.
>
> Well, it -might- be a problem if you somehow figured out how to allocate
> memory that quickly in a steady-state manner. ;-)
>
> > > >> Good idea. Michael, is should be easy to modify kvm-unit-tests to write
> > > >> to the APIC ID register in a loop.
> > > >>
> > > > I did. Memory consumption does not grow on otherwise idle host.
>
> Very good -- the checks in __call_rcu(), which is common code invoked by
> kfree_rcu(), seem to be doing their job, then. These do keep a per-CPU
> counter, which can be adjusted via rcutree.blimit, which defaults
> to taking evasive action if more than 10K callbacks are waiting on a
> given CPU.
>
> My concern was that you might be overrunning that limit in way less
> than a grace period (as in about a hundred microseconds. My concern
> was of course unfounded -- you take several grace periods in push 10K
> callbacks through.
>
> Thanx, Paul
Gleb noted that Documentation/RCU/checklist.txt has this text:
An especially important property of the synchronize_rcu()
primitive is that it automatically self-limits: if grace periods
are delayed for whatever reason, then the synchronize_rcu()
primitive will correspondingly delay updates. In contrast,
code using call_rcu() should explicitly limit update rate in
cases where grace periods are delayed, as failing to do so can
result in excessive realtime latencies or even OOM conditions.
If call_rcu is self-limiting maybe this should be documented ...
> > > Ok, thanks.
> > >
> > >
> > > --
> > > error compiling committee.c: too many arguments to function
> >
> > --
> > Gleb.
> >
next prev parent reply other threads:[~2013-11-26 16:20 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
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 [this message]
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=20131126162402.GA24806@redhat.com \
--to=mst@redhat.com \
--cc=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
--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