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

Re: [Xen-devel] [PATCH] x86/shim: Short circuit control/hardware checks in PV_SHIM_EXCLUSIVE builds



On 03.01.2020 21:07, Andrew Cooper wrote:
> --- a/xen/include/xen/sched.h
> +++ b/xen/include/xen/sched.h
> @@ -963,10 +963,22 @@ void watchdog_domain_destroy(struct domain *d);
>   *    (that is, this would not be suitable for a driver domain)
>   *  - There is never a reason to deny the hardware domain access to this
>   */
> -#define is_hardware_domain(_d) evaluate_nospec((_d) == hardware_domain)
> +static always_inline bool is_hardware_domain(const struct domain *d)
> +{
> +    if ( IS_ENABLED(CONFIG_PV_SHIM_EXCLUSIVE) )
> +        return false;
> +
> +    return evaluate_nospec(d == hardware_domain);
> +}
>  
>  /* This check is for functionality specific to a control domain */
> -#define is_control_domain(_d) evaluate_nospec((_d)->is_privileged)
> +static always_inline bool is_control_domain(const struct domain *d)
> +{
> +    if ( IS_ENABLED(CONFIG_PV_SHIM_EXCLUSIVE) )
> +        return false;
> +
> +    return evaluate_nospec(d->is_privileged);
> +}

Besides its intended purpose this also fixes (but only for the
shim-exclusive case) an interaction issue with LATE_HWDOM: If in
shim mode the "hardware_dom=1" command line option was used,
misbehavior would result afaict. Therefore I think this wants
amending with adjustments to also make the !PV_SHIM_EXCLUSIVE
case work correctly (read: ignore that command line option). I
guess additionally LATE_HWDOM should also depend on
!PV_SHIM_EXCLUSIVE (and/or vice versa).

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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