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

Re: [Xen-devel] [PATCH v5 2/6] x86: allow reading MSR_IA32_TSC with XENPF_resource_op



>>> On 21.01.15 at 12:19, <chao.p.peng@xxxxxxxxxxxxxxx> wrote:
> --- a/xen/arch/x86/platform_hypercall.c
> +++ b/xen/arch/x86/platform_hypercall.c
> @@ -61,7 +61,7 @@ long cpu_down_helper(void *data);
>  long core_parking_helper(void *data);
>  uint32_t get_cur_idle_nums(void);
>  
> -#define RESOURCE_ACCESS_MAX_ENTRIES 2
> +#define RESOURCE_ACCESS_MAX_ENTRIES 3

See my comment on an earlier version.

> @@ -75,6 +75,7 @@ static bool_t allow_access_msr(unsigned int msr)
>      /* MSR for CMT, refer to chapter 17.14 of Intel SDM. */
>      case MSR_IA32_CMT_EVTSEL:
>      case MSR_IA32_CMT_CTR:
> +    case MSR_IA32_TSC:
>          return 1;
>      }
>  
> @@ -143,10 +144,18 @@ static void resource_access(void *info)
>          switch ( entry->u.cmd )
>          {
>          case XEN_RESOURCE_OP_MSR_READ:
> -            ret = rdmsr_safe(entry->idx, entry->val);
> +            if ( entry->idx == MSR_IA32_TSC ) {

Coding style. unlikely()?

> +                entry->val = NOW();
> +                ret = 0;
> +            }
> +            else
> +                ret = rdmsr_safe(entry->idx, entry->val);
>              break;
>          case XEN_RESOURCE_OP_MSR_WRITE:
> -            ret = wrmsr_safe(entry->idx, entry->val);
> +            if ( entry->idx == MSR_IA32_TSC )

unlikely()?

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®.