Re: [PATCH v2 1/6] KVM: x86: Add dedicated storage for guest RIP

Xiaoyao Li
2026-04-15T01:28:14Z

On 4/14/2026 11:37 PM, Sean Christopherson wrote:
> On Tue, Apr 14, 2026, Chang S. Bae wrote:
>> On 4/14/2026 5:31 AM, Xiaoyao Li wrote:
>>> Even leave RIP in regs[], what is the problem by just allocating the
>>> index 16-31 to R16-R31 and making RIP the index 32?
>>
>> But why?
>>
>> Even though the array isn't explicitly labeled as GPRs, that's effectively
>> how it's being used, and RIP isn't part of that set.
>>
>> I don't think there is any benefit of leaving it in regs[].
>
> +1. Chang's earlier argument that RIP isn't a proper GPR swayed me over, e.g. RIP
> doesn't have an architectural index.
>
> Keeping RIP in regs[] saves one line of code in arch/x86/include/asm/kvm_host.h,
> at the cost of making the code less readable (IMO) and incorrectly suggesting that
> RIP can be accessed like other regs[].

I'm not trying to object this patch. Instead, I'm trying to understand
the justification of the change.

So I would expected an updated changelog with above justifications
incorporated.