* finding out the boot cpu number from userspace
@ 2004-08-02 12:16 Arjan van de Ven
2004-08-02 13:37 ` Dave Jones
` (4 more replies)
0 siblings, 5 replies; 12+ messages in thread
From: Arjan van de Ven @ 2004-08-02 12:16 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 347 bytes --]
Hi,
assuming cpu 0 is the boot cpu sounds fragile/incorrect, but for irqbalanced
I'd like to find out which cpu is the boot cpu, is there a good way of doing
so ?
The reason for needing this is that some firmware only likes running on the
boot cpu so I need to bind firmware-related irq's to that cpu ideally.
Greetings,
Arjan van de Ven
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: finding out the boot cpu number from userspace
2004-08-02 12:16 finding out the boot cpu number from userspace Arjan van de Ven
@ 2004-08-02 13:37 ` Dave Jones
2004-08-02 14:13 ` Alan Cox
` (3 subsequent siblings)
4 siblings, 0 replies; 12+ messages in thread
From: Dave Jones @ 2004-08-02 13:37 UTC (permalink / raw)
To: Arjan van de Ven; +Cc: linux-kernel
On Mon, Aug 02, 2004 at 02:16:35PM +0200, Arjan van de Ven wrote:
> Hi,
>
> assuming cpu 0 is the boot cpu sounds fragile/incorrect, but for irqbalanced
> I'd like to find out which cpu is the boot cpu, is there a good way of doing
> so ?
Parsing MP tables ? Don't know how well this holds up in a post-MP
ACPI world though. x86info has some code for this already, which I
stole from some other program I long since forgot about.
Dave
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: finding out the boot cpu number from userspace
2004-08-02 12:16 finding out the boot cpu number from userspace Arjan van de Ven
2004-08-02 13:37 ` Dave Jones
@ 2004-08-02 14:13 ` Alan Cox
2004-08-02 14:30 ` Zwane Mwaikambo
` (2 subsequent siblings)
4 siblings, 0 replies; 12+ messages in thread
From: Alan Cox @ 2004-08-02 14:13 UTC (permalink / raw)
To: Arjan van de Ven; +Cc: Linux Kernel Mailing List
On Llu, 2004-08-02 at 13:16, Arjan van de Ven wrote:
> Hi,
>
> assuming cpu 0 is the boot cpu sounds fragile/incorrect, but for irqbalanced
> I'd like to find out which cpu is the boot cpu, is there a good way of doing
> so ?
>
> The reason for needing this is that some firmware only likes running on the
> boot cpu so I need to bind firmware-related irq's to that cpu ideally.
Grab the physical CPU id during boot up and stick it in the
/proc/cpuinfo as another information line "Boot device: Yes/no"
Just don't use "Processor" in the string or some glibc's start getting
strange ideas about the CPU count.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: finding out the boot cpu number from userspace
2004-08-02 12:16 finding out the boot cpu number from userspace Arjan van de Ven
2004-08-02 13:37 ` Dave Jones
2004-08-02 14:13 ` Alan Cox
@ 2004-08-02 14:30 ` Zwane Mwaikambo
2004-08-02 14:46 ` Richard B. Johnson
2004-08-02 15:50 ` Martin J. Bligh
2004-08-02 20:08 ` Chris Wedgwood
4 siblings, 1 reply; 12+ messages in thread
From: Zwane Mwaikambo @ 2004-08-02 14:30 UTC (permalink / raw)
To: Arjan van de Ven; +Cc: linux-kernel
On Mon, 2 Aug 2004, Arjan van de Ven wrote:
> assuming cpu 0 is the boot cpu sounds fragile/incorrect, but for irqbalanced
> I'd like to find out which cpu is the boot cpu, is there a good way of doing
> so ?
>
> The reason for needing this is that some firmware only likes running on the
> boot cpu so I need to bind firmware-related irq's to that cpu ideally.
How about something like mptable which will give you the BSP flag from the
MP table? I believe this gropes around /dev/mem.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: finding out the boot cpu number from userspace
2004-08-02 14:30 ` Zwane Mwaikambo
@ 2004-08-02 14:46 ` Richard B. Johnson
0 siblings, 0 replies; 12+ messages in thread
From: Richard B. Johnson @ 2004-08-02 14:46 UTC (permalink / raw)
To: Zwane Mwaikambo; +Cc: Arjan van de Ven, linux-kernel
On Mon, 2 Aug 2004, Zwane Mwaikambo wrote:
> On Mon, 2 Aug 2004, Arjan van de Ven wrote:
>
> > assuming cpu 0 is the boot cpu sounds fragile/incorrect, but for irqbalanced
> > I'd like to find out which cpu is the boot cpu, is there a good way of doing
> > so ?
> >
> > The reason for needing this is that some firmware only likes running on the
> > boot cpu so I need to bind firmware-related irq's to that cpu ideally.
>
> How about something like mptable which will give you the BSP flag from the
> MP table? I believe this gropes around /dev/mem.
Once CPUs other than 0 are enabled, they take part in the boot
process. They don't spin forever so I don't understand the notion
of 'boot CPU'.
Also firmware has no clue about what CPU is tickling it. There is no
possible way for it to find out, or even care. If some hardware
engineer claimed differently, he/she/it is pulling your chain (or
needs to learn how busses, CPUs and FPGAs work)! There is a
Virtual Wire specification that guarantees that no firmware
can possibly care.
Cheers,
Dick Johnson
Penguin : Linux version 2.4.26 on an i686 machine (5570.56 BogoMips).
Note 96.31% of all statistics are fiction.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: finding out the boot cpu number from userspace
2004-08-02 12:16 finding out the boot cpu number from userspace Arjan van de Ven
` (2 preceding siblings ...)
2004-08-02 14:30 ` Zwane Mwaikambo
@ 2004-08-02 15:50 ` Martin J. Bligh
2004-08-02 16:58 ` Jeff Moyer
2004-08-02 20:08 ` Chris Wedgwood
4 siblings, 1 reply; 12+ messages in thread
From: Martin J. Bligh @ 2004-08-02 15:50 UTC (permalink / raw)
To: Arjan van de Ven, linux-kernel
> assuming cpu 0 is the boot cpu sounds fragile/incorrect, but for irqbalanced
> I'd like to find out which cpu is the boot cpu, is there a good way of doing
> so ?
>
> The reason for needing this is that some firmware only likes running on the
> boot cpu so I need to bind firmware-related irq's to that cpu ideally.
On any sane arch, cpu 0 *IS* always the boot CPU, as we dynamically number
CPUs that way ... that doesn't mean that it's apicid 0. I believe that
PPC64 screwed this up, but AFAIK, everyone else gets it correct ... ;-)
M.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: finding out the boot cpu number from userspace
2004-08-02 15:50 ` Martin J. Bligh
@ 2004-08-02 16:58 ` Jeff Moyer
2004-08-02 17:23 ` Martin J. Bligh
0 siblings, 1 reply; 12+ messages in thread
From: Jeff Moyer @ 2004-08-02 16:58 UTC (permalink / raw)
To: Martin J. Bligh; +Cc: Arjan van de Ven, linux-kernel
==> Regarding Re: finding out the boot cpu number from userspace; "Martin J. Bligh" <mbligh@aracnet.com> adds:
>> assuming cpu 0 is the boot cpu sounds fragile/incorrect, but for
>> irqbalanced I'd like to find out which cpu is the boot cpu, is there a
>> good way of doing so ?
>>
>> The reason for needing this is that some firmware only likes running on
>> the boot cpu so I need to bind firmware-related irq's to that cpu
>> ideally.
mbligh> On any sane arch, cpu 0 *IS* always the boot CPU, as we dynamically
mbligh> number CPUs that way ... that doesn't mean that it's apicid 0. I
mbligh> believe that PPC64 screwed this up, but AFAIK, everyone else gets
mbligh> it correct ... ;-)
Hmm, do we need to do any special handling for this in the kexec case?
ISTR having some issues with this when using bootimg years back.
-Jeff
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: finding out the boot cpu number from userspace
2004-08-02 16:58 ` Jeff Moyer
@ 2004-08-02 17:23 ` Martin J. Bligh
2004-08-02 17:42 ` Alan Cox
0 siblings, 1 reply; 12+ messages in thread
From: Martin J. Bligh @ 2004-08-02 17:23 UTC (permalink / raw)
To: jmoyer; +Cc: Arjan van de Ven, linux-kernel
> ==> Regarding Re: finding out the boot cpu number from userspace; "Martin J. Bligh" <mbligh@aracnet.com> adds:
>
>>> assuming cpu 0 is the boot cpu sounds fragile/incorrect, but for
>>> irqbalanced I'd like to find out which cpu is the boot cpu, is there a
>>> good way of doing so ?
>>>
>>> The reason for needing this is that some firmware only likes running on
>>> the boot cpu so I need to bind firmware-related irq's to that cpu
>>> ideally.
>
> mbligh> On any sane arch, cpu 0 *IS* always the boot CPU, as we dynamically
> mbligh> number CPUs that way ... that doesn't mean that it's apicid 0. I
> mbligh> believe that PPC64 screwed this up, but AFAIK, everyone else gets
> mbligh> it correct ... ;-)
>
> Hmm, do we need to do any special handling for this in the kexec case?
> ISTR having some issues with this when using bootimg years back.
Eric went to some lengths to migrate us back to the original boot CPU
before kexec'ing. I think this is unnecessary - the new kernel should
handle booting on any CPU just fine (there was a panic in there at one
point if the boot CPU didn't match the BIOS's spec'ed one, but I removed
it).
M.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: finding out the boot cpu number from userspace
2004-08-02 17:23 ` Martin J. Bligh
@ 2004-08-02 17:42 ` Alan Cox
2004-08-02 18:49 ` Martin J. Bligh
0 siblings, 1 reply; 12+ messages in thread
From: Alan Cox @ 2004-08-02 17:42 UTC (permalink / raw)
To: Martin J. Bligh; +Cc: jmoyer, Arjan van de Ven, Linux Kernel Mailing List
On Llu, 2004-08-02 at 18:23, Martin J. Bligh wrote:
> Eric went to some lengths to migrate us back to the original boot CPU
> before kexec'ing. I think this is unnecessary - the new kernel should
> handle booting on any CPU just fine (there was a panic in there at one
> point if the boot CPU didn't match the BIOS's spec'ed one, but I removed
> it).
Several systems have broken SMM or BIOS functionality that requires the
*real* boot processor is used. The panic was correct and should be
restored. See apm_power_off() for one example.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: finding out the boot cpu number from userspace
2004-08-02 18:49 ` Martin J. Bligh
@ 2004-08-02 18:23 ` Alan Cox
0 siblings, 0 replies; 12+ messages in thread
From: Alan Cox @ 2004-08-02 18:23 UTC (permalink / raw)
To: Martin J. Bligh; +Cc: jmoyer, Arjan van de Ven, Linux Kernel Mailing List
On Llu, 2004-08-02 at 19:49, Martin J. Bligh wrote:
> Ah, OK didn't know that ... however, I'm not convinced that panicing is
> really that useful ... what happens if you proceed? IIRC, this is before
> console_init as well, so people won't even see the error. At least it
> should only do that on machines that are borked in such a fashion - 99% of
> machines will work fine, AFAICS.
The APM power off one is actually very common. Another one the ACPI guys
are now fighting that we also hit with SMM is E750x systems, where both
SMM traps and ACPI appear only to work on the boot CPU.
The panic at least made sure that we didnt end up with random mysterious
later problems that would be "fun" to debug.
(Note btw we sometimes care that kexec runs the new boot code on the
right processor because the 16bit entry points for some things also use
SMM traps on certain bioses in order to get a clean entry/stack/etc)
Alan
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: finding out the boot cpu number from userspace
2004-08-02 17:42 ` Alan Cox
@ 2004-08-02 18:49 ` Martin J. Bligh
2004-08-02 18:23 ` Alan Cox
0 siblings, 1 reply; 12+ messages in thread
From: Martin J. Bligh @ 2004-08-02 18:49 UTC (permalink / raw)
To: Alan Cox; +Cc: jmoyer, Arjan van de Ven, Linux Kernel Mailing List
>> Eric went to some lengths to migrate us back to the original boot CPU
>> before kexec'ing. I think this is unnecessary - the new kernel should
>> handle booting on any CPU just fine (there was a panic in there at one
>> point if the boot CPU didn't match the BIOS's spec'ed one, but I removed
>> it).
>
> Several systems have broken SMM or BIOS functionality that requires the
> *real* boot processor is used. The panic was correct and should be
> restored. See apm_power_off() for one example.
Ah, OK didn't know that ... however, I'm not convinced that panicing is
really that useful ... what happens if you proceed? IIRC, this is before
console_init as well, so people won't even see the error. At least it
should only do that on machines that are borked in such a fashion - 99% of
machines will work fine, AFAICS.
M.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: finding out the boot cpu number from userspace
2004-08-02 12:16 finding out the boot cpu number from userspace Arjan van de Ven
` (3 preceding siblings ...)
2004-08-02 15:50 ` Martin J. Bligh
@ 2004-08-02 20:08 ` Chris Wedgwood
4 siblings, 0 replies; 12+ messages in thread
From: Chris Wedgwood @ 2004-08-02 20:08 UTC (permalink / raw)
To: Arjan van de Ven; +Cc: linux-kernel
On Mon, Aug 02, 2004 at 02:16:35PM +0200, Arjan van de Ven wrote:
> assuming cpu 0 is the boot cpu sounds fragile/incorrect, but for
> irqbalanced I'd like to find out which cpu is the boot cpu, is there
> a good way of doing so ?
cpu numbers are logical not physical, so can't we assume cpu-0 is
*always* the boot cpu?
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2004-08-02 20:09 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-02 12:16 finding out the boot cpu number from userspace Arjan van de Ven
2004-08-02 13:37 ` Dave Jones
2004-08-02 14:13 ` Alan Cox
2004-08-02 14:30 ` Zwane Mwaikambo
2004-08-02 14:46 ` Richard B. Johnson
2004-08-02 15:50 ` Martin J. Bligh
2004-08-02 16:58 ` Jeff Moyer
2004-08-02 17:23 ` Martin J. Bligh
2004-08-02 17:42 ` Alan Cox
2004-08-02 18:49 ` Martin J. Bligh
2004-08-02 18:23 ` Alan Cox
2004-08-02 20:08 ` Chris Wedgwood
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox