[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH RFC] x86/sysctl: Implement XEN_SYSCTL_get_cpuid_policy
>>> Andrew Cooper <andrew.cooper3@xxxxxxxxxx> 08/03/17 6:01 PM >>> >On 03/08/17 16:51, Jan Beulich wrote: >>>>> Andrew Cooper <andrew.cooper3@xxxxxxxxxx> 07/27/17 7:48 PM >>> >>> +#define COPY_LEAF(l, s, data) \ >>> + ({ int ret; /* Elide leaves which are fully empty. */ \ >>> + if ( (*(uint64_t *)(&(data)->a) | \ >>> + *(uint64_t *)(&(data)->c)) && \ >> This sort of casting looks rather fragile. > >I've already factored it out into: > >static bool is_empty_leaf(const struct cpuid_leaf *l) >{ >/* >* Logically '!(l->a | l->b | l->c | l->d)' but the compiler needs some >* help realising that its actually looking for 16 bytes of adjacent >* zeros, and can be far more efficient than using 32bit operations. >*/ >return !(*(uint64_t *)&l->a | *(uint64_t *)&l->c); >} Better, but I'd still like to ask for BUILD_BUG_ON()s to be added. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |