Re: How can I detect a SMP box with d-i kernel and tools ?
On Fri, Aug 13, 2004 at 08:33:48AM +0200, Sven Luther wrote:
> On Fri, Aug 13, 2004 at 12:13:20AM +0200, Thomas Poindessous wrote:
> > Hi,
> >
> > I'm trying to add smp detection for Bug#265098
> >
> > I'm looking for a way to detect smp system with current d-i powerpc
> > kernel and d-i tools.
> >
> > If you know such a trick, I will be glad to know it.
>
> I think the easiest way would be to look in the /proc/device-tree, for the
> info given to you by the OF. This naturally will probably only work on
> newworld and chrp, not sure about oldworld and prep SMP boxes.
>
> Anyway, on my pegasos2/G4, i have :
>
> $ ls /proc/device-tree/cpus/
> #address-cells #cpus linux,phandle name PowerPC,74x7 #size-cells
>
> Presumably you have two processor nodes on SMP boxes.
>
> Also, another way would (maybe) to look at the content of #cpus :
>
> $ hexdump /proc/device-tree/cpus/#cpus
> 0000000 0000 0001
> 0000004
>
> So, on my box, #cpus will contain 1, and presumably on SMP boxes, it will
> contain 2 or more. I have not tested this, but please check on your system.
I hear that :
1) older models may have /proc/device-tree/cpu only.
2) /proc/device-tree/cpus/#cpus does not exist on G5 boxes.
3) best would be to count the directories in /proc/device-tree/cpu or
/proc/device-tree/cpus. early G5 and maybe some other boxes may have a bug
though which make the second cpu node appear in the cpu node.
Here is a smallish irc excerpt about this issue :
08:49 < benh> benh@pogo:/proc/device-tree$ ls -l cpus/
08:49 < benh> total 4
08:49 < benh> -r--r--r-- 1 root root 4 Aug 13 16:42 #address-cells
08:49 < benh> -r--r--r-- 1 root root 4 Aug 13 16:42 #size-cells
08:49 < benh> dr-xr-xr-x 3 root root 0 Aug 13 16:42 PowerPC,970
08:49 < benh> dr-xr-xr-x 3 root root 0 Aug 13 16:42 PowerPC,970
08:49 < benh> -r--r--r-- 1 root root 4 Aug 13 16:42 linux,phandle
08:49 < benh> -r--r--r-- 1 root root 5 Aug 13 16:42 name
08:54 < owen-pb> [owen@build cpus]$ find . -type d
08:54 < owen-pb> .
08:54 < owen-pb> ./PowerPC,970
08:54 < owen-pb> ./PowerPC,970/PowerPC,970
08:54 < owen-pb> ./PowerPC,970
08:54 < owen-pb> ./PowerPC,970/PowerPC,970
08:51 < svenl> owen-pb: you have a SMP box ?
08:51 < owen-pb> svenl: yup
$ find . -type d
.
./PowerPC,74x7
./PowerPC,74x7/l2-cache
./PowerPC,74x7/l3-cache
Hope this helps.
Friendly,
Sven Luther
Reply to: