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

Re: [Xen-devel] [PATCH 5/5] xen: clean up VPF flags macros



>>> On 25.09.15 at 13:54, <JGross@xxxxxxxx> wrote:
> Per-VCPU pause flags in sched.h are defined as bit positions and as
> values derived from the bit defines. There is only one user of a value
> which can be easily converted to use a bit number as well.

I'm not convinced:

> --- a/xen/common/domctl.c
> +++ b/xen/common/domctl.c
> @@ -172,7 +172,7 @@ void getdomaininfo(struct domain *d, struct 
> xen_domctl_getdomaininfo *info)
>          info->max_vcpu_id = v->vcpu_id;
>          if ( !test_bit(_VPF_down, &v->pause_flags) )
>          {
> -            if ( !(v->pause_flags & VPF_blocked) )
> +            if ( !test_bit(_VPF_blocked, &v->pause_flags) )

test_bit() is quite a bit more complex an operation than a simple &,
and with (on x86) even constant_test_bit() involving a cast to
a pointer to volatile I'm afraid we can't even hope that compilers
would produce identical code for both in cases like this one (as that
casts limits freedom of the compiler). IOW I'd rather see other
test_bit(_VPF_...) uses converted the inverse way (which as a nice
but minor side effect would yield slightly smaller source code).

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