[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH RFC V3 3/5] xen: Force-enable relevant MSR events; optimize the number of sent MSR events



>>> On 23.07.14 at 14:34, <rcojocaru@xxxxxxxxxxxxxxx> wrote:
> @@ -695,11 +696,34 @@ static void vmx_set_host_env(struct vcpu *v)
>  void vmx_disable_intercept_for_msr(struct vcpu *v, u32 msr, int type)
>  {
>      unsigned long *msr_bitmap = v->arch.hvm_vmx.msr_bitmap;
> +    struct domain *d = v->domain;
>  
>      /* VMX MSR bitmap supported? */
>      if ( msr_bitmap == NULL )
>          return;
>  
> +    if ( mem_event_check_ring(&d->mem_event->access) )
> +    {
> +        /* Filter out MSR-s needed for memory introspection */
> +        switch ( msr )
> +        {
> +        case MSR_IA32_SYSENTER_EIP:
> +        case MSR_IA32_SYSENTER_ESP:
> +        case MSR_IA32_SYSENTER_CS:
> +        case MSR_IA32_MC0_CTL:
> +        case MSR_STAR:
> +        case MSR_LSTAR:
> +
> +            gdprintk(XENLOG_DEBUG, "MSR 0x%08x "

Is the current domain/vCPU really useful in this message? And
do you really need the file name to be printed here? And does the
MSR number really need to always be 8 characters wide? Or
perhaps - is this message useful at all?

> --- a/xen/arch/x86/mm/mem_event.c
> +++ b/xen/arch/x86/mm/mem_event.c
> @@ -30,6 +30,7 @@
>  #include <asm/mem_access.h>
>  #include <asm/mem_sharing.h>
>  #include <xsm/xsm.h>
> +#include <asm/hvm/vmx/vmcs.h>

Please don't.

> @@ -600,6 +601,22 @@ int mem_event_domctl(struct domain *d, 
> xen_domctl_mem_event_op_t *mec,
>              rc = mem_event_enable(d, mec, med, _VPF_mem_access, 
>                                      HVM_PARAM_ACCESS_RING_PFN,
>                                      mem_access_notification);
> +            if ( rc == 0 )
> +            {
> +                struct vcpu *v;
> +
> +                /* Enable interception for MSRs needed for memory 
> introspection. */
> +                for_each_vcpu ( d, v )
> +                {
> +                    /* Safe, because of previous if ( !cpu_has_vmx ) check. 
> */

Safe or not, VMX-specific code doesn't belong here.

> +                    vmx_enable_intercept_for_msr(v, MSR_IA32_SYSENTER_EIP, 
> MSR_TYPE_W);
> +                    vmx_enable_intercept_for_msr(v, MSR_IA32_SYSENTER_ESP, 
> MSR_TYPE_W);
> +                    vmx_enable_intercept_for_msr(v, MSR_IA32_SYSENTER_CS, 
> MSR_TYPE_W);
> +                    vmx_enable_intercept_for_msr(v, MSR_IA32_MC0_CTL, 
> MSR_TYPE_W);
> +                    vmx_enable_intercept_for_msr(v, MSR_STAR, MSR_TYPE_W);
> +                    vmx_enable_intercept_for_msr(v, MSR_LSTAR, MSR_TYPE_W);
> +                }
> +            }
>          }
>          break;

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.