All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kai Huang <kai.huang@linux.intel.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
	jbeulich@suse.com, tim@xen.org, kevin.tian@intel.com,
	yang.z.zhang@intel.com, xen-devel@lists.xen.org
Subject: Re: [PATCH 03/10] VMX: Add PML definition and feature detection.
Date: Mon, 30 Mar 2015 14:18:09 +0800	[thread overview]
Message-ID: <5518EAA1.2040605@linux.intel.com> (raw)
In-Reply-To: <5515C192.5060007@citrix.com>



On 03/28/2015 04:46 AM, Andrew Cooper wrote:
> On 27/03/15 02:35, Kai Huang wrote:
>> 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        | 18 ++++++++++++++++++
>>   xen/include/asm-x86/hvm/vmx/vmcs.h |  5 +++++
>>   xen/include/asm-x86/hvm/vmx/vmx.h  |  1 +
>>   3 files changed, 24 insertions(+)
>>
>> diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
>> index 9b20a4b..2798b0b 100644
>> --- a/xen/arch/x86/hvm/vmx/vmcs.c
>> +++ b/xen/arch/x86/hvm/vmx/vmcs.c
>> @@ -143,6 +143,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 )
>> @@ -240,6 +241,8 @@ static int vmx_init_vmcs_config(void)
>>               opt |= SECONDARY_EXEC_ENABLE_VPID;
>>           if ( opt_unrestricted_guest_enabled )
>>               opt |= SECONDARY_EXEC_UNRESTRICTED_GUEST;
>> +        if ( pml_enable )
> This should be named opt_pml_enable in patch 1 or 2 to identify that it
> is a command line option.
Sure.

>
>> +            opt |= SECONDARY_EXEC_ENABLE_PML;
>>   
>>           /*
>>            * "APIC Register Virtualization" and "Virtual Interrupt Delivery"
>> @@ -286,6 +289,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 it anyway.
>> +	 */
>> +	if ( !(_vmx_ept_vpid_cap & VMX_EPT_AD_BIT_SUPPORT) )
>> +		_vmx_secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_PML;
>>       }
>>   
>>       if ( _vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT )
>> @@ -306,6 +317,10 @@ static int vmx_init_vmcs_config(void)
>>                     SECONDARY_EXEC_UNRESTRICTED_GUEST);
>>       }
>>   
>> +    /* PML cannot be supported if we don't use EPT */
>> +    if ( !(_vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT) )
>> +        _vmx_secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_PML;
>> +
> Somewhere in here you should clear pml_enable if hardware doesn't
> support it.
Will do. Thanks for catching.

Thanks,
-Kai
>
> ~Andrew
>
>>       if ( (_vmx_secondary_exec_control & SECONDARY_EXEC_PAUSE_LOOP_EXITING) &&
>>             ple_gap == 0 )
>>       {
>> @@ -1041,6 +1056,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 4528346..47b4df2 100644
>> --- a/xen/include/asm-x86/hvm/vmx/vmcs.h
>> +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h
>> @@ -216,6 +216,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
>> @@ -276,6 +277,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
>>   
>> @@ -320,6 +323,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,
>> @@ -333,6 +337,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 9afd351..c0e352d 100644
>> --- a/xen/include/asm-x86/hvm/vmx/vmx.h
>> +++ b/xen/include/asm-x86/hvm/vmx/vmx.h
>> @@ -186,6 +186,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
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

  reply	other threads:[~2015-03-30  6:18 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-27  2:35 [PATCH 00/10] PML (Paging Modification Logging) support Kai Huang
2015-03-27  2:35 ` [PATCH 01/10] VMX: Enable EPT A/D bit support Kai Huang
2015-03-27 20:38   ` Andrew Cooper
2015-03-30  6:11     ` Kai Huang
2015-03-30  9:36       ` Andrew Cooper
2015-03-30 13:35         ` Kai Huang
2015-03-30 13:39           ` Andrew Cooper
2015-04-02  6:32     ` Kai Huang
2015-04-02  9:55       ` Andrew Cooper
2015-04-09 11:21   ` Tim Deegan
2015-04-10  6:40     ` Kai Huang
2015-04-10  8:54       ` Tim Deegan
2015-04-10  9:26         ` Kai Huang
2015-04-10  9:51           ` Tim Deegan
2015-04-10 13:14             ` Kai Huang
2015-03-27  2:35 ` [PATCH 02/10] VMX: New parameter to control PML enabling Kai Huang
2015-03-27 20:42   ` Andrew Cooper
2015-03-30  6:16     ` Kai Huang
2015-04-02  5:46     ` Kai Huang
2015-04-02  9:58       ` Andrew Cooper
2015-04-02 13:34         ` Kai Huang
2015-03-27  2:35 ` [PATCH 03/10] VMX: Add PML definition and feature detection Kai Huang
2015-03-27 20:46   ` Andrew Cooper
2015-03-30  6:18     ` Kai Huang [this message]
2015-03-27  2:35 ` [PATCH 04/10] VMX: New data structure member to support PML Kai Huang
2015-03-27 20:48   ` Andrew Cooper
2015-03-30  6:19     ` Kai Huang
2015-03-27  2:35 ` [PATCH 05/10] VMX: add help functions " Kai Huang
2015-03-27 21:09   ` Andrew Cooper
2015-03-30  6:43     ` Kai Huang
2015-03-30  9:54       ` Andrew Cooper
2015-03-30 13:40         ` Kai Huang
2015-04-09 12:00   ` Tim Deegan
2015-04-10  7:05     ` Kai Huang
2015-04-10  9:03       ` Tim Deegan
2015-04-10  9:28         ` Kai Huang
2015-04-09 12:31   ` Tim Deegan
2015-04-10  7:07     ` Kai Huang
2015-03-27  2:35 ` [PATCH 06/10] VMX: handle PML buffer full VMEXIT Kai Huang
2015-03-27  2:35 ` [PATCH 07/10] VMX: handle PML enabling in vmx_vcpu_initialise Kai Huang
2015-03-27 21:12   ` Andrew Cooper
2015-03-30  7:03     ` Kai Huang
2015-03-30 10:00       ` Andrew Cooper
2015-03-27  2:35 ` [PATCH 08/10] VMX: disable PML in vmx_vcpu_destroy Kai Huang
2015-04-09 12:04   ` Tim Deegan
2015-04-10  7:25     ` Kai Huang
2015-04-10  9:30       ` Tim Deegan
2015-03-27  2:35 ` [PATCH 09/10] log-dirty: Refine common code to support PML Kai Huang
2015-04-09 12:27   ` Tim Deegan
2015-04-10  7:38     ` Kai Huang
2015-04-10  9:31       ` Tim Deegan
2015-04-10  9:33         ` Kai Huang
2015-03-27  2:35 ` [PATCH 10/10] p2m/ept: Enable PML in p2m-ept for log-dirty Kai Huang
2015-04-09 12:20   ` Tim Deegan
2015-04-10  8:44     ` Kai Huang
2015-04-10  9:46       ` Tim Deegan
2015-04-10 13:18         ` Kai Huang
2015-04-10 14:35           ` Tim Deegan
2015-03-27 21:26 ` [PATCH 00/10] PML (Paging Modification Logging) support Andrew Cooper
2015-03-30  5:50   ` Kai Huang
2015-04-07  8:30     ` Kai Huang
2015-04-07  9:24       ` Tim Deegan
2015-04-08  2:23         ` Kai Huang
2015-04-09 12:32         ` Tim Deegan
2015-04-10  6:40           ` 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=5518EAA1.2040605@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 \
    --cc=yang.z.zhang@intel.com \
    /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.