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

Re: [Xen-devel] [PATCH v7 1/5] x86: allow reading MSR_IA32_TSC with XENPF_resource_op



>>> On 27.01.15 at 07:13, <chao.p.peng@xxxxxxxxxxxxxxx> wrote:
> Memory bandwidth monitoring requires system time information returned
> along with the monitoring counter to verify the correctness of the
> counter value and to calculate the time elapsed between two samplings.
> 
> Add MSR_IA32_TSC to the read path and it returns scaled system time(ns)
> instead of raw timestamp to elimanate the needs to convert. The return
> time is obfuscated with booting random to eliminate the potential abuse
> of it. RESOURCE_ACCESS_MAX_ENTRIES is also increased to 3 so MSR_IA32_TSC
> can be used.

... together with an MSR write/read operation pair.

> @@ -133,10 +135,39 @@ static void resource_access(void *info)
>          switch ( entry->u.cmd )
>          {
>          case XEN_RESOURCE_OP_MSR_READ:
> -            ret = rdmsr_safe(entry->idx, entry->val);
> +            if ( unlikely(entry->idx == MSR_IA32_TSC) )
> +            {
> +                /* Return obfuscated scaled time instead of raw timestamp */
> +                entry->val = get_s_time_fixed(tsc) + boot_random;

I think obfuscating the low 32 bits is pretty pointless. I'd
rather see you use SECONDS(boot_random) here, or even
SECONDS(boot_random) [-+^] boot_random.

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