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

Re: [Xen-devel] [PATCH] x86: re-order struct arch_domain fields



On 19/01/15 15:41, Jan Beulich wrote:
> ... to reduce padding holes. While doing this I noticed vtsc_usercount
> is a PV-only thing, so it gets moved straight to struct pv_domain.

The vtsc_{user,kernel}count split is curious.  They are both for stats
purposes alone, but there is nothing pv specific about the usercount. 
It frankly looks as if it has been mis-implemented for HVM, despite the
split appearing to be deliberate when it was introduced in c/s
bf2c44f8b469.  I am really not sure what to make of it.

>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>
> --- a/xen/arch/x86/time.c
> +++ b/xen/arch/x86/time.c
> @@ -1767,7 +1767,7 @@ void pv_soft_rdtsc(struct vcpu *v, struc
>      if ( guest_kernel_mode(v, regs) )
>          d->arch.vtsc_kerncount++;
>      else
> -        d->arch.vtsc_usercount++;
> +        d->arch.pv_domain.vtsc_usercount++;
>  
>      if ( (int64_t)(now - d->arch.vtsc_last) > 0 )
>          d->arch.vtsc_last = now;
> @@ -2020,17 +2020,15 @@ static void dump_softtsc(unsigned char k
>              printk(",khz=%"PRIu32, d->arch.tsc_khz);
>          if ( d->arch.incarnation )
>              printk(",inc=%"PRIu32, d->arch.incarnation);
> -        if ( !(d->arch.vtsc_kerncount | d->arch.vtsc_usercount) )
> -        {
> -            printk("\n");
> -            continue;
> -        }
> -        if ( is_hvm_domain(d) )
> +        if ( is_hvm_domain(d) && d->arch.vtsc_kerncount )
>              printk(",vtsc count: %"PRIu64" total\n",
>                     d->arch.vtsc_kerncount);
> -        else
> +        else if ( is_pv_domain(d) &&
> +                  (d->arch.vtsc_kerncount | 
> d->arch.pv_domain.vtsc_usercount) )

I realise you are simply rearanging the logic from before, but this
should really be a logic or rather than a bitwise or, and is probably
worth tweaking with the movement.

~Andrew


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