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

Re: [Xen-devel] [PATCH v4 12/27] x86/traps: move guest_has_trap_callback to pv/traps.c



On 08/06/17 18:11, Wei Liu wrote:
> diff --git a/xen/include/asm-x86/traps.h b/xen/include/asm-x86/traps.h
> index f1d2513e6b..26625ce5a6 100644
> --- a/xen/include/asm-x86/traps.h
> +++ b/xen/include/asm-x86/traps.h
> @@ -32,10 +32,10 @@ void async_exception_cleanup(struct vcpu *);
>  /**
>   * guest_has_trap_callback
>   *
> - * returns true (non-zero) if guest registered a trap handler
> + * returns true if guest registered a trap handler
>   */
> -extern int guest_has_trap_callback(struct domain *d, uint16_t vcpuid,
> -                             unsigned int trap_nr);
> +bool guest_has_trap_callback(const struct domain *d, unsigned int vcpuid,
> +                             unsigned int trap_nr);

IMO, It would be better to reduce this to:

static inline bool pv_callback_registered(const struct vcpu *v, uint8_t
vector)
{
    return v->arch.pv_vcpu.trap_ctxt[vector].address;
}

and adjust its single caller to match.  inject_vmce() already has a
struct vcpu in its hand at the call point, so we can loose all the range
checking.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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