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

Re: [PATCH] x86/shadow: replace stale literal numbers in hash_{vcpu,domain}_foreach()



On 25.01.2021 12:07, Jan Beulich wrote:
> --- a/xen/arch/x86/mm/shadow/common.c
> +++ b/xen/arch/x86/mm/shadow/common.c
> @@ -1623,6 +1623,9 @@ void shadow_hash_delete(struct domain *d
>  typedef int (*hash_vcpu_callback_t)(struct vcpu *v, mfn_t smfn, mfn_t 
> other_mfn);
>  typedef int (*hash_domain_callback_t)(struct domain *d, mfn_t smfn, mfn_t 
> other_mfn);
>  
> +#define HASH_CALLBACKS_CHECK(mask) \
> +    BUILD_BUG_ON((mask) > (1U << ARRAY_SIZE(callbacks)) - 1)

Sadly at least with Clang5 this doesn't work for some of the uses
further down, e.g. ...

> @@ -2009,6 +2012,7 @@ int sh_remove_write_access(struct domain
>          perfc_incr(shadow_writeable_bf_1);
>      else
>          perfc_incr(shadow_writeable_bf);
> +    HASH_CALLBACKS_CHECK(callback_mask);

... this one. I've made it

#ifndef __clang__ /* At least some versions dislike some of the uses. */
#define HASH_CALLBACKS_CHECK(mask) \
    BUILD_BUG_ON((mask) > (1U << ARRAY_SIZE(callbacks)) - 1)
#else
#define HASH_CALLBACKS_CHECK(mask) ((void)(mask))
#endif

for the time being - if anyone has any better idea, I'll be
happy to take suggestions.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.