Hi,
On 1/3/26 2:15 AM, Samuel Thibault wrote:
>
>> +static void
>> +reload_gs_base(int cpu)
>> +{
>> + wrmsr(MSR_REG_GSBASE, (uint64_t)&percpu_array[cpu]);
> Is writing to MSR_REG_GSBASE really needed?
>
Well, we could just write to KGSBASE and swap as needed,
but as we haven't worked out a strategy for using SWAPGS yet,
we need to load the actual GSBASE so that CPU_NUMBER() works.
See patch 1 comment for why we need to use MSR for this.
Before userspace exists with a thread, we need GSBASE
pointing to percpu area.
Damien