From patchwork Fri Nov 16 20:42:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 1757181 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 5355FDF288 for ; Fri, 16 Nov 2012 20:44:19 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TZSk1-000426-Dh; Fri, 16 Nov 2012 20:42:21 +0000 Received: from mail-vc0-f177.google.com ([209.85.220.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TZSjy-00041k-AR for linux-arm-kernel@lists.infradead.org; Fri, 16 Nov 2012 20:42:19 +0000 Received: by mail-vc0-f177.google.com with SMTP id p16so3270141vcq.36 for ; Fri, 16 Nov 2012 12:42:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version:content-type:x-gm-message-state; bh=S1DUHbaJJ/WZZluojtMea/FPZds9Z8froF80NJdU1/Y=; b=mBr8R//qSEEtMKAwnwFMp3gDal9aY4ZPLIPt6Pn4RrT7PjvNFJlYIvepDt7a9MQVB1 wdO+wtOXkkGjLD5ZnrlbgxMfoXnuZcsblHgCAqbRJ1TOgNFvzSmAFG9ii5TS1HtoYmk3 wXGjyoc9LDaK39qWKKBu9VFd0CIHvpfpWjdnOOB9nfbRu7SvEYzX0/zpWf5kIbEdfQlO lzhqsPOHM4pUQzmERq4Jlf9dFpvoOq7WPxwmdDqT4yE64Kyqj7bPqcsaFXdko+R3f8Gq pilfFkll+kUZ7icQs/z0Pal5Dg7wcEZG0Czq9SgrByUAM14fvaeNWQ2WY2e6UPfhiT0i TdXA== Received: by 10.52.173.34 with SMTP id bh2mr7531813vdc.73.1353098535660; Fri, 16 Nov 2012 12:42:15 -0800 (PST) Received: from xanadu.home (modemcable203.213-202-24.mc.videotron.ca. [24.202.213.203]) by mx.google.com with ESMTPS id t12sm1456783vdi.18.2012.11.16.12.42.14 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 16 Nov 2012 12:42:15 -0800 (PST) Date: Fri, 16 Nov 2012 15:42:13 -0500 (EST) From: Nicolas Pitre To: Lorenzo Pieralisi Subject: Re: [RFC PATCH v2 2/2] ARM: kernel: update cpuinfo to print all online CPUs features In-Reply-To: Message-ID: References: <1353066105-19486-1-git-send-email-lorenzo.pieralisi@arm.com> <1353066105-19486-3-git-send-email-lorenzo.pieralisi@arm.com> User-Agent: Alpine 2.02 (LFD 1266 2009-07-14) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQnxYD5b0vlhCNz79qkLFrLt+Sfucn6UFkfyY2kSB0TIjMhHK5YJcuYZ40OZafeqtyU7Q3/1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121116_154218_465538_2816F5C2 X-CRM114-Status: GOOD ( 17.42 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.177 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Dave Martin , Russell King , Catalin Marinas , Will Deacon , Amit Kucheria , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Fri, 16 Nov 2012, Nicolas Pitre wrote: > On Fri, 16 Nov 2012, 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 so that a read from > > /proc/cpuinfo prints HW information for all online CPUs at once, mirroring > > x86 behaviour. > > > > Signed-off-by: Lorenzo Pieralisi > > Acked-by: Nicolas Pitre Sorry, let me take this back. There are a few issues with the output. First, the "processor" line is doubled for each core. If glibc actually looks at those lines to determine the number of CPUs like the nearby comment says then it'll get twice the actual number of processors. And then, there is an annoying empty line between the BogoMIPS line and the rest of the information for each core. So, I'd suggest folding this into your patch, with my ACK of course. Nicolas diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 53e532704c..bfa673de9e 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -859,18 +859,18 @@ static int c_show(struct seq_file *m, void *v) u32 cpuid; 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); - -#if defined(CONFIG_SMP) /* * glibc reads /proc/cpuinfo to determine the number of * online processors, looking for lines beginning with * "processor". Give glibc what it expects. */ seq_printf(m, "processor\t: %d\n", i); - seq_printf(m, "BogoMIPS\t: %lu.%02lu\n\n", + cpuid = is_smp() ? per_cpu(cpu_data, i).cpuid : read_cpuid_id(); + seq_printf(m, "model name\t: %s rev %d (%s)\n", + cpu_name, cpuid & 15, elf_platform); + +#if defined(CONFIG_SMP) + seq_printf(m, "BogoMIPS\t: %lu.%02lu\n", per_cpu(cpu_data, i).loops_per_jiffy / (500000UL/HZ), (per_cpu(cpu_data, i).loops_per_jiffy / (5000UL/HZ)) % 100); #else