2005-01-07 18:13:00

by YhLu

[permalink] [raw]
Subject: RE: 256 apic id for amd64

Hard_smp_processor_id is CPU physical apicid.
Boot_cpu_id is boot_cpu_physical_apicid.

There is two configuration that we need to enable APIC_EXT_ID.
1. 8 way + dual core --- 8*2 + 2 +1 = 19, the cpu will use 0-15, and ioapic
need to use 16 above.
2. 4 way + 7 amd 8131 + 1 8111 --- 4+7*2+1=19

After enabling APIC_EXT_ID, the K8 can use 256 apicid. But the io apic
device (amd 8131 and 8111) still need to use 0-15. So We need to use 16
above for cpu apic id.

The BIOS or LinuxBIOS will set the apic id of CPU to 16 later. Or that's to
say
Apicid = initial apic id + apicid_offset.

When dual core is used and nb_cfg_54 is set, node 0 will use initial apicid
0/1 for core0 and core1. after setting apicid_offset. Apicid will be 16/17.

Without subtract boot_cpu_id, phys_pkg_id will return 8.
With that, It will return 0.

The c->x86_apicid is initial apic id and it is by cupid(0x1).

I guess for one core old cpu
nb_cfg_54 can not be set, and node 0 will use initial apidid 0. After
setting apicid_offset. Apicid will be 16.

Without subtract boot_cpu_id, phys_pkg_id will return 16.
With that, It will return 0.

YH

-----Original Message-----
From: Andi Kleen [mailto:[email protected]]
Sent: Friday, January 07, 2005 4:25 AM
To: YhLu
Cc: Matt Domsch; [email protected]; [email protected];
[email protected]; [email protected]
Subject: Re: 256 apic id for amd64

On Thu, Jan 06, 2005 at 06:53:11PM -0800, YhLu wrote:
> static unsigned int phys_pkg_id(int index_msb)
> {
> return hard_smp_processor_id() >> index_msb;
> }
>
> In arch/x86_64/kernel/genapic_cluster.c
>
> Should be changed to
>
> static unsigned int phys_pkg_id(int index_msb)
> {
> /* physical apicid, so we need to substract offset */
> return (hard_smp_processor_id() - boot_cpu_id) >> index_msb;
> }

Why?

If you want a patch merged you need to supply some more explanation
please.

Also cc Suresh & James for comment.

-Andi


2005-01-07 19:34:54

by Andi Kleen

[permalink] [raw]
Subject: Re: 256 apic id for amd64

> Without subtract boot_cpu_id, phys_pkg_id will return 8.
> With that, It will return 0.

Normally this is set up that the CPUs come first and then the IO-APICs.
Why is this not possible with 8111 and 8131?

-Andi