From: "Luis R. Rodriguez" <mcgrof@suse.com>
To: "Petr Mládek" <pmladek@suse.cz>
Cc: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>,
hpa@linux.intel.com, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>,
Stephen Warren <swarren@wwwdotorg.org>,
Michal Hocko <mhocko@suse.cz>, Joe Perches <joe@perches.com>,
Arun KS <arunks.linux@gmail.com>,
Kees Cook <keescook@chromium.org>,
Davidlohr Bueso <davidlohr@hp.com>,
Chris Metcalf <cmetcalf@tilera.com>
Subject: Re: [RFT 2/2] printk: allow increasing the ring buffer depending on the number of CPUs
Date: Wed, 18 Jun 2014 22:43:35 +0200 [thread overview]
Message-ID: <20140618204335.GQ4841@wotan.suse.de> (raw)
In-Reply-To: <20140618154255.GJ634@pathway.suse.cz>
On Wed, Jun 18, 2014 at 05:42:55PM +0200, Petr Mládek wrote:
> On Wed 2014-06-18 04:14:25, Luis R. Rodriguez wrote:
> > From: "Luis R. Rodriguez" <mcgrof@suse.com>
> >
> > The default size of the ring buffer is too small for machines
> > with a large amount of CPUs under heavy load. What ends up
> > happening when debugging is the ring buffer overlaps and chews
> > up old messages making debugging impossible unless the size is
> > passed as a kernel parameter. An idle system upon boot up will
> > on average spew out only about one or two extra lines but where
> > this really matters is on heavy load and that will vary widely
> > depending on the system and environment.
> >
> > There are mechanisms to help increase the kernel ring buffer
> > for tracing through debugfs, and those interfaces even allow growing
> > the kernel ring buffer per CPU. We also have a static value which
> > can be passed upon boot. Relying on debugfs however is not ideal
> > for production, and relying on the value passed upon bootup is
> > can only used *after* an issue has creeped up. Instead of being
> > reactive this adds a proactive measure which lets you scale the
> > amount of contributions you'd expect to the kernel ring buffer
> > under load by each CPU in the worst case scenario.
> >
> > We use num_possible_cpus() to avoid complexities which could be
> > introduced by dynamically changing the ring buffer size at run
> > time, num_possible_cpus() lets us use the upper limit on possible
> > number of CPUs therefore avoiding having to deal with hotplugging
> > CPUs on and off. This introduces the kernel configuration option
> > LOG_CPU_MIN_BUF_SHIFT which is used to specify the maximum amount
> > of contributions to the kernel ring buffer in the worst case before
> > the kernel ring buffer flips over, the size is specified as a power
> > of 2. The total amount of contributions made by each CPU must be
> > greater than half of the default kernel ring buffer size
> > (1 << LOG_BUF_SHIFT bytes) in order to trigger an increase upon
> > bootup. The kernel ring buffer is increased to the next power of
> > two that would fit the required minimum kernel ring buffer size
> > plus the additional CPU contribution. For example if LOG_BUF_SHIFT
> > is 18 (256 KB) you'd require at least 128 KB contributions by
> > other CPUs in order to trigger an increase of the kernel ring buffer.
> > With a LOG_CPU_BUF_SHIFT of 12 (4 KB) you'd require at least
> > anything over > 64 possible CPUs to trigger an increase. If you
> > had 128 possible CPUs the amount of minimum required kernel ring
> > buffer bumps to:
> >
> > ((1 << 18) + ((128 - 1) * (1 << 12))) / 1024 = 764 KB
> >
> > Since we require the ring buffer to be a power of two the new
> > required size would be 1024 KB.
> >
> > This CPU contributions are ignored when the "log_buf_len" kernel parameter
> > is used as it forces the exact size of the ring buffer to an expected power
> > of two value.
> >
> > Cc: Andrew Lunn <andrew@lunn.ch>
> > Cc: Stephen Warren <swarren@wwwdotorg.org>
> > Cc: Michal Hocko <mhocko@suse.cz>
> > Cc: Petr Mladek <pmladek@suse.cz>
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Cc: Joe Perches <joe@perches.com>
> > Cc: Arun KS <arunks.linux@gmail.com>
> > Cc: Kees Cook <keescook@chromium.org>
> > Cc: Davidlohr Bueso <davidlohr@hp.com>
> > Cc: Chris Metcalf <cmetcalf@tilera.com>
> > Cc: linux-kernel@vger.kernel.org
> > Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
>
> It is where we ended after several versions. I am happy with this
> state.
>
> Signed-off-by: Petr Mladek <pmladek@suse.cz>
> Tested-by: Petr Mladek <pmladek@suse.cz>
Thanks, I did some minor spell fixes, and also renamed min to max
for the kconfig variable. Will send as final patches now.
Luis
next prev parent reply other threads:[~2014-06-18 20:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-18 11:14 [RFT 1/2] printk: make dynamic kernel ring buffer alignemnt explicit Luis R. Rodriguez
2014-06-18 11:14 ` [RFT 2/2] printk: allow increasing the ring buffer depending on the number of CPUs Luis R. Rodriguez
2014-06-18 15:42 ` Petr Mládek
2014-06-18 20:43 ` Luis R. Rodriguez [this message]
2014-06-18 18:11 ` Davidlohr Bueso
2014-06-18 18:14 ` Davidlohr Bueso
2014-06-18 19:21 ` Luis R. Rodriguez
2014-06-18 15:40 ` [RFT 1/2] printk: make dynamic kernel ring buffer alignemnt explicit Petr Mládek
2014-06-18 15:56 ` Stephen Warren
2014-06-18 19:33 ` Luis R. Rodriguez
2014-06-18 19:46 ` Stephen Warren
2014-06-18 20:03 ` Luis R. Rodriguez
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=20140618204335.GQ4841@wotan.suse.de \
--to=mcgrof@suse.com \
--cc=akpm@linux-foundation.org \
--cc=andrew@lunn.ch \
--cc=arunks.linux@gmail.com \
--cc=cmetcalf@tilera.com \
--cc=davidlohr@hp.com \
--cc=hpa@linux.intel.com \
--cc=joe@perches.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@do-not-panic.com \
--cc=mhocko@suse.cz \
--cc=pmladek@suse.cz \
--cc=swarren@wwwdotorg.org \
/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