bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch procfs cpuinfo


From: Bouju Alain
Subject: Re: Patch procfs cpuinfo
Date: Sun, 27 Nov 2011 23:06:07 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111115 Thunderbird/8.0

Hello,

For Intel with HyperThreading 8 I think -> 16 (virtual core).
Linux probably choose 8 to obtain better result.
This is not very clear for me.

http://www.richweb.com/cpu_info

I have apply your change.
With Qemu I obtain 1 processor (I keep the virtual number of core but it's easy to change, I can change it)

Alain



On 19/11/2011 23:18, Samuel Thibault wrote:
Hello,

Bouju Alain, le Sun 13 Nov 2011 12:44:04 +0100, a écrit :
/* gcc cpuinfo.c -o cpuinfo `pkg-config --cflags glib-2.0` -lm */
#include<glib.h>
Using glib for /proc is a bit out of question :)
16-bit and 32-bit types are available as uint16_t&  uint32_t in
stdint.h.

The coding style has to follow the GNU Coding Style, e.g. there must be
a space between the function name and the opening parenthesis. You
should probably use indent to fix everything automatically.

cpuid is only available on x86, so the code should be put in some x86/
directory, and ideally compiled only on x86.

No need to put __volatile__ in the cpuid macro, since we don't depend on
any effect of cpuid here.

A \n is missing between processors.

It detects too many processors on my machine: 16 instead of 8:

i 00000000 a 0000000d b 756e6547 c 6c65746e d 49656e69
i 00000001 a 000206a7 b 05100800 c 1fbae3ff d bfebfbff
i 00000002 a 76035a01 b 00f0b2ff c 00000000 d 00ca0000
i 00000003 a 00000000 b 00000000 c 00000000 d 00000000
i 00000004 a 00000000 b 00000000 c 00000000 d 00000000
i 00000005 a 00000040 b 00000040 c 00000003 d 00021120
i 00000006 a 00000077 b 00000002 c 00000009 d 00000000
i 00000007 a 00000000 b 00000000 c 00000000 d 00000000
i 00000008 a 00000000 b 00000000 c 00000000 d 00000000
i 00000009 a 00000000 b 00000000 c 00000000 d 00000000
i 0000000a a 07300403 b 00000000 c 00000000 d 00000603
i 0000000b a 00000000 b 00000000 c 000000e3 d 00000005
i 0000000c a 00000000 b 00000000 c 00000000 d 00000000
i 0000000d a 00000000 b 00000000 c 00000000 d 00000000
a 80000008 b 00000000 c 00000000 d 00000000
i 80000000 a 80000008 b 00000000 c 00000000 d 00000000
i 80000001 a 00000000 b 00000000 c 00000001 d 28100800
i 80000002 a 20202020 b 6e492020 c 286c6574 d 43202952
i 80000003 a 2865726f b 20294d54 c 322d3769 d 51303237
i 80000004 a 5043204d b 20402055 c 30322e32 d 007a4847
i 80000005 a 00000000 b 00000000 c 00000000 d 00000000
i 80000006 a 00000000 b 00000000 c 01006040 d 00000000
i 80000007 a 00000000 b 00000000 c 00000000 d 00000100
i 80000008 a 00003024 b 00000000 c 00000000 d 00000000
Intel
2093
processor       : 0
vendor_id       : GenuineIntel
model name      :       Intel(R) Core(TM) i7-2720QM CPU @ 2.20GHz
core id         : 0
cpuid-level     : 13

processor       : 1
vendor_id       : GenuineIntel
model name      :       Intel(R) Core(TM) i7-2720QM CPU @ 2.20GHz
core id         : 1
cpuid-level     : 13
processor       : 2
vendor_id       : GenuineIntel
model name      :       Intel(R) Core(TM) i7-2720QM CPU @ 2.20GHz
core id         : 2

etc. up to 15, while on Linux:

processor       : 0
physical id     : 0
siblings        : 8
core id         : 0
cpu cores       : 4
apicid          : 0

processor       : 1
physical id     : 0
siblings        : 8
core id         : 1
cpu cores       : 4
apicid          : 2

processor       : 2
physical id     : 0
siblings        : 8
core id         : 2
cpu cores       : 4
apicid          : 4

processor       : 3
physical id     : 0
siblings        : 8
core id         : 3
cpu cores       : 4
apicid          : 6

processor       : 4
physical id     : 0
siblings        : 8
core id         : 0
cpu cores       : 4
apicid          : 1

processor       : 5
physical id     : 0
siblings        : 8
core id         : 1
cpu cores       : 4
apicid          : 3

processor       : 6
physical id     : 0
siblings        : 8
core id         : 2
cpu cores       : 4
apicid          : 5

processor       : 7
physical id     : 0
siblings        : 8
core id         : 3
cpu cores       : 4
apicid          : 7

That being said, since GNU Mach only supports one processor, I'd rather
show only one processor in /proc/cpuinfo, because on Linux, cpuinfo
only shows the running processors, and thus some tools would infer from
/proc/cpuinfo that there are more than just 1 active processor.

Samuel

Attachment: cpuinfo.c
Description: Text document

Attachment: cpuinfo.h
Description: Text document

Attachment: patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]