public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Mike Travis <travis@sgi.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Roland Dreier <rdreier@cisco.com>,
	Randy Dunlap <rdunlap@xenotime.net>, Tejun Heo <tj@kernel.org>,
	Andi Kleen <andi@firstfloor.org>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Yinghai Lu <yhlu.kernel@gmail.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	David Rientjes <rientjes@google.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>,
	Jack Steiner <steiner@sgi.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/7] x86: Limit the number of processor bootup messages
Date: Thu, 12 Nov 2009 19:09:10 +0100	[thread overview]
Message-ID: <20091112180910.GA8598@elte.hu> (raw)
In-Reply-To: <20091112171942.423844000@alcatraz.americas.sgi.com>


* Mike Travis <travis@sgi.com> wrote:

> --- linux.orig/arch/x86/kernel/smpboot.c
> +++ linux/arch/x86/kernel/smpboot.c
> @@ -442,6 +442,84 @@
>  		return c->llc_shared_map;
>  }
>  
> +/* Summarize Processor Information */
> +static void __init summarize_cpu_info(void)
> +{
> +	cpumask_var_t cpulist, cpusdone;
> +	int cpu;
> +	int err = 0;
> +
> +	if (!alloc_cpumask_var(&cpulist, GFP_KERNEL))
> +		err = 1;
> +	else if (!alloc_cpumask_var(&cpusdone, GFP_KERNEL)) {
> +		free_cpumask_var(cpulist);
> +		err = 1;
> +	}
> +	if (err) {
> +		printk(KERN_INFO "Can't print processor summaries\n");
> +		return;
> +	}
> +
> +	cpumask_clear(cpusdone);
> +	for (cpu = 0; cpu < nr_cpu_ids; cpu++) {
> +		struct cpuinfo_x86 *c;
> +		char buf[128];
> +		int ncpu, len;
> +		unsigned long minlpj, maxlpj, avglpj = 0;
> +
> +		/* skip if cpu has already been displayed */
> +		if (cpumask_test_cpu(cpu, cpusdone))
> +			continue;
> +
> +		c = &cpu_data(cpu);
> +		minlpj = ULONG_MAX;
> +		maxlpj = 0;
> +
> +		cpumask_clear(cpulist);
> +
> +		/* collate all cpus with same specifics */
> +		for (ncpu = cpu; ncpu < nr_cpu_ids; ncpu++) {
> +			struct cpuinfo_x86 *n = &cpu_data(ncpu);
> +
> +			if (c->x86 != n->x86 ||
> +			    c->x86_vendor != n->x86_vendor ||
> +			    c->x86_model  != n->x86_model  ||
> +			    c->x86_mask   != n->x86_mask   ||
> +			    strcmp(c->x86_model_id, n->x86_model_id))
> +				continue;
> +
> +			cpumask_set_cpu(ncpu, cpulist);
> +			cpumask_set_cpu(ncpu, cpusdone);
> +
> +			if (cpu_data(ncpu).loops_per_jiffy < minlpj)
> +				minlpj = cpu_data(ncpu).loops_per_jiffy;
> +
> +			if (cpu_data(ncpu).loops_per_jiffy > maxlpj)
> +				maxlpj = cpu_data(ncpu).loops_per_jiffy;
> +
> +			avglpj += cpu_data(ncpu).loops_per_jiffy;
> +		}
> +
> +		len = cpulist_scnprintf(buf, sizeof(buf), cpulist);
> +		printk(KERN_INFO
> +			"Processor Information for CPUS: %s%s\n",
> +				buf, (len == sizeof(buf)-1) ? "..." : "");
> +
> +		printk(KERN_INFO);
> +		print_cpu_info(c);
> +
> +		avglpj /= cpumask_weight(cpulist);
> +		printk(KERN_INFO "BogoMIPS: MIN %lu.%02lu (%lu) "
> +			"AVG %lu.%02lu (%lu) MAX %lu.%02lu (%lu)\n",
> +			minlpj/(500000/HZ), (minlpj/(5000/HZ)) % 100, minlpj,
> +			avglpj/(500000/HZ), (avglpj/(5000/HZ)) % 100, avglpj,
> +			maxlpj/(500000/HZ), (maxlpj/(5000/HZ)) % 100, maxlpj);
> +	}
> +
> +	free_cpumask_var(cpusdone);
> +	free_cpumask_var(cpulist);
> +}
> +

Sigh, that's _way_ too complex.

If you cannot print it in a summarized way without carrying over stupid 
state like bitmaps then please do the simple and obvious, and print:

booting CPUs: #0 #1 #2 #3 #4 #5 #6 ...

It's a really long line with 4096 CPUs but that's not a big problem - on 
most systems it will look sane.

	Ingo

  reply	other threads:[~2009-11-12 18:10 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-12 17:19 [PATCH 0/7] Limit console output by suppressing repetitious messages Mike Travis
2009-11-12 17:19 ` [PATCH 1/7] x86: Limit the number of processor bootup messages Mike Travis
2009-11-12 18:09   ` Ingo Molnar [this message]
2009-11-12 20:05     ` Mike Travis
2009-11-13  9:52       ` Ingo Molnar
2009-11-13 13:43         ` Mike Travis
2009-11-12 22:10   ` Yinghai Lu
2009-11-13 13:46     ` Mike Travis
2009-11-13 21:58       ` Yinghai Lu
2009-11-12 17:19 ` [PATCH 2/7] ACPI: Limit the number of per cpu ACPI " Mike Travis
2009-11-12 21:02   ` David Rientjes
2009-11-12 21:19     ` Mike Travis
2009-11-12 21:28       ` David Rientjes
2009-11-13 13:53         ` Mike Travis
2009-11-12 17:19 ` [PATCH 3/7] INIT: Limit the number of per cpu INIT " Mike Travis
2009-11-12 21:06   ` David Rientjes
2009-11-12 21:20     ` Mike Travis
2009-11-12 17:19 ` [PATCH 4/7] firmware: Limit the number of per cpu firmware messages during bootup Mike Travis
2009-11-12 17:19 ` [PATCH 5/7] x86: Limit the number of per cpu MCE bootup messages Mike Travis
2009-11-12 17:19 ` [PATCH 6/7] sched: Limit the number of scheduler debug messages Mike Travis
2009-11-12 17:19 ` [PATCH 7/7] x86: Limit number of per cpu TSC sync messages Mike Travis
2009-11-12 20:48 ` [patch] x86: reduce srat verbosity in the kernel log David Rientjes
2009-11-13  9:53   ` Ingo Molnar
2009-11-13 10:02     ` David Rientjes
2009-11-13 10:13       ` Ingo Molnar
2009-11-13 10:29         ` David Rientjes
2009-11-13 10:57           ` Ingo Molnar
2009-11-20 18:37         ` Pavel Machek
2009-11-20 18:58           ` Mike Travis
2009-11-12 22:16 ` [PATCH 0/7] Limit console output by suppressing repetitious messages Yinghai Lu

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=20091112180910.GA8598@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=fweisbec@gmail.com \
    --cc=gregkh@suse.de \
    --cc=heiko.carstens@de.ibm.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdreier@cisco.com \
    --cc=rdunlap@xenotime.net \
    --cc=rientjes@google.com \
    --cc=rostedt@goodmis.org \
    --cc=rusty@rustcorp.com.au \
    --cc=seto.hidetoshi@jp.fujitsu.com \
    --cc=steiner@sgi.com \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    --cc=travis@sgi.com \
    --cc=x86@kernel.org \
    --cc=yhlu.kernel@gmail.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