All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] MIPS: Make UTS_MACHINE reflect big-endian/little-endian
@ 2018-07-11  8:28 Huacai Chen
  2018-07-11 15:57 ` Paul Burton
  0 siblings, 1 reply; 4+ messages in thread
From: Huacai Chen @ 2018-07-11  8:28 UTC (permalink / raw)
  To: Ralf Baechle
  Cc: Paul Burton, James Hogan, linux-mips, Fuxin Zhang, Zhangjin Wu,
	Huacai Chen, Huacai Chen

It seems like some application use "uname" command's output to do
something different between big-endian and little-endian, so we make
UTS_MACHINE reflect both 32bit/64bit and big-endian/little-endian.

Signed-off-by: Huacai Chen <chenhc@lemote.com>
---
 arch/mips/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index e2122cc..a21c3a1 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -38,11 +38,11 @@ endif
 
 ifdef CONFIG_32BIT
 tool-archpref		= $(32bit-tool-archpref)
-UTS_MACHINE		:= mips
+UTS_MACHINE		:= $(32bit-tool-archpref)
 endif
 ifdef CONFIG_64BIT
 tool-archpref		= $(64bit-tool-archpref)
-UTS_MACHINE		:= mips64
+UTS_MACHINE		:= $(64bit-tool-archpref)
 endif
 
 ifneq ($(SUBARCH),$(ARCH))
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH RFC] MIPS: Make UTS_MACHINE reflect big-endian/little-endian
  2018-07-11  8:28 [PATCH RFC] MIPS: Make UTS_MACHINE reflect big-endian/little-endian Huacai Chen
@ 2018-07-11 15:57 ` Paul Burton
  2018-07-11 23:09   ` Huacai Chen
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Burton @ 2018-07-11 15:57 UTC (permalink / raw)
  To: Huacai Chen
  Cc: Ralf Baechle, James Hogan, linux-mips, Fuxin Zhang, Zhangjin Wu,
	Huacai Chen

Hi Huacai,

On Wed, Jul 11, 2018 at 04:28:17PM +0800, Huacai Chen wrote:
> It seems like some application use "uname" command's output to do
> something different between big-endian and little-endian, so we make
> UTS_MACHINE reflect both 32bit/64bit and big-endian/little-endian.

Since UTS_MACHINE is exposed to userland (which is of course the point
of your patch) I'm not comfortable changing it. If some piece of code
checks whether uname -m gives "mips" then we'd break it by suddenly
giving "mipsel". This is too risky.

Which applications are you talking about that look for endianness in
uname output? Since Linux on MIPS doesn't expose endianness information
in this way these applications will always have been broken on MIPS
systems, and it would make more sense to fix the applications than to
change the kernel & probably break others.

Thanks,
    Paul

> diff --git a/arch/mips/Makefile b/arch/mips/Makefile
> index e2122cc..a21c3a1 100644
> --- a/arch/mips/Makefile
> +++ b/arch/mips/Makefile
> @@ -38,11 +38,11 @@ endif
>  
>  ifdef CONFIG_32BIT
>  tool-archpref		= $(32bit-tool-archpref)
> -UTS_MACHINE		:= mips
> +UTS_MACHINE		:= $(32bit-tool-archpref)
>  endif
>  ifdef CONFIG_64BIT
>  tool-archpref		= $(64bit-tool-archpref)
> -UTS_MACHINE		:= mips64
> +UTS_MACHINE		:= $(64bit-tool-archpref)
>  endif

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RFC] MIPS: Make UTS_MACHINE reflect big-endian/little-endian
  2018-07-11 15:57 ` Paul Burton
@ 2018-07-11 23:09   ` Huacai Chen
  2018-07-12 17:04     ` Paul Burton
  0 siblings, 1 reply; 4+ messages in thread
From: Huacai Chen @ 2018-07-11 23:09 UTC (permalink / raw)
  To: Paul Burton
  Cc: Ralf Baechle, James Hogan, Linux MIPS Mailing List, Fuxin Zhang,
	Zhangjin Wu

