[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH 00/34] The rest of the x86_64-gnu port
From: |
Sergey Bugaev |
Subject: |
Re: [RFC PATCH 00/34] The rest of the x86_64-gnu port |
Date: |
Tue, 21 Mar 2023 18:52:05 +0300 |
On Tue, Mar 21, 2023 at 6:33 PM Almudena Garcia
<liberamenso10000@gmail.com> wrote:
> > But how does a core know its CPU number?
>
> Calling cpu_number() function, or getting its APIC ID from its Local APIC
Ah.
That's too hardware-y for me to understand; but I see that cpu_number
() in i386/i386/cpu_number.c also uses apic, and apic_get_current_cpu
() in i386/i386/apic.c looks fast enough, so, cool!
I know that Linux uses %gs; in particular their docs say:
-- >8 --
For example:
DEFINE_PER_CPU(int, x);
int z;
z = this_cpu_read(x);
results in a single instruction:
mov ax, gs:[x]
-- 8< --
https://docs.kernel.org/core-api/this_cpu_ops.html#inner-working-of-this-cpu-operations
Sergey
- Re: [RFC PATCH 00/34] The rest of the x86_64-gnu port, (continued)
- Re: [RFC PATCH 00/34] The rest of the x86_64-gnu port, Luca, 2023/03/21
- Re: [RFC PATCH 00/34] The rest of the x86_64-gnu port, Sergey Bugaev, 2023/03/21
- Re: [RFC PATCH 00/34] The rest of the x86_64-gnu port, Luca, 2023/03/21
- Re: [RFC PATCH 00/34] The rest of the x86_64-gnu port, Sergey Bugaev, 2023/03/21
- Re: [RFC PATCH 00/34] The rest of the x86_64-gnu port, Luca, 2023/03/21
- Re: [RFC PATCH 00/34] The rest of the x86_64-gnu port, Sergey Bugaev, 2023/03/21
- Re: [RFC PATCH 00/34] The rest of the x86_64-gnu port, Sergey Bugaev, 2023/03/21
- Message not available
- Re: [RFC PATCH 00/34] The rest of the x86_64-gnu port,
Sergey Bugaev <=
- Re: [RFC PATCH 00/34] The rest of the x86_64-gnu port, Luca, 2023/03/21
Re: [RFC PATCH 00/34] The rest of the x86_64-gnu port, Flávio Cruz, 2023/03/20