From: Borislav Petkov <bp@alien8.de>
To: Prarit Bhargava <prarit@redhat.com>
Cc: linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, Andy Lutomirski <luto@amacapital.net>,
Denys Vlasenko <dvlasenk@redhat.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>,
Igor Mammedov <imammedo@redhat.com>,
Fenghua Yu <fenghua.yu@intel.com>
Subject: Re: [PATCH] x86, cpuinfo fix cpu_data(0) x86_model_id field truncation
Date: Mon, 18 May 2015 21:45:38 +0200 [thread overview]
Message-ID: <20150518194538.GD23618@pd.tnic> (raw)
In-Reply-To: <1431973260-24617-1-git-send-email-prarit@redhat.com>
On Mon, May 18, 2015 at 02:21:00PM -0400, Prarit Bhargava wrote:
> When comparing 'model name' fields in /proc/cpuinfo it was noticed that
> a simple test comparing the model name fields was failing. After some
> simple investigation it was noticed that, in fact, the model name fields
> are different for each processor. Processor 0's model name field had
> white space removed, while the other processors did not.
>
> Another way of seeing this behaviour is to convert spaces into underscores
> in the output of /proc/cpuinfo,
>
> [thetango@prarit ~]# grep "^model name" /proc/cpuinfo | uniq -c | sed 's/\ /_/g'
> ______1_model_name :_AMD_Opteron(TM)_Processor_6272
> _____63_model_name :_AMD_Opteron(TM)_Processor_6272_________________
>
> which shows two different model name fields even though they should be the
> same.
>
> This occurs because the kernel calls strim() on cpu 0's x86_model_id field
I'd actually prefer this much simpler patch:
---
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
index e7d8c7608471..d215e9b26567 100644
--- a/arch/x86/kernel/cpu/proc.c
+++ b/arch/x86/kernel/cpu/proc.c
@@ -67,7 +67,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
c->x86_vendor_id[0] ? c->x86_vendor_id : "unknown",
c->x86,
c->x86_model,
- c->x86_model_id[0] ? c->x86_model_id : "unknown");
+ c->x86_model_id[0] ? strim(c->x86_model_id) : "unknown");
if (c->x86_mask || c->cpuid_level >= 0)
seq_printf(m, "stepping\t: %d\n", c->x86_mask);
---
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
next prev parent reply other threads:[~2015-05-18 19:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-18 18:21 [PATCH] x86, cpuinfo fix cpu_data(0) x86_model_id field truncation Prarit Bhargava
2015-05-18 19:45 ` Borislav Petkov [this message]
2015-05-18 20:27 ` Brian Gerst
2015-05-18 20:36 ` Borislav Petkov
2015-05-18 20:53 ` H. Peter Anvin
2015-05-18 22:04 ` Prarit Bhargava
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=20150518194538.GD23618@pd.tnic \
--to=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=dvlasenk@redhat.com \
--cc=fenghua.yu@intel.com \
--cc=hpa@zytor.com \
--cc=imammedo@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@redhat.com \
--cc=peter.p.waskiewicz.jr@intel.com \
--cc=prarit@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.