Re: [RFC PATCH v2 22/34] x86/msr: Utilize the alternatives mechanism to read MSR

Jürgen Groß
2025-04-22T09:58:01Z

[-- Attachment #1.1.1: Type: text/plain, Size: 1651 bytes --]

On 22.04.25 11:20, Xin Li wrote:
> On 4/22/2025 1:59 AM, Jürgen Groß wrote:
>> On 22.04.25 10:22, Xin Li (Intel) wrote:
>>> To eliminate the indirect call overhead introduced by the pv_ops API,
>>> utilize the alternatives mechanism to read MSR:
>>>
>>>      1) When built with !CONFIG_XEN_PV, X86_FEATURE_XENPV becomes a
>>>         disabled feature, preventing the Xen code from being built
>>>         and ensuring the native code is executed unconditionally.
>>>
>>>      2) When built with CONFIG_XEN_PV:
>>>
>>>         2.1) If not running on the Xen hypervisor (!X86_FEATURE_XENPV),
>>>              the kernel runtime binary is patched to unconditionally
>>>              jump to the native MSR read code.
>>>
>>>         2.2) If running on the Xen hypervisor (X86_FEATURE_XENPV), the
>>>              kernel runtime binary is patched to unconditionally jump
>>>              to the Xen MSR read code.
>>>
>>> The alternatives mechanism is also used to choose the new immediate
>>> form MSR read instruction when it's available.
>>>
>>> Consequently, remove the pv_ops MSR read APIs and the Xen callbacks.
>>
>> Same as the comment to patch 5: there is no indirect call overhead after
>> the system has come up.
>>
>
> Please check https://lore.kernel.org/lkml/87y1h81ht4.ffs@tglx/.
>
> And it's was also mentioned in the previous patch:
>
> https://lore.kernel.org/lkml/20250422082216.1954310-22-xin@zytor.com/
>
> Please let me know what I have missed.

Please see my response to the previous patch.

Juergen

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3743 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]