[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] x86/vmx: implement Notify VM Exit
- To: Roger Pau Monne <roger.pau@xxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Thu, 19 May 2022 08:50:55 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9rEtgbWEYWkZBXaiTG6KlCNdTdef+KS8OdNeXAHESrg=; b=e44XvF4O2/99irkAcr0j3pYBy+7L17e4jEQ6CEBpKK0ZnWAnFlL8V5d+AFmlUSxnNh9JKsmOlujIOTPpaadKRg7V4na5lOQ2waDQWfoIarBxaPfNQ+kF2QPJX7NCXU/xKnurncao5S2zK0jgrZw7aoRjOhkJ0R4iZtLtXpdILpYVIlilqP6gJz5RrBpHVy9f9Wg2bfNsebzSyH+QYSQ0jxdtXlrcHaurXgeHMeFruDFi9SRVhgKPQ56NwcjAVuAGjnJ8+02biicBR9QCkFAJMKK4vmF+uiDJYlr3Qh8FNNTOB5COZONssjgv4AtstgcKYikZw5CfUbtAi4K/PE893g==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I4Au3eVppV+zbVGTSOhGDckHGU4SZE4MltRqZjfgLikQ699TEa3VSXoa3rlLqRgm6kfpprJHO0gHu7OoPu84rU6aJVYndXhdSCmFcpTLtWyw9LmVwfauj6VjRRUhKrB8KwaVRuaVqrm1US/XmVQ3uv6YsTd40c5hY2PPQ4Q1HpNoBch2NU2KlZg7CC0oMnXXBZv0Ci2HibkCXbvpz5mEnWYyWQixDiQm+qIotTV5tZL7wQ1Vo7PwcBetXV48N1ORQCEZT01TwLv9z3uzsoXRwFQShNZqRhazEoL8uBaibIyWV8EYld9L1XlFnXZz8iRr44ZX/eHSGeXgzDkXY6IaSA==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Jun Nakajima <jun.nakajima@xxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Thu, 19 May 2022 06:51:10 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 17.05.2022 15:21, Roger Pau Monne wrote:
> --- a/xen/arch/x86/hvm/vmx/vmcs.c
> +++ b/xen/arch/x86/hvm/vmx/vmcs.c
> @@ -67,6 +67,9 @@ integer_param("ple_gap", ple_gap);
> static unsigned int __read_mostly ple_window = 4096;
> integer_param("ple_window", ple_window);
>
> +static int __read_mostly vm_notify_window;
__ro_after_init?
> @@ -1333,6 +1338,19 @@ static int construct_vmcs(struct vcpu *v)
> rc = vmx_add_msr(v, MSR_FLUSH_CMD, FLUSH_CMD_L1D,
> VMX_MSR_GUEST_LOADONLY);
>
> + if ( cpu_has_vmx_notify_vm_exiting && vm_notify_window >= 0 )
The assumption then is that values >= 2^^31 are nonsense? Generally
I'd think we want to special case merely ~0u, giving the variable
unsigned type. However, I also don't see where you disable use of
the feature in that case: Merely skipping the VMCS update here isn't
enough, is it? The field itself doesn't know any special case
values (like ~0) as per the doc I'm looking at. So I guess the OR-ing
in of SECONDARY_EXEC_NOTIFY_VM_EXITING in vmx_init_vmcs_config()
wants to be conditional.
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -4567,6 +4567,30 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
> */
> break;
>
> + case EXIT_REASON_NOTIFY:
> + __vmread(EXIT_QUALIFICATION, &exit_qualification);
> +
> + if ( exit_qualification & NOTIFY_VM_CONTEXT_INVALID )
> + {
> + perfc_incr(vmnotify_crash);
Is this a useful event to count? We don't count other crash causes,
iirc.
Jan
|