From: Andrew Walrond <andrew@walrond.org>
To: chrisl@vmware.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: How to get number of physical CPU in linux from user space?
Date: Fri, 25 Oct 2002 01:47:09 +0100 [thread overview]
Message-ID: <3DB8948D.3000003@walrond.org> (raw)
In-Reply-To: <20021024230229.GA1841@vmware.com>
I rebuilt 2.5.44 with the ACPI stuff enabled, and I see 2 cpus in
/proc/cpuinfo:
daedalus@hercules daedalus $ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 15
model : 2
model name : Intel(R) XEON(TM) CPU 2.20GHz
stepping : 4
cpu MHz : 2200.469
cache size : 512 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm
bogomips : 4341.76
processor : 1
vendor_id : GenuineIntel
cpu family : 15
model : 2
model name : Intel(R) XEON(TM) CPU 2.20GHz
stepping : 4
cpu MHz : 2200.469
cache size : 512 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm
bogomips : 4390.91
Also dmesg says:
daedalus@hercules daedalus $ dmesg
1462.55 usecs.
task migration cache decay timeout: 2 msecs.
enabled ExtINT on CPU#0
ESR value before enabling vector: 00000000
ESR value after enabling vector: 00000000
Booting processor 1/1 eip 2000
Initializing CPU#1
masked ExtINT on CPU#1
ESR value before enabling vector: 00000000
ESR value after enabling vector: 00000000
Calibrating delay loop... 4390.91 BogoMIPS
CPU: Before vendor init, caps: 3febfbff 00000000 00000000, vendor = 0
CPU: Trace cache: 12K uops, L1 D cache: 8K
CPU: L2 cache: 512K
CPU: Physical Processor ID: 0
CPU: After vendor init, caps: 3febfbff 00000000 00000000 00000000
Intel machine check reporting enabled on CPU#1.
CPU#1: Intel P4/Xeon Extended MCE MSRs (12) available
CPU#1: Thermal monitoring enabled
CPU: After generic, caps: 3febfbff 00000000 00000000 00000000
CPU: Common caps: 3febfbff 00000000 00000000 00000000
CPU1: Intel(R) XEON(TM) CPU 2.20GHz stepping 04
Total of 2 processors activated (8732.67 BogoMIPS).
And a bit further down...
checking TSC synchronization across 2 CPUs: passed.
Starting migration thread for cpu 0
Bringing up 1
CPU 1 IS NOW UP!
Starting migration thread for cpu 1
CPUS done 4294967295
And down some more we seem to have 4 cpus...
ACPI: Processor [CPU0] (supports C1)
ACPI: Processor [CPU1] (supports C1)
ACPI: Processor [CPU2] (supports C1)
ACPI: Processor [CPU3] (supports C1)
I think with ACPI disabled I had 4 processors listed in /proc/cpuinfo,
but I'll check.
chrisl@vmware.com wrote:
>It seems that /proc/cpuinfo will return the number of logical CPU.
>If the machine has Intel Hyper-Thread enabled, that number is bigger
>than physical CPU number. Usually twice as big.
>
>My question is, what is the reliable way for user space program
>to detect the number of physical CPU in the current machine?
>
>If in it is in the kernel, I can read from cpu_sibling_map[]
>or phys_cpu_id[]. But it seems not easy read that from
>user space.
>
>Of course I can do "gdb /proc/kcore" to get them. But is there
>any better way?
>
>Thanks in advance.
>
>Chris
>
>
>
>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at http://www.tux.org/lkml/
>
>
>
next prev parent reply other threads:[~2002-10-25 0:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-24 23:02 chrisl
2002-10-25 0:47 ` Andrew Walrond [this message]
2002-10-25 8:26 ` Gianni Tedesco
2002-10-25 8:27 ` Martin J. Bligh
2002-10-25 18:20 ` chrisl
2002-10-25 18:35 ` David T Hollis
2002-10-25 18:52 ` Martin J. Bligh
2002-10-25 12:38 ` Dave Jones
2002-10-25 19:07 ` chrisl
2002-10-25 18:54 Nakajima, Jun
2002-10-25 19:12 ` chrisl
2002-10-25 19:05 Nakajima, Jun
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=3DB8948D.3000003@walrond.org \
--to=andrew@walrond.org \
--cc=chrisl@vmware.com \
--cc=linux-kernel@vger.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
Powered by JetHome