Re: [PATCH 01/15] KVM: VMX: Use x86 core API to access to fs_base and inactive gs_base

Lai Jiangshan
2021-11-22T03:27:21Z

On 2021/11/21 23:17, Thomas Gleixner wrote:
> Lai,
>
> On Thu, Nov 18 2021 at 19:08, Lai Jiangshan wrote:
>> From: Lai Jiangshan <laijs@linux.alibaba.com>
>>
>> And they use FSGSBASE instructions when enabled.
>
> That's really not a proper explanation for adding yet more exports.
>

Hello

---
When a vCPU thread is rescheduled, 1 rdmsr and 2 wrmsr are called for
MSR_KERNEL_GS_BASE.

In scheduler, the core kernel uses x86_gsbase_[read|write]_cpu_inactive()
to accelerate the access to inactive GSBASE, but when the scheduler calls
in the preemption notifier in kvm, {rd|wr}msr(MSR_KERNEL_GS_BASE) is used.

To make the way of how kvm access to inactive GSBASE consistent with the
scheduler, kvm is changed to use x86 core API to access to fs_base and
inactive gs_base. And they use FSGSBASE instructions when enabled.

It would add 2 more exports, but it doesn't export any extra software nor
hardware resources since the resources can be access via {rd|wr}msr.
---

Not so persuasive. If it needs to be accelerated in the preemption notifier,
there are some other more aggressive ways.

Thanks
Lai