On Wed, Jul 11, 2018 at 11:57 PM, Paul Burton <paul.burton@mips.com> wrote:
> Hi Huacai,
>
> On Wed, Jul 11, 2018 at 04:28:17PM +0800, Huacai Chen wrote:
>> It seems like some application use "uname" command's output to do
>> something different between big-endian and little-endian, so we make
>> UTS_MACHINE reflect both 32bit/64bit and big-endian/little-endian.
>
> Since UTS_MACHINE is exposed to userland (which is of course the point
> of your patch) I'm not comfortable changing it. If some piece of code
> checks whether uname -m gives "mips" then we'd break it by suddenly
> giving "mipsel". This is too risky.
>
> Which applications are you talking about that look for endianness in
> uname output? Since Linux on MIPS doesn't expose endianness information
> in this way these applications will always have been broken on MIPS
> systems, and it would make more sense to fix the applications than to
> change the kernel & probably break others.
Hi, we are making Fedora on MIPS, we found that yum use uname's output
to adjust endianness compatibility. We haven't seen anything broken
while we changing mips64 to mips64el, do you know something about
"broken things with this changing". I also don't want to change
UTS_MACHINE, but if it is harmless, I think we can just do it.

>
> Thanks,
>     Paul
>
>> diff --git a/arch/mips/Makefile b/arch/mips/Makefile
>> index e2122cc..a21c3a1 100644
>> --- a/arch/mips/Makefile
>> +++ b/arch/mips/Makefile
>> @@ -38,11 +38,11 @@ endif
>>
>>  ifdef CONFIG_32BIT
>>  tool-archpref                = $(32bit-tool-archpref)
>> -UTS_MACHINE          := mips
>> +UTS_MACHINE          := $(32bit-tool-archpref)
>>  endif
>>  ifdef CONFIG_64BIT
>>  tool-archpref                = $(64bit-tool-archpref)
>> -UTS_MACHINE          := mips64
>> +UTS_MACHINE          := $(64bit-tool-archpref)
>>  endif

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RFC] MIPS: Make UTS_MACHINE reflect big-endian/little-endian
  2018-07-11 23:09   ` Huacai Chen
@ 2018-07-12 17:04     ` Paul Burton
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Burton @ 2018-07-12 17:04 UTC (permalink / raw)
  To: Huacai Chen
  Cc: Ralf Baechle, James Hogan, Linux MIPS Mailing List, Fuxin Zhang,
	Zhangjin Wu

Hi Huacai,

On Thu, Jul 12, 2018 at 07:09:04AM +0800, Huacai Chen wrote:
> >> It seems like some application use "uname" command's output to do
> >> something different between big-endian and little-endian, so we make
> >> UTS_MACHINE reflect both 32bit/64bit and big-endian/little-endian.
> >
> > Since UTS_MACHINE is exposed to userland (which is of course the point
> > of your patch) I'm not comfortable changing it. If some piece of code
> > checks whether uname -m gives "mips" then we'd break it by suddenly
> > giving "mipsel". This is too risky.
> >
> > Which applications are you talking about that look for endianness in
> > uname output? Since Linux on MIPS doesn't expose endianness information
> > in this way these applications will always have been broken on MIPS
> > systems, and it would make more sense to fix the applications than to
> > change the kernel & probably break others.
>
> Hi, we are making Fedora on MIPS, we found that yum use uname's output
> to adjust endianness compatibility. We haven't seen anything broken
> while we changing mips64 to mips64el, do you know something about
> "broken things with this changing". I also don't want to change
> UTS_MACHINE, but if it is harmless, I think we can just do it.

A quick GitHub code search find a ton of things which check uname -m,
some of which expect the exact string "mips":

    https://github.com/search?l=&p=1&q=uname+-m+mips&type=Code

UTS_MACHINE is not something to change.

Can you just have yum detect endianness some other way? Wikipedia tells
me yum is written in python, and a quick Google tells me there's a
sys.byteorder variable which would indicate endianness. Can you just use
that?

Thanks,
    Paul

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-12 17:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-11  8:28 [PATCH RFC] MIPS: Make UTS_MACHINE reflect big-endian/little-endian Huacai Chen
2018-07-11 15:57 ` Paul Burton
2018-07-11 23:09   ` Huacai Chen
2018-07-12 17:04     ` Paul Burton

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.