2008-03-06 19:34:22

by Mike Miller

[permalink] [raw]
Subject: FW: Linux question

Is there a way in to limit the kernel to seeing only the cores on a single processor and ignore all other processor cores (eg. leave them in HALT)?


2008-03-06 19:52:20

by Cyrill Gorcunov

[permalink] [raw]
Subject: Re: FW: Linux question

[Miller, Mike (OS Dev) - Thu, Mar 06, 2008 at 07:33:09PM +0000]
| Is there a way in to limit the kernel to seeing only the cores on a single
| processor and ignore all other processor cores (eg. leave them in HALT)?
| --

You may try to play with "nosmp" boot parameter, but i'm not sure
that is exactly you wanted.

- Cyrill -

2008-03-06 21:20:50

by Justin Banks

[permalink] [raw]
Subject: Re: FW: Linux question

Miller, Mike (OS Dev) wrote
> Is there a way in to limit the kernel to seeing only the cores on a
> single processor and ignore all other processor cores (eg. leave
> them in HALT)?

Can't you just echo 0 into /sys/devices/system/cpu/cpuN/online where the
/sys/devices/system/cpu/cpuN/topology/physical_package_id isn't the one
you want to keep online?

-justinb

--
Justin Banks
BakBone Software
[email protected]

2008-03-07 18:39:06

by Bill Davidsen

[permalink] [raw]
Subject: Re: FW: Linux question

Justin Banks wrote:
> Miller, Mike (OS Dev) wrote
>> Is there a way in to limit the kernel to seeing only the cores on a
>> single processor and ignore all other processor cores (eg. leave
>> them in HALT)?
>
> Can't you just echo 0 into /sys/devices/system/cpu/cpuN/online where the
> /sys/devices/system/cpu/cpuN/topology/physical_package_id isn't the one
> you want to keep online?
>
Here's an interesting question, why isn't there an "online" file for
each CPU?

Example:

posidon:davidsen> l /sys/devices/system/cpu/cpu?
/sys/devices/system/cpu/cpu0:
total 0
drwxr-xr-x 5 root 0 Feb 7 12:57 cache
drwxr-xr-x 3 root 0 Mar 7 13:28 cpufreq
-r-------- 1 root 4096 Mar 7 13:28 crash_notes
drwxr-xr-x 2 root 0 Mar 7 13:28 microcode
drwxr-xr-x 2 root 0 Mar 7 13:28 topology

/sys/devices/system/cpu/cpu1:
total 0
drwxr-xr-x 5 root 0 Feb 7 12:57 cache
drwxr-xr-x 3 root 0 Mar 7 13:28 cpufreq
-r-------- 1 root 4096 Mar 7 13:28 crash_notes
drwxr-xr-x 2 root 0 Mar 7 13:28 microcode
-rw-r--r-- 1 root 4096 Mar 7 13:28 online
drwxr-xr-x 2 root 0 Mar 7 13:28 topology


--
Bill Davidsen <[email protected]>
"We have more to fear from the bungling of the incompetent than from
the machinations of the wicked." - from Slashdot

2008-03-07 19:14:27

by Justin Banks

[permalink] [raw]
Subject: Re: FW: Linux question

Bill Davidsen wrote
> Justin Banks wrote:
> > Miller, Mike (OS Dev) wrote
> >> Is there a way in to limit the kernel to seeing only the cores on a
> >> single processor and ignore all other processor cores (eg. leave
> >> them in HALT)?
> >
> > Can't you just echo 0 into /sys/devices/system/cpu/cpuN/online where the
> > /sys/devices/system/cpu/cpuN/topology/physical_package_id isn't the one
> > you want to keep online?
> >
> Here's an interesting question, why isn't there an "online" file for
> each CPU?

I've noticed that as well, and I'm not sure. IIRC, on some systems I've
seen there's an online file for every CPU, but on my laptop (2.6.22
Intel Mac) there isn't one for cpu0, just as in your example.

-justinb

--
Justin Banks
BakBone Software
[email protected]

2008-03-07 19:14:48

by Andi Kleen

[permalink] [raw]
Subject: Re: FW: Linux question

Bill Davidsen <[email protected]> writes:

> Here's an interesting question, why isn't there an "online" file for
> each CPU?

There are still some problems with off lining CPU #0 on x86 at least,
that is why it is not allowed. iirc they weren't very difficult so it
would be probably fixable with some effort.

-Andi

2008-03-08 17:02:50

by Bill Davidsen

[permalink] [raw]
Subject: Re: FW: Linux question

Andi Kleen wrote:
> Bill Davidsen <[email protected]> writes:
>
>
>> Here's an interesting question, why isn't there an "online" file for
>> each CPU?
>>
>
> There are still some problems with off lining CPU #0 on x86 at least,
> that is why it is not allowed. iirc they weren't very difficult so it
> would be probably fixable with some effort.
>

If that's the case I would think that making it read-only would be a
better solution, since I found this while creating a little tool to scan
and see what's online and what's not. Obviously there can be exception
cases for CPU0 and x86, but I would think that having the CPU0 for x86
be read-only would be a quirk, and handled in the kernel.

--
Bill Davidsen <[email protected]>
"Woe unto the statesman who makes war without a reason that will still
be valid when the war is over..." Otto von Bismark