Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: David Daney <ddaney.cavm@gmail.com>
Cc: Joshua Kinard <kumba@gentoo.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	Linux MIPS List <linux-mips@linux-mips.org>
Subject: Re: [PATCH] MIPS: Display CPU byteorder in /proc/cpuinfo
Date: Wed, 21 Jan 2015 10:50:15 +0400	[thread overview]
Message-ID: <20150121105015.94e2448a20847aa2eac738db@gmail.com> (raw)
In-Reply-To: <54BEDF3C.6040105@gmail.com>

On Tue, 20 Jan 2015 15:05:32 -0800
David Daney <ddaney.cavm@gmail.com> wrote:

> On 01/19/2015 01:02 AM, Joshua Kinard wrote:
> > From: Joshua Kinard <kumba@gentoo.org>
> >
> > This is a small patch to display the CPU byteorder that the kernel was compiled
> > with in /proc/cpuinfo.
> 
> What would use this?  Or in other words, why is this needed?

If you run some test software (e.g. in particular benchmarking software)
on a linux system then you are interisting in a log file with system information.
It's very likely that your log file keeps /proc/cpuinfo content.
So if your /proc/cpuinfo has byteorder information then your have system
byteorder information in your log file for free :)

If you write a bugreport and your attach /proc/cpuinfo content to it
then a bugreport reader have no question on byteorder.

> 
> Userspace C code doesn't need this as it has its own standard ways of 
> determining endianness.
> 
> If you need to know as a user you can do:
> 
>     readelf -h /bin/sh | grep Data | cut -d, -f2

Does this line really show your current CPU byteorder?

IMHO this 'readelf' method is not very reliable :)

> 
> 
> >
> > Signed-off-by: Joshua Kinard <kumba@gentoo.org>
> > ---
> >   arch/mips/kernel/proc.c |    5 +++++
> >   1 file changed, 5 insertions(+)
> >
> > This patch has been submitted several times prior over the years (I think), but
> > I don't recall what, if any, objections there were to it.
> >
> > linux-mips-proc-cpuinfo-byteorder.patch
> > diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
> > index 097fc8d..75e6a62 100644
> > --- a/arch/mips/kernel/proc.c
> > +++ b/arch/mips/kernel/proc.c
> > @@ -65,6 +65,11 @@ static int show_cpuinfo(struct seq_file *m, void *v)
> >   	seq_printf(m, "BogoMIPS\t\t: %u.%02u\n",
> >   		      cpu_data[n].udelay_val / (500000/HZ),
> >   		      (cpu_data[n].udelay_val / (5000/HZ)) % 100);
> > +#ifdef __MIPSEB__
> > +	seq_printf(m, "byteorder\t\t: big endian\n");
> > +#else
> > +	seq_printf(m, "byteorder\t\t: little endian\n");
> > +#endif
> >   	seq_printf(m, "wait instruction\t: %s\n", cpu_wait ? "yes" : "no");
> >   	seq_printf(m, "microsecond timers\t: %s\n",
> >   		      cpu_has_counter ? "yes" : "no");
> >
> >
> >
> 
> 


-- 
-- 
Best regards,
  Antony Pavlov

  parent reply	other threads:[~2015-01-21  6:47 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-19  9:02 [PATCH] MIPS: Display CPU byteorder in /proc/cpuinfo Joshua Kinard
2015-01-20 23:05 ` David Daney
2015-01-21  2:45   ` Joshua Kinard
2015-01-21  2:54     ` Joshua Kinard
2015-01-21 10:22       ` Markos Chandras
2015-01-21 11:26         ` Joshua Kinard
2015-01-21 13:49         ` Ralf Baechle
2015-01-21 18:18           ` David Daney
2015-01-21 18:38         ` Aaro Koskinen
2015-01-21 18:42           ` David Daney
2015-01-26  8:06     ` Maciej W. Rozycki
2015-01-26 13:16       ` Ralf Baechle
2015-01-26 14:53         ` Maciej W. Rozycki
2015-01-26 18:15           ` David Daney
2015-01-26 19:39             ` Maciej W. Rozycki
2015-01-26 20:13               ` David Daney
2015-01-27 16:15                 ` Maciej W. Rozycki
2015-01-27 19:57                   ` David Daney
2015-02-05 13:46                     ` Maciej W. Rozycki
2015-02-05 15:28                       ` Måns Rullgård
2015-02-05 16:12                         ` Maciej W. Rozycki
2015-02-05 19:36                           ` Måns Rullgård
2015-02-05 16:27                       ` David Daney
2015-02-05 21:02                         ` Maciej W. Rozycki
2015-01-21  6:50   ` Antony Pavlov [this message]
2015-02-12  4:16 ` Joshua Kinard

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=20150121105015.94e2448a20847aa2eac738db@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=ddaney.cavm@gmail.com \
    --cc=kumba@gentoo.org \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.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