public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <mcgrof@suse.com>
To: Davidlohr Bueso <davidlohr@hp.com>
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>, Petr Mladek <pmladek@suse.cz>,
	Joe Perches <joe@perches.com>, Arun KS <arunks.linux@gmail.com>,
	Kees Cook <keescook@chromium.org>,
	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 21:21:34 +0200	[thread overview]
Message-ID: <20140618192134.GN4841@wotan.suse.de> (raw)
In-Reply-To: <1403115072.3787.3.camel@buesod1.americas.hpqcorp.net>

On Wed, Jun 18, 2014 at 11:11:12AM -0700, Davidlohr Bueso wrote:
> On Wed, 2014-06-18 at 04:14 -0700, Luis R. Rodriguez wrote:
> > From: "Luis R. Rodriguez" <mcgrof@suse.com>
> > Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
> 
> Looks good Luis, thanks a lot for doing this -- it will definitely help
> my everyday debugging issues on huge machines.
> 
> I ran this on my 160-core Westmere. Some nits below, otherwise:
> 
> Reviewed-and-tested-by: Davidlohr Bueso <davidlohr@hp.com>

Great thanks for testing and your review!

> > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> > index af164a7..7c7b599 100644
> > --- a/kernel/printk/printk.c
> > +++ b/kernel/printk/printk.c
> > @@ -848,12 +849,43 @@ static int __init log_buf_len_setup(char *str)
> >  }
> >  early_param("log_buf_len", log_buf_len_setup);
> >  
> > +static void __init log_buf_add_cpu(void)
> > +{
> > +	int cpu_extra;
> 
> unsigned int

Amended.

> > +
> > +	/*
> > +	 * archs should set up cpu_possible_bits properly with
> > +	 * set_cpu_possible() after setup_arch() but just in
> > +	 * case lets ensure this is valid. During an early
> > +	 * call before setup_arch()() this will be 1.
> > +	 */
> > +	if (num_possible_cpus() <= 1)
> 
> This can never return 0, so how about making it == 1?

I was originally concerned over the early boot code which had
not yet called setup_arch() but since we now have a check for
early on setup_log_buf() before calling log_buf_add_cpu() I
think its safe to check for 1 then, will change! I'll also
remove the note about this always returning 1 on early init
before setup_arch() as I only confirmed that for x86 -- unless
of course there is code that ensures this for early boot for
all archs, I just can't find it.

> > +		return;
> > +
> > +	cpu_extra = (num_possible_cpus() - 1) * __LOG_CPU_MIN_BUF_LEN;
> > +
> > +	/* by default this will only continue through for large > 64 CPUs */
> > +	if (cpu_extra <= __LOG_BUF_LEN / 2)
> > +		return;
> > +
> > +	pr_info("log_buf_len cpu_extra contribution: %d\n", cpu_extra);
> 
> We should add 'bytes' for units. 

That should mean also amending the orignal setup_log_buf() for the final size,
will do that too.

> Also, while at it, how about making it easier for users and also print
> the individual contribution of each CPU

Sure, done. While at it I renamed LOG_CPU_MIN_BUF_SHIFT to MAX to annotate folks
want to to consider the worst case scenario to help with debugging on production.

  Luis

  parent reply	other threads:[~2014-06-18 19:21 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
2014-06-18 18:11   ` Davidlohr Bueso
2014-06-18 18:14     ` Davidlohr Bueso
2014-06-18 19:21     ` Luis R. Rodriguez [this message]
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=20140618192134.GN4841@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