From: Alejandro Vallejo <agarciav@amd.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: <andrew.cooper3@citrix.com>, <anthony.perard@vates.tech>,
<marmarek@invisiblethingslab.com>, <michal.orzel@amd.com>,
<roger.pau@citrix.com>, <sstabellini@kernel.org>,
<xen-devel@lists.xenproject.org>,
Jason Andryuk <jason.andryuk@amd.com>, <jgross@suse.com>
Subject: Re: [RFC PATCH] x86/xen: Fix PVH dom0 xen_hypercall detection
Date: Fri, 11 Apr 2025 15:10:50 +0100 [thread overview]
Message-ID: <D93VC02KYBLI.3I5OGXLY9HCZ8@amd.com> (raw)
In-Reply-To: <bdb04e97-07cd-4d31-8853-6aa5094aea0c@suse.com>
On Fri Apr 11, 2025 at 2:08 PM BST, Jan Beulich wrote:
> On 11.04.2025 14:46, Alejandro Vallejo wrote:
>> On Thu Apr 10, 2025 at 8:50 PM BST, Jason Andryuk wrote:
>>> A Xen PVH dom0 on an AMD processor triple faults early in boot on
>>> 6.6.86. CPU detection appears to fail, as the faulting instruction is
>>> vmcall in xen_hypercall_intel() and not vmmcall in xen_hypercall_amd().
>>>
>>> Detection fails because __xen_hypercall_setfunc() returns the full
>>> kernel mapped address of xen_hypercall_amd() or xen_hypercall_intel() -
>>> e.g. 0xffffffff815b93f0. But this is compared against the rip-relative
>>> xen_hypercall_amd(%rip), which when running from identity mapping, is
>>> only 0x015b93f0.
>>>
>>> Replace the rip-relative address with just loading the actual address to
>>> restore the proper comparision.
>>>
>>> This only seems to affect PVH dom0 boot. This is probably because the
>>> XENMEM_memory_map hypercall is issued early on from the identity
>>> mappings. With a domU, the memory map is provided via hvm_start_info
>>> and the hypercall is skipped. The domU is probably running from the
>>> kernel high mapping when it issues hypercalls.
>>>
>>> Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
>>> ---
>>> I think this sort of address mismatch would be addresed by
>>> e8fbc0d9cab6 ("x86/pvh: Call C code via the kernel virtual mapping")
>>>
>>> That could be backported instead, but it depends on a fair number of
>>> patches.
>>>
>>> Not sure on how getting a patch just into 6.6 would work. This patch
>>> could go into upstream Linux though it's not strictly necessary when the
>>> rip-relative address is a high address.
>>> ---
>>> arch/x86/xen/xen-head.S | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S
>>> index 059f343da76d..71a0eda2da60 100644
>>> --- a/arch/x86/xen/xen-head.S
>>> +++ b/arch/x86/xen/xen-head.S
>>> @@ -117,7 +117,7 @@ SYM_FUNC_START(xen_hypercall_hvm)
>>> pop %ebx
>>> pop %eax
>>> #else
>>> - lea xen_hypercall_amd(%rip), %rcx
>>> + mov $xen_hypercall_amd, %rcx
>>
>> (Now that this is known to be the fix upstream) This probably wants to
>> be plain lea without RIP-relative addressing, like the x86_32 branch
>> above?
>
> Why would you want to use LEA there? It's functionally identical, but the
> MOV can be encoded without ModR/M byte.
>
> Jan
It's not the using of a particular encoding that I meant, but not using
the same on both 32 and 64 bit paths. Surely whatever argument in favour
of either would hold for both 32 and 64 bits.
Cheers,
Alejandro
next prev parent reply other threads:[~2025-04-11 14:11 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-09 16:36 [PATCH TEST-ARTEFACTS 0/8] Cleanup and Linux ARM64 support Andrew Cooper
2025-04-09 16:36 ` [PATCH 1/8] Consistently use DOCKER_CMD in makefiles Andrew Cooper
2025-04-09 16:36 ` [PATCH 2/8] Port containerise Andrew Cooper
2025-04-10 9:33 ` Anthony PERARD
2025-04-10 9:35 ` Andrew Cooper
2025-04-09 16:36 ` [PATCH 3/8] Fix container user setup Andrew Cooper
2025-04-10 9:41 ` Anthony PERARD
2025-04-09 16:36 ` [PATCH 4/8] Clean up Gitlab yaml Andrew Cooper
2025-04-09 17:15 ` Marek Marczykowski-Górecki
2025-04-10 9:38 ` Andrew Cooper
2025-04-10 10:07 ` Anthony PERARD
2025-04-10 10:11 ` Andrew Cooper
[not found] ` <Z_jid7eTY7EPIoWu@l14>
2025-04-11 9:45 ` Andrew Cooper
2025-04-09 16:36 ` [PATCH 5/8] Adjust Linux build script to work with other major versions Andrew Cooper
2025-04-09 16:57 ` Marek Marczykowski-Górecki
2025-04-09 17:18 ` Andrew Cooper
2025-04-09 16:37 ` [PATCH 6/8] Factor our x86-isms in the linux build script Andrew Cooper
2025-04-09 17:05 ` Marek Marczykowski-Górecki
2025-04-09 22:59 ` Marek Marczykowski-Górecki
2025-04-09 23:04 ` Andrew Cooper
2025-04-09 16:37 ` [PATCH 7/8] Infrastructure for arm64 linux builds Andrew Cooper
2025-04-09 17:11 ` Marek Marczykowski-Górecki
2025-04-09 17:15 ` Andrew Cooper
2025-04-10 10:41 ` Andrew Cooper
2025-04-10 10:57 ` Andrew Cooper
2025-04-10 12:21 ` Marek Marczykowski-Górecki
2025-04-10 9:59 ` Andrew Cooper
2025-04-09 16:37 ` [PATCH 8/8] Linux 6.6.86 for x86 and arm64 Andrew Cooper
2025-04-09 17:01 ` [PATCH TEST-ARTEFACTS 0/8] Cleanup and Linux ARM64 support Andrew Cooper
2025-04-10 0:09 ` Jason Andryuk
2025-04-10 9:17 ` Andrew Cooper
2025-04-10 18:20 ` Alejandro Vallejo
2025-04-10 18:28 ` Alejandro Vallejo
2025-04-10 19:50 ` [RFC PATCH] x86/xen: Fix PVH dom0 xen_hypercall detection Jason Andryuk
2025-04-10 21:49 ` Andrew Cooper
2025-04-11 11:35 ` Ard Biesheuvel
2025-04-11 14:28 ` Jason Andryuk
2025-04-11 15:32 ` Ard Biesheuvel
2025-04-11 12:46 ` Alejandro Vallejo
2025-04-11 13:08 ` Jan Beulich
2025-04-11 14:10 ` Alejandro Vallejo [this message]
2025-04-18 10:58 ` [PATCH TEST-ARTEFACTS 0/8] Cleanup and Linux ARM64 support David Woodhouse
2025-04-10 21:16 ` Jason Andryuk
2025-04-10 21:50 ` Jason Andryuk
2025-04-11 12:41 ` Alejandro Vallejo
2025-04-10 9:32 ` Jürgen Groß
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=D93VC02KYBLI.3I5OGXLY9HCZ8@amd.com \
--to=agarciav@amd.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=jason.andryuk@amd.com \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=marmarek@invisiblethingslab.com \
--cc=michal.orzel@amd.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--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.