public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
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>,
	Igor Mammedov <imammedo@redhat.com>,
	Fenghua Yu <fenghua.yu@intel.com>,
	Brian Gerst <brgerst@gmail.com>
Subject: Re: [PATCH] x86/cpu: Strip leading and trailing spaces from the /proc/cpuinfo CPU model field
Date: Thu, 21 May 2015 15:38:47 +0200	[thread overview]
Message-ID: <20150521133847.GC3689@pd.tnic> (raw)
In-Reply-To: <1432121814-6349-1-git-send-email-prarit@redhat.com>

On Wed, May 20, 2015 at 07:36:54AM -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
> quick investigation it was noticed that the model name fields were actually
> different -- processor 0's model name field had trailing 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
> to output a pretty message to the console in print_cpu_info(), and as a
> result truncates the whitespace at the end of the x86_model_id field.
> 
> The x86_model_id field should be the same for the same processors.  This
> patch uses string functions to remove both leading and trailing whitespace
> in the x86_model_id field.  As a result the print_cpu_info() output looks
> like
> 
> smpboot: CPU0: AMD Opteron(TM) Processor 6272 (fam: 15, model: 01, stepping: 02)
> 
> and the x86_model_id field is correct on all processors on AMD platforms
> 
> [thetango@prarit ~]# grep "^model name" /proc/cpuinfo | uniq -c | sed 's/\ /_/g'
> _____64_model_name      :_AMD_Opteron(TM)_Processor_6272
> 
> and the functionality is correct on an Intel box:
> 
> [thetango@prarit2]# grep "^model name" /proc/cpuinfo | uniq -c | sed 's/\ /_/g'
> ____144_model_name      :_Intel(R)_Xeon(R)_CPU_E7-8890_v3_@_2.50GHz
> 
> [v2]: use memmove and update patch subject
> 
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: x86@kernel.org
> Cc: Andy Lutomirski <luto@amacapital.net>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Denys Vlasenko <dvlasenk@redhat.com>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: Igor Mammedov <imammedo@redhat.com>
> Cc: Fenghua Yu <fenghua.yu@intel.com>
> Cc: Brian Gerst <brgerst@gmail.com>
> ---
>  arch/x86/kernel/cpu/common.c | 17 ++++-------------
>  1 file changed, 4 insertions(+), 13 deletions(-)

Applied, thanks.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--

      reply	other threads:[~2015-05-21 13:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-20 11:36 [PATCH] x86/cpu: Strip leading and trailing spaces from the /proc/cpuinfo CPU model field Prarit Bhargava
2015-05-21 13:38 ` Borislav Petkov [this message]

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=20150521133847.GC3689@pd.tnic \
    --to=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox