LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* how to tell i386 from x86-64 kernel
@ 2008-02-01  0:42 Pavel Machek
  2008-02-01  0:46 ` Ray Lee
  2008-02-01  4:51 ` H. Peter Anvin
  0 siblings, 2 replies; 13+ messages in thread
From: Pavel Machek @ 2008-02-01  0:42 UTC (permalink / raw)
  To: kernel list, jikos

Hi!

Quiz: on a booted system, how do you tell 32bit from 64bit kernel?

A1: zcat /proc/config.gz | grep CONFIG_64

...but config.gz is optional

A2: cat /proc/meminfo  | grep High

...but i386 kernel could have highmem disabled

What is _your_ answer? ;-)>
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: how to tell i386 from x86-64 kernel
  2008-02-01  0:42 how to tell i386 from x86-64 kernel Pavel Machek
@ 2008-02-01  0:46 ` Ray Lee
  2008-02-01  0:59   ` Jan Engelhardt
  2008-02-01  1:03   ` Pavel Machek
  2008-02-01  4:51 ` H. Peter Anvin
  1 sibling, 2 replies; 13+ messages in thread
From: Ray Lee @ 2008-02-01  0:46 UTC (permalink / raw)
  To: Pavel Machek; +Cc: kernel list, jikos

On Jan 31, 2008 4:42 PM, Pavel Machek <pavel@ucw.cz> wrote:
> Quiz: on a booted system, how do you tell 32bit from 64bit kernel?

Uhm, is this a trick question? What's wrong with uname(2)?

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

* Re: how to tell i386 from x86-64 kernel
  2008-02-01  0:46 ` Ray Lee
@ 2008-02-01  0:59   ` Jan Engelhardt
  2008-02-01 11:53     ` Alejandro Riveira Fernández
  2008-02-01  1:03   ` Pavel Machek
  1 sibling, 1 reply; 13+ messages in thread
From: Jan Engelhardt @ 2008-02-01  0:59 UTC (permalink / raw)
  To: Ray Lee; +Cc: Pavel Machek, kernel list, jikos


On Jan 31 2008 16:46, Ray Lee wrote:
>On Jan 31, 2008 4:42 PM, Pavel Machek <pavel@ucw.cz> wrote:
>> Quiz: on a booted system, how do you tell 32bit from 64bit kernel?
>
>Uhm, is this a trick question? What's wrong with uname(2)?

# uname -m
I won't tell you.
# linux32 uname -m
i686

Now what? :-)

Well, the answer is simple, a 64-bit kernel will allow you
(minus selinux voodoo) to load 64-bit binaries.

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

* Re: how to tell i386 from x86-64 kernel
  2008-02-01  0:46 ` Ray Lee
  2008-02-01  0:59   ` Jan Engelhardt
@ 2008-02-01  1:03   ` Pavel Machek
  1 sibling, 0 replies; 13+ messages in thread
From: Pavel Machek @ 2008-02-01  1:03 UTC (permalink / raw)
  To: Ray Lee; +Cc: kernel list, jikos

On Thu 2008-01-31 16:46:57, Ray Lee wrote:
> On Jan 31, 2008 4:42 PM, Pavel Machek <pavel@ucw.cz> wrote:
> > Quiz: on a booted system, how do you tell 32bit from 64bit kernel?
> 
> Uhm, is this a trick question? What's wrong with uname(2)?

No, it is a tricky question. You are right, uname -a tells me. Sorry.

Still, it would be nice to print it as a first message of dmesg, so
that it automatically gets included with problem reports... on
easy-to-see place.

								Pavel

Linux version 2.6.24-rc8 (pavel@amd) (gcc version 4.1.3 20071209 (prerelease) (Debian 4.1.2-18)) #65 SMP Thu Jan 31 00:02:37 CET 2008
BIOS-provided physical RAM map:


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: how to tell i386 from x86-64 kernel
  2008-02-01  0:42 how to tell i386 from x86-64 kernel Pavel Machek
  2008-02-01  0:46 ` Ray Lee
@ 2008-02-01  4:51 ` H. Peter Anvin
  2008-02-01 10:07   ` Jiri Kosina
  1 sibling, 1 reply; 13+ messages in thread
From: H. Peter Anvin @ 2008-02-01  4:51 UTC (permalink / raw)
  To: Pavel Machek; +Cc: kernel list, jikos

Pavel Machek wrote:
> Hi!
> 
> Quiz: on a booted system, how do you tell 32bit from 64bit kernel?
> 
> A1: zcat /proc/config.gz | grep CONFIG_64
> 
> ...but config.gz is optional
> 
> A2: cat /proc/meminfo  | grep High
> 
> ...but i386 kernel could have highmem disabled
> 
> What is _your_ answer? ;-)>
> 									Pavel

uname -m

	-hpa

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

* Re: how to tell i386 from x86-64 kernel
  2008-02-01  4:51 ` H. Peter Anvin
@ 2008-02-01 10:07   ` Jiri Kosina
  0 siblings, 0 replies; 13+ messages in thread
From: Jiri Kosina @ 2008-02-01 10:07 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Pavel Machek, kernel list

On Thu, 31 Jan 2008, H. Peter Anvin wrote:

> > Quiz: on a booted system, how do you tell 32bit from 64bit kernel?
> uname -m

I think that the real point here is that there is no general way how to 
determine whether the kernel is 32bit or 64bit from full dmesg output, 
which could sometimes make debugging user-reported bugs a little bit 
harder.

-- 
Jiri Kosina
SUSE Labs

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

* Re: how to tell i386 from x86-64 kernel
  2008-02-01  0:59   ` Jan Engelhardt
@ 2008-02-01 11:53     ` Alejandro Riveira Fernández
  2008-02-09 20:13       ` Jan Engelhardt
  0 siblings, 1 reply; 13+ messages in thread
From: Alejandro Riveira Fernández @ 2008-02-01 11:53 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Ray Lee, Pavel Machek, kernel list, jikos

El Fri, 1 Feb 2008 01:59:03 +0100 (CET)
Jan Engelhardt <jengelh@computergmbh.de> escribió:


> 
> # uname -m
> I won't tell you.
> # linux32 uname -m
> i686

 Ubuntu 7.10 64 bit userland 2.6.24

$ uname -m
x86_64
$ linux32 uname -m
i686



> 
> Now what? :-)
> 
> Well, the answer is simple, a 64-bit kernel will allow you
> (minus selinux voodoo) to load 64-bit binaries.

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

* Re: how to tell i386 from x86-64 kernel
  2008-02-01 11:53     ` Alejandro Riveira Fernández
@ 2008-02-09 20:13       ` Jan Engelhardt
  2008-02-09 22:34         ` Arjan van de Ven
  0 siblings, 1 reply; 13+ messages in thread
From: Jan Engelhardt @ 2008-02-09 20:13 UTC (permalink / raw)
  To: Alejandro Riveira Fernández
  Cc: Ray Lee, Pavel Machek, kernel list, jikos


On Feb 1 2008 12:53, Alejandro Riveira Fernández wrote:
>> 
>> # uname -m
>> I won't tell you.
>> # linux32 uname -m
>> i686
>
> Ubuntu 7.10 64 bit userland 2.6.24
>
>$ uname -m
>x86_64
>$ linux32 uname -m
>i686

What I am saying is that uname(2) does not reliably tell you whether you 
have a 64-bit kernel underneath unless you have other sources of 
information.

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

* Re: how to tell i386 from x86-64 kernel
  2008-02-09 20:13       ` Jan Engelhardt
@ 2008-02-09 22:34         ` Arjan van de Ven
  2008-02-10  1:27           ` Pavel Machek
  0 siblings, 1 reply; 13+ messages in thread
From: Arjan van de Ven @ 2008-02-09 22:34 UTC (permalink / raw)
  To: Jan Engelhardt
  Cc: Alejandro Riveira Fernández, Ray Lee, Pavel Machek,
	kernel list, jikos

On Sat, 9 Feb 2008 21:13:43 +0100 (CET)
Jan Engelhardt <jengelh@computergmbh.de> wrote:

> 
> On Feb 1 2008 12:53, Alejandro Riveira Fernández wrote:
> >> 
> >> # uname -m
> >> I won't tell you.
> >> # linux32 uname -m
> >> i686
> >
> > Ubuntu 7.10 64 bit userland 2.6.24
> >
> >$ uname -m
> >x86_64
> >$ linux32 uname -m
> >i686
> 
> What I am saying is that uname(2) does not reliably tell you whether
> you have a 64-bit kernel underneath unless you have other sources of 
> information.

that's sort of a rabbit-and-the-frog problem. The 32 bit emulator tries to
look EXACTLY like the 32 bit kernel, and it really should.
If someone wants a method to detect even that... we would really want
to know the exact usecase.. because very likely it's the wrong answer
to some other problem ;-)

-- 
If you want to reach me at my work email, use arjan@linux.intel.com
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org

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

* Re: how to tell i386 from x86-64 kernel
  2008-02-09 22:34         ` Arjan van de Ven
@ 2008-02-10  1:27           ` Pavel Machek
  0 siblings, 0 replies; 13+ messages in thread
From: Pavel Machek @ 2008-02-10  1:27 UTC (permalink / raw)
  To: Arjan van de Ven
  Cc: Jan Engelhardt, Alejandro Riveira Fernández, Ray Lee,
	kernel list, jikos

On Sat 2008-02-09 14:34:30, Arjan van de Ven wrote:
> On Sat, 9 Feb 2008 21:13:43 +0100 (CET)
> Jan Engelhardt <jengelh@computergmbh.de> wrote:
> 
> > 
> > On Feb 1 2008 12:53, Alejandro Riveira Fernández wrote:
> > >> 
> > >> # uname -m
> > >> I won't tell you.
> > >> # linux32 uname -m
> > >> i686
> > >
> > > Ubuntu 7.10 64 bit userland 2.6.24
> > >
> > >$ uname -m
> > >x86_64
> > >$ linux32 uname -m
> > >i686
> > 
> > What I am saying is that uname(2) does not reliably tell you whether
> > you have a 64-bit kernel underneath unless you have other sources of 
> > information.
> 
> that's sort of a rabbit-and-the-frog problem. The 32 bit emulator tries to
> look EXACTLY like the 32 bit kernel, and it really should.
> If someone wants a method to detect even that... we would really want
> to know the exact usecase.. because very likely it's the wrong answer
> to some other problem ;-)

dmesg should really really tell you 32 vs. 64 bit, at the first line
where it prints versions... so you easily know what you are dealing
with when someone sends a bugreport.

							Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: how to tell i386 from x86-64 kernel
  2008-02-01 10:47 Rik Bobbaers
@ 2008-02-02 11:06 ` Pavel Machek
  0 siblings, 0 replies; 13+ messages in thread
From: Pavel Machek @ 2008-02-02 11:06 UTC (permalink / raw)
  To: Rik Bobbaers; +Cc: linux-kernel

On Fri 2008-02-01 11:47:29, Rik Bobbaers wrote:
> hi there,
> 
> since i'm not on the list... how about:
> 
> tail /proc/1/smaps and check the address size...
> on 32 bit: ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
> 
> on 64 bit: ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
> [vdso]
> 
> there you can clearly see that your address space is double... so
> there's your 32 bit vs 64 bit
> 
> as a normal user, you can do the same but with your own processes

That tells you if _init_ is 32 or 64 bit, not kernel.

I'm running 32-bit distro on 64-bit kernel here. It works fine (as it
should).

									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: how to tell i386 from x86-64 kernel
@ 2008-02-01 10:47 Rik Bobbaers
  2008-02-02 11:06 ` Pavel Machek
  0 siblings, 1 reply; 13+ messages in thread
From: Rik Bobbaers @ 2008-02-01 10:47 UTC (permalink / raw)
  To: linux-kernel

hi there,

since i'm not on the list... how about:

tail /proc/1/smaps and check the address size...
on 32 bit: ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]

on 64 bit: ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
[vdso]

there you can clearly see that your address space is double... so
there's your 32 bit vs 64 bit

as a normal user, you can do the same but with your own processes

greetings,

> Hi!
> 
> Quiz: on a booted system, how do you tell 32bit from 64bit kernel?
> 
> A1: zcat /proc/config.gz | grep CONFIG_64
> ...but config.gz is optional
> 
> A2: cat /proc/meminfo  | grep High
> ...but i386 kernel could have highmem disabled
> 
> What is _your_ answer? ;-)>

-- 
harry
aka Rik Bobbaers

K.U.Leuven - LUDIT            -=- Tel: +32 485 52 71 50
Rik.Bobbaers@icts.kuleuven.be -=- http://harry.enzoverder.be

Don't steal - the government hates competition.



Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm


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

* Re: how to tell i386 from x86-64 kernel
       [not found] <960D0E79B4E503448AD14B5E40A5C1C7BB54CE@USX1.corp.bb>
@ 2008-02-01  1:37 ` Jan Engelhardt
  0 siblings, 0 replies; 13+ messages in thread
From: Jan Engelhardt @ 2008-02-01  1:37 UTC (permalink / raw)
  To: Justin Banks; +Cc: Linux Kernel Mailing List


don't strip Ccs, thanks. (and try not to tofu either.)

On Jan 31 2008 17:01, Justin Banks wrote:
>
>uname -a will tell you, though.

No. uname is generally not a reliable source to tell you the bitness (or 
more precisely, the arch). It may even happen that you cannot find out 
at all if access permissions are set 'correctly'.
You may find ELF64 files flying around in the filesystem, and while that 
is a strong indication of a 64-bit kernel being running, it is not a 
definite Yes.


02:31 ccgmbh:~ > uname -a
Linux ccgmbh 2.6.23.10-ccj62-regular #1 SMP 2007/10/26 14:17:15 UTC i686 
athlon i386 GNU/Linux

02:32 ccgmbh:~ > file `which uname`
/bin/uname: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), for 
GNU/Linux 2.6.4, dynamically linked (uses shared libs), stripped

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

end of thread, other threads:[~2008-02-10  1:27 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-01  0:42 how to tell i386 from x86-64 kernel Pavel Machek
2008-02-01  0:46 ` Ray Lee
2008-02-01  0:59   ` Jan Engelhardt
2008-02-01 11:53     ` Alejandro Riveira Fernández
2008-02-09 20:13       ` Jan Engelhardt
2008-02-09 22:34         ` Arjan van de Ven
2008-02-10  1:27           ` Pavel Machek
2008-02-01  1:03   ` Pavel Machek
2008-02-01  4:51 ` H. Peter Anvin
2008-02-01 10:07   ` Jiri Kosina
     [not found] <960D0E79B4E503448AD14B5E40A5C1C7BB54CE@USX1.corp.bb>
2008-02-01  1:37 ` Jan Engelhardt
2008-02-01 10:47 Rik Bobbaers
2008-02-02 11:06 ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).