From: santosh.shilimkar@ti.com (Santosh Shilimkar)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH] ARM: kernel: update cpuinfo to print all online CPUs features
Date: Tue, 16 Oct 2012 23:29:39 +0530 [thread overview]
Message-ID: <507DA08B.502@ti.com> (raw)
In-Reply-To: <1350404684-6883-1-git-send-email-lorenzo.pieralisi@arm.com>
On Tuesday 16 October 2012 09:54 PM, Lorenzo Pieralisi wrote:
> Currently, reading /proc/cpuinfo provides userspace with CPU ID of
> the CPU carrying out the read from the file. This is fine as long as all
> CPUs in the system are the same. With the advent of big.LITTLE and
> heterogenous ARM systems this approach provides user space with incorrect
> bits of information since CPU ids in the system might differ from the one
> provided by the CPU reading the file.
>
> This patch updates the cpuinfo show function and some internal data
> structures so that a read from /proc/cpuinfo prints HW information for
> all online CPUs at once, mirroring x86 behaviour.
>
> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> ---
>
> Posting it as a way to get advice on the best way to improve /proc/cpuinfo for
> heterogenous multi-cluster systems and to provide proper information to
> userspace without breaking existing semantics, no more than that.
>
> Comments more than welcome.
>
> Thanks,
> Lorenzo
>
> arch/arm/include/asm/cpu.h | 1 +
> arch/arm/kernel/setup.c | 66 +++++++++++++++++++++++-----------------------
> arch/arm/kernel/smp.c | 1 +
> 3 files changed, 35 insertions(+), 33 deletions(-)
>
[...]
> diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
> index 8707cff..bf7839d08 100644
> --- a/arch/arm/kernel/setup.c
> +++ b/arch/arm/kernel/setup.c
> @@ -1054,13 +1054,15 @@ static const char *hwcap_str[] = {
>
> static int c_show(struct seq_file *m, void *v)
> {
> - int i;
> + int i, j;
> + u32 cpuid;
>
> - seq_printf(m, "Processor\t: %s rev %d (%s)\n",
> - cpu_name, read_cpuid_id() & 15, elf_platform);
> + for_each_online_cpu(i) {
> + cpuid = is_smp() ? per_cpu(cpu_data, i).cpuid : read_cpuid_id();
> + seq_printf(m, "Processor\t: %s rev %d (%s)\n",
> + cpu_name, cpuid & 15, elf_platform);
>
Not exactly related to the $subject patch, but I remember doing a patch
to have cat /proc/cpuinfo spitting only online CPUs just like x86 using
for_each_online_cpu(i).
At that point Russell mentioned about a possibility of read() syscall
spreading over the hot-plug operation and hence the above may not
be safe.
is that right Russell ?
regards
Santosh
next prev parent reply other threads:[~2012-10-16 17:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-16 16:24 [RFC PATCH] ARM: kernel: update cpuinfo to print all online CPUs features Lorenzo Pieralisi
2012-10-16 17:59 ` Santosh Shilimkar [this message]
2012-10-16 21:47 ` Russell King - ARM Linux
2012-10-17 10:20 ` Lorenzo Pieralisi
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=507DA08B.502@ti.com \
--to=santosh.shilimkar@ti.com \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).