From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
Andrew Cooper <andrew.cooper3@citrix.com>, Wei Liu <wl@xen.org>,
Kevin Tian <kevin.tian@intel.com>,
Jun Nakajima <jun.nakajima@intel.com>
Subject: Re: [PATCH 1/5] VMX: drop vmx_virt_exception and make vmx_vmfunc static
Date: Tue, 21 Nov 2023 18:46:43 +0100 [thread overview]
Message-ID: <ZVztAzdwDTnJuJE4@macbook.local> (raw)
In-Reply-To: <a058b837-82da-4b93-be5c-b616511d24f9@suse.com>
On Tue, Nov 21, 2023 at 06:22:37PM +0100, Jan Beulich wrote:
> On 21.11.2023 16:48, Roger Pau Monné wrote:
> > On Thu, Nov 16, 2023 at 02:30:41PM +0100, Jan Beulich wrote:
> >> The variable was introduced by 69b830e5ffb4 ("VMX: VMFUNC and #VE
> >> definitions and detection") without any use and - violating Misra C:2012
> >> rule 8.4 - without a declaration. Since no use has appeared, drop it.
> >>
> >> For vmx_vmfunc the situation is similar, but not identical: It at least
> >> has one use. Convert it to be static (and make style adjustments while
> >> there).
> >
> > I think you could also remove the sole user of vmx_vmfunc, as it's
> > just a cap_check() usage (unless there are more hidden usages).
>
> Well, perhaps (and hence my post-commit-message remark in the original
> submission). Yet then I thought we permitted vmfunc use for altp2m, at
> which point the cap_check() is meaningful.
Right, I see now that we do only enable VMFUNC if EPTP switching is
supported, and hence we need to assert it's present on any other
CPUs, so yes, we must keep vmx_vmfunc.
> >> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> >
> > Acked-by: Roger Pau Monné <roger.pau@citrix.com>
>
> Thanks.
>
> >> ---
> >> In how far the sole vmx_vmfunc use is actually meaningful (on its own)
> >> I'm not really sure.
>
> (Here ^^^)
>
> >> --- a/xen/arch/x86/hvm/vmx/vmcs.c
> >> +++ b/xen/arch/x86/hvm/vmx/vmcs.c
> >> @@ -167,8 +167,7 @@ u32 vmx_secondary_exec_control __read_mo
> >> u32 vmx_vmexit_control __read_mostly;
> >> u32 vmx_vmentry_control __read_mostly;
> >> u64 vmx_ept_vpid_cap __read_mostly;
> >> -u64 vmx_vmfunc __read_mostly;
> >> -bool_t vmx_virt_exception __read_mostly;
> >> +static uint64_t __read_mostly vmx_vmfunc;
> >
> > I'm quite sure this should be __ro_after_init, but I guess we cannot
> > be sure give the current code in vmx_init_vmcs_config().
>
> I think we can be sure. But if we were to switch, I think all the
> related variables should also be switched at the same time.
OK, IIRC in the past we have switched those kind of attributes as we
changed the code for other reasons I think, but I won't insist.
Coherency of attributes might be more valuable here.
>
> > Any CPU hot plugged that has a different set of VMX controls should
> > not be onlined, the more that migrating an already running VMCS to
> > such CPU will lead to failures if non-supported features are used.
>
> That's the intention of that code, yes.
Hm, yes, since we do require PIN_BASED_EXT_INTR_MASK and
PIN_BASED_NMI_EXITING on pin_based_exec_control the setting of the
vmx_ fields is only done on the BSP, or else VMX is not enabled. It
would be IMO clearer to do the initial setting of the vmx_ fields
based on the function `bsp` parameter. Anyway, not for this patch.
Thanks, Roger.
next prev parent reply other threads:[~2023-11-21 17:47 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-16 13:29 [PATCH 0/5] x86/HVM: misc tidying Jan Beulich
2023-11-16 13:30 ` [PATCH 1/5] VMX: drop vmx_virt_exception and make vmx_vmfunc static Jan Beulich
2023-11-21 15:48 ` Roger Pau Monné
2023-11-21 17:22 ` Jan Beulich
2023-11-21 17:46 ` Roger Pau Monné [this message]
2023-11-16 13:31 ` [PATCH 2/5] x86/HVM: hide SVM/VMX when their enabling is prohibited by firmware Jan Beulich
2023-11-21 16:24 ` Roger Pau Monné
2023-11-21 17:27 ` Jan Beulich
2023-11-21 17:31 ` Andrew Cooper
2023-11-22 7:52 ` Jan Beulich
2023-11-22 8:22 ` Roger Pau Monné
2023-11-22 8:33 ` Jan Beulich
2023-11-16 13:32 ` [PATCH 3/5] VMX: don't run with CR4.VMXE set when VMX could not be enabled Jan Beulich
2023-11-21 17:30 ` Roger Pau Monné
2023-11-22 8:27 ` Jan Beulich
2023-11-16 13:32 ` [PATCH 4/5] x86/HVM: drop tsc_scaling.setup() hook Jan Beulich
2023-11-22 9:06 ` Roger Pau Monné
2023-11-22 9:13 ` Jan Beulich
2023-11-16 13:33 ` [PATCH 5/5] x86/HVM: improve CET-IBT pruning of ENDBR Jan Beulich
2023-11-22 10:08 ` Roger Pau Monné
2023-11-22 10:42 ` Jan Beulich
2023-11-22 12:01 ` Roger Pau Monné
2023-11-22 12:11 ` Jan Beulich
2023-11-22 13:41 ` Roger Pau Monné
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=ZVztAzdwDTnJuJE4@macbook.local \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=jun.nakajima@intel.com \
--cc=kevin.tian@intel.com \
--cc=wl@xen.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.