All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lin Liu <lin.liu01@citrix.com>
To: jbeulich@suse.com
Cc: andrew.cooper3@citrix.com, jason.andryuk@amd.com,
	lin.liu01@citrix.com, roger@xenproject.org,
	teddy.astie@vates.tech, xen-devel@lists.xenproject.org
Subject: Re: [PATCH] x86/nSVM: Save L2's CR4 on #VMEXIT, not Xen's
Date: Mon, 28 Sep 2026 09:26:47 +0000	[thread overview]
Message-ID: <20260928092647.1558693-1-lin.liu01@citrix.com> (raw)
In-Reply-To: <8bc996ec-09c0-4241-bc3a-64dbf44c5e5f@suse.com>

>> On 23.09.2026 11:51, Lin Liu wrote:
>> --- a/xen/arch/x86/hvm/svm/nestedsvm.c
>> +++ b/xen/arch/x86/hvm/svm/nestedsvm.c
>> @@ -1082,7 +1082,7 @@ nsvm_vmcb_prepare4vmexit(struct vcpu *v, struct cpu_user_regs *regs)
>>      ns_vmcb->_efer = n2vmcb->_efer;
>>  
>>      /* CRn */
>> -    ns_vmcb->_cr4 = n2vmcb->_cr4;
>> +    ns_vmcb->_cr4 = v->arch.hvm.guest_cr[4];
>>      ns_vmcb->_cr0 = n2vmcb->_cr0;
>
>In addition to mirroring the change to CR0 and EFER, doesn't CR2 also
>need handling the same way? Effectively the inverse direction of anything
>respective that nsvm_vmcb_prepare4vmrun() does?
>
>Jan

CR2 is different, it store the page fault address on #PF.
If #PF happens, xen as hardware emulator, should write back the CR2 as part of
guest state area. so copy from n2vmcb is the right behavior.

I will raise v2 to update all other CRs and EFER.


  reply	other threads:[~2026-09-28  9:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23  9:51 [PATCH] x86/nSVM: Save L2's CR4 on #VMEXIT, not Xen's Lin Liu
2026-09-23 11:16 ` Ross Lagerwall
2026-09-24  2:29   ` Lin Liu
2026-09-24 15:01   ` Jan Beulich
2026-09-24 15:50     ` Ross Lagerwall
2026-09-24 16:03       ` Jan Beulich
2026-09-24 15:21 ` Jan Beulich
2026-09-28  9:26   ` Lin Liu [this message]
2026-09-28  9:28     ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260928092647.1558693-1-lin.liu01@citrix.com \
    --to=lin.liu01@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jason.andryuk@amd.com \
    --cc=jbeulich@suse.com \
    --cc=roger@xenproject.org \
    --cc=teddy.astie@vates.tech \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.