From: Kai Huang <kai.huang@linux.intel.com>
To: "Tian, Kevin" <kevin.tian@intel.com>,
"andrew.cooper3@citrix.com" <andrew.cooper3@citrix.com>,
"tim@xen.org" <tim@xen.org>,
"jbeulich@suse.com" <jbeulich@suse.com>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [v2 04/11] vmx: add PML definition and feature detection.
Date: Fri, 17 Apr 2015 10:14:38 +0800 [thread overview]
Message-ID: <55306C8E.9050904@linux.intel.com> (raw)
In-Reply-To: <AADFC41AFE54684AB9EE6CBC0274A5D126211BBB@SHSMSX101.ccr.corp.intel.com>
On 04/17/2015 06:35 AM, Tian, Kevin wrote:
>> From: Kai Huang [mailto:kai.huang@linux.intel.com]
>> Sent: Wednesday, April 15, 2015 3:04 PM
>>
>> The patch adds PML definition and feature detection. Note PML won't be
>> detected
>> if PML is disabled from boot parameter. PML is also disabled in
>> construct_vmcs,
>> as it will only be enabled when domain is switched to log dirty mode.
>>
>> Signed-off-by: Kai Huang <kai.huang@linux.intel.com>
>> ---
>> xen/arch/x86/hvm/vmx/vmcs.c | 22 ++++++++++++++++++++++
>> xen/include/asm-x86/hvm/vmx/vmcs.h | 6 ++++++
>> xen/include/asm-x86/hvm/vmx/vmx.h | 1 +
>> 3 files changed, 29 insertions(+)
>>
>> diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
>> index 4fff46d..d120370 100644
>> --- a/xen/arch/x86/hvm/vmx/vmcs.c
>> +++ b/xen/arch/x86/hvm/vmx/vmcs.c
>> @@ -141,6 +141,7 @@ static void __init vmx_display_features(void)
>> P(cpu_has_vmx_virtual_intr_delivery, "Virtual Interrupt Delivery");
>> P(cpu_has_vmx_posted_intr_processing, "Posted Interrupt Processing");
>> P(cpu_has_vmx_vmcs_shadowing, "VMCS shadowing");
>> + P(cpu_has_vmx_pml, "Page Modification Logging");
>> #undef P
>>
>> if ( !printed )
>> @@ -238,6 +239,8 @@ static int vmx_init_vmcs_config(void)
>> opt |= SECONDARY_EXEC_ENABLE_VPID;
>> if ( opt_unrestricted_guest_enabled )
>> opt |= SECONDARY_EXEC_UNRESTRICTED_GUEST;
>> + if ( opt_pml_enabled )
>> + opt |= SECONDARY_EXEC_ENABLE_PML;
>>
>> /*
>> * "APIC Register Virtualization" and "Virtual Interrupt Delivery"
>> @@ -284,6 +287,14 @@ static int vmx_init_vmcs_config(void)
>> */
>> if ( !(_vmx_ept_vpid_cap & VMX_VPID_INVVPID_ALL_CONTEXT) )
>> _vmx_secondary_exec_control &=
>> ~SECONDARY_EXEC_ENABLE_VPID;
>> +
>> + /*
>> + * PML cannot be supported if EPT A/D bits is not supported.
>> Actually,
>> + * PML should not be detected if EPT A/D bits is not supported, but
>> for
>> + * sure we do the check anyway.
>> + */
>> + if ( !(_vmx_ept_vpid_cap & VMX_EPT_AD_BIT) )
>> + _vmx_secondary_exec_control &=
>> ~SECONDARY_EXEC_ENABLE_PML;
>> }
> the comment is not very clear. I think you just want to say "EPT A/D bit is
> required for PML" or no comment at all.
Sure, I'll change it to "EPT A/D bit is required for PML".
Thanks,
-Kai
>
>> if ( _vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT )
>> @@ -304,6 +315,14 @@ static int vmx_init_vmcs_config(void)
>> SECONDARY_EXEC_UNRESTRICTED_GUEST);
>> }
>>
>> + /* PML cannot be supported if EPT is not used */
>> + if ( !(_vmx_secondary_exec_control &
>> SECONDARY_EXEC_ENABLE_EPT) )
>> + _vmx_secondary_exec_control &=
>> ~SECONDARY_EXEC_ENABLE_PML;
>> +
>> + /* Turn off opt_pml_enabled if PML feature is not present */
>> + if ( !(_vmx_secondary_exec_control &
>> SECONDARY_EXEC_ENABLE_PML) )
>> + opt_pml_enabled = 0;
>> +
>> if ( (_vmx_secondary_exec_control &
>> SECONDARY_EXEC_PAUSE_LOOP_EXITING) &&
>> ple_gap == 0 )
>> {
>> @@ -1039,6 +1058,9 @@ static int construct_vmcs(struct vcpu *v)
>> __vmwrite(POSTED_INTR_NOTIFICATION_VECTOR,
>> posted_intr_vector);
>> }
>>
>> + /* Disable PML anyway here as it will only be enabled in log dirty mode
>> */
>> + v->arch.hvm_vmx.secondary_exec_control &=
>> ~SECONDARY_EXEC_ENABLE_PML;
>> +
>> /* Host data selectors. */
>> __vmwrite(HOST_SS_SELECTOR, __HYPERVISOR_DS);
>> __vmwrite(HOST_DS_SELECTOR, __HYPERVISOR_DS);
>> diff --git a/xen/include/asm-x86/hvm/vmx/vmcs.h
>> b/xen/include/asm-x86/hvm/vmx/vmcs.h
>> index 6fce6aa..f831a78 100644
>> --- a/xen/include/asm-x86/hvm/vmx/vmcs.h
>> +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h
>> @@ -215,6 +215,7 @@ extern u32 vmx_vmentry_control;
>> #define SECONDARY_EXEC_ENABLE_INVPCID 0x00001000
>> #define SECONDARY_EXEC_ENABLE_VMFUNC 0x00002000
>> #define SECONDARY_EXEC_ENABLE_VMCS_SHADOWING 0x00004000
>> +#define SECONDARY_EXEC_ENABLE_PML 0x00020000
>> extern u32 vmx_secondary_exec_control;
>>
>> #define VMX_EPT_EXEC_ONLY_SUPPORTED 0x00000001
>> @@ -226,6 +227,7 @@ extern u32 vmx_secondary_exec_control;
>> #define VMX_EPT_INVEPT_INSTRUCTION 0x00100000
>> #define VMX_EPT_INVEPT_SINGLE_CONTEXT 0x02000000
>> #define VMX_EPT_INVEPT_ALL_CONTEXT 0x04000000
>> +#define VMX_EPT_AD_BIT 0x00200000
>>
>> #define VMX_MISC_VMWRITE_ALL 0x20000000
>>
>> @@ -274,6 +276,8 @@ extern u32 vmx_secondary_exec_control;
>> (vmx_pin_based_exec_control & PIN_BASED_POSTED_INTERRUPT)
>> #define cpu_has_vmx_vmcs_shadowing \
>> (vmx_secondary_exec_control &
>> SECONDARY_EXEC_ENABLE_VMCS_SHADOWING)
>> +#define cpu_has_vmx_pml \
>> + (vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_PML)
>>
>> #define VMCS_RID_TYPE_MASK 0x80000000
>>
>> @@ -318,6 +322,7 @@ enum vmcs_field {
>> GUEST_LDTR_SELECTOR = 0x0000080c,
>> GUEST_TR_SELECTOR = 0x0000080e,
>> GUEST_INTR_STATUS = 0x00000810,
>> + GUEST_PML_INDEX = 0x00000812,
>> HOST_ES_SELECTOR = 0x00000c00,
>> HOST_CS_SELECTOR = 0x00000c02,
>> HOST_SS_SELECTOR = 0x00000c04,
>> @@ -331,6 +336,7 @@ enum vmcs_field {
>> VM_EXIT_MSR_STORE_ADDR = 0x00002006,
>> VM_EXIT_MSR_LOAD_ADDR = 0x00002008,
>> VM_ENTRY_MSR_LOAD_ADDR = 0x0000200a,
>> + PML_ADDRESS = 0x0000200e,
>> TSC_OFFSET = 0x00002010,
>> VIRTUAL_APIC_PAGE_ADDR = 0x00002012,
>> APIC_ACCESS_ADDR = 0x00002014,
>> diff --git a/xen/include/asm-x86/hvm/vmx/vmx.h
>> b/xen/include/asm-x86/hvm/vmx/vmx.h
>> index 91c5e18..50f1bfc 100644
>> --- a/xen/include/asm-x86/hvm/vmx/vmx.h
>> +++ b/xen/include/asm-x86/hvm/vmx/vmx.h
>> @@ -185,6 +185,7 @@ static inline unsigned long pi_get_pir(struct pi_desc
>> *pi_desc, int group)
>> #define EXIT_REASON_XSETBV 55
>> #define EXIT_REASON_APIC_WRITE 56
>> #define EXIT_REASON_INVPCID 58
>> +#define EXIT_REASON_PML_FULL 62
>>
>> /*
>> * Interruption-information format
>> --
>> 2.1.0
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2015-04-17 2:14 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-15 7:03 [v2 00/11] PML (Paging Modification Logging) support Kai Huang
2015-04-15 7:03 ` [v2 01/11] vmx: add new boot parameter to control PML enabling Kai Huang
2015-04-15 10:12 ` Andrew Cooper
2015-04-15 12:20 ` Jan Beulich
2015-04-15 13:20 ` Kai Huang
2015-04-15 13:47 ` Jan Beulich
2015-04-15 7:03 ` [v2 02/11] doc: add description for new PML boot parameter Kai Huang
2015-04-15 10:15 ` Andrew Cooper
2015-04-15 12:17 ` Jan Beulich
2015-04-16 4:47 ` Kai Huang
2015-04-16 14:49 ` Andrew Cooper
2015-04-15 7:03 ` [v2 03/11] log-dirty: add new paging_mark_gfn_dirty Kai Huang
2015-04-15 7:03 ` [v2 04/11] vmx: add PML definition and feature detection Kai Huang
2015-04-16 22:35 ` Tian, Kevin
2015-04-17 2:14 ` Kai Huang [this message]
2015-04-15 7:03 ` [v2 05/11] vmx: add new data structure member to support PML Kai Huang
2015-04-16 15:33 ` Jan Beulich
2015-04-17 2:12 ` Kai Huang
2015-04-16 22:39 ` Tian, Kevin
2015-04-17 2:31 ` Kai Huang
2015-04-21 6:04 ` Kai Huang
2015-04-21 13:10 ` Tian, Kevin
2015-04-15 7:03 ` [v2 06/11] vmx: add help functions " Kai Huang
2015-04-16 15:42 ` Jan Beulich
2015-04-17 3:10 ` Kai Huang
2015-04-17 6:23 ` Jan Beulich
2015-04-17 6:51 ` Kai Huang
2015-04-17 6:58 ` Jan Beulich
2015-04-17 7:23 ` Kai Huang
2015-04-17 7:37 ` Jan Beulich
2015-04-17 7:45 ` Kai Huang
2015-04-24 6:32 ` Kai Huang
2015-04-24 7:30 ` Jan Beulich
2015-04-24 7:41 ` Kai Huang
2015-04-16 22:57 ` Tian, Kevin
2015-04-17 0:10 ` Tim Deegan
2015-04-17 3:32 ` Kai Huang
2015-04-17 8:36 ` Tim Deegan
2015-04-17 9:29 ` Kai Huang
2015-04-20 8:29 ` Tim Deegan
2015-04-20 10:08 ` Kai Huang
2015-04-20 10:13 ` Tim Deegan
2015-04-17 3:15 ` Kai Huang
2015-04-16 22:59 ` Tian, Kevin
2015-04-15 7:03 ` [v2 07/11] vmx: handle PML buffer full VMEXIT Kai Huang
2015-04-15 7:03 ` [v2 08/11] vmx: handle PML enabling in vmx_vcpu_initialise Kai Huang
2015-04-15 7:03 ` [v2 09/11] vmx: disable PML in vmx_vcpu_destroy Kai Huang
2015-04-15 7:03 ` [v2 10/11] log-dirty: refine common code to support PML Kai Huang
2015-04-16 15:51 ` Jan Beulich
2015-04-16 23:07 ` Tian, Kevin
2015-04-17 2:47 ` Kai Huang
2015-04-17 2:46 ` Kai Huang
2015-04-17 6:28 ` Jan Beulich
2015-04-17 6:55 ` Kai Huang
2015-04-15 7:03 ` [v2 11/11] p2m/ept: enable PML in p2m-ept for log-dirty Kai Huang
2015-04-16 15:54 ` Jan Beulich
2015-04-17 2:40 ` Kai Huang
2015-04-17 6:28 ` Jan Beulich
2015-04-17 7:10 ` Kai Huang
2015-04-17 7:33 ` Jan Beulich
2015-04-16 14:41 ` [v2 00/11] PML (Paging Modification Logging) support Tim Deegan
2015-04-16 15:18 ` Kai Huang
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=55306C8E.9050904@linux.intel.com \
--to=kai.huang@linux.intel.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=kevin.tian@intel.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.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.