From: Jan Beulich <jbeulich@suse.com>
To: Grygorii Strashko <grygorii_strashko@epam.com>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Roger Pau Monné" <roger.pau@citrix.com>,
"Alejandro Vallejo" <alejandro.garciavallejo@amd.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [XEN][PATCH] x86/hvm: revise "cpu_has_vmx" usage for !CONFIG_INTEL_VMX case
Date: Wed, 8 Oct 2025 17:53:20 +0200 [thread overview]
Message-ID: <bc7f343b-b5cb-4276-a7fe-a9b599046cc3@suse.com> (raw)
In-Reply-To: <20250924101417.229108-1-grygorii_strashko@epam.com>
On 24.09.2025 12:14, Grygorii Strashko wrote:
> From: Grygorii Strashko <grygorii_strashko@epam.com>
>
> Since commit b99227347230 ("x86: Fix AMD_SVM and INTEL_VMX dependency") the
> HVM Intel VT-x support can be disabled, but it still keeps VMX
> code partially built-in. Particularly in HVM code there are two places:
>
> 1) hvm/dom0_build.c
> dom0_construct_pvh()->pvh_populate_p2m()
> ...
> if ( cpu_has_vmx && paging_mode_hap(d) && !vmx_unrestricted_guest(v) )
> {
> ...
> [unreachable for !cpu_has_vmx case]
> rc = pvh_setup_vmx_realmode_helpers(d);
>
> pvh_setup_vmx_realmode_helpers() allocates memory and configures
> HVM_PARAM_VM86_TSS_SIZED
> HVM_PARAM_IDENT_PT
>
> 2) hvm/hvm.c
> hvm_set_param()
> ...
> case HVM_PARAM_IDENT_PT:
>
> if ( !paging_mode_hap(d) || !cpu_has_vmx )
> {
> d->arch.hvm.params[index] = value;
> break;
> }
> [unreachable for !cpu_has_vmx case]
> ...
>
> Hence HVM_PARAM_IDENT_PT/HVM_PARAM_VM86_TSS_SIZED are used only by VMX code
> above code become unreachable in !cpu_has_vmx case and can be optimazed
> when !CONFIG_INTEL_VMX.
>
> Replace "cpu_has_vmx" with using_vmx() to account !CONFIG_INTEL_VMX and allow
> compiler DCE to optimize code.
>
> Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
next prev parent reply other threads:[~2025-10-08 15:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-24 10:14 [XEN][PATCH] x86/hvm: revise "cpu_has_vmx" usage for !CONFIG_INTEL_VMX case Grygorii Strashko
2025-09-30 12:10 ` Alejandro Vallejo
2025-10-08 15:53 ` Jan Beulich [this message]
2025-11-12 20:25 ` Grygorii Strashko
2025-11-13 7:31 ` Jan Beulich
2025-11-13 9:53 ` Grygorii Strashko
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=bc7f343b-b5cb-4276-a7fe-a9b599046cc3@suse.com \
--to=jbeulich@suse.com \
--cc=alejandro.garciavallejo@amd.com \
--cc=andrew.cooper3@citrix.com \
--cc=grygorii_strashko@epam.com \
--cc=roger.pau@citrix.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).