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

Re: [Xen-devel] [PATCH] xen/altp2m: set access_required properly for all altp2ms



>>> On 11.06.18 at 17:12, <rcojocaru@xxxxxxxxxxxxxxx> wrote:
> --- a/xen/arch/x86/domain.c
> +++ b/xen/arch/x86/domain.c
> @@ -38,6 +38,7 @@
>  #include <xen/livepatch.h>
>  #include <public/sysctl.h>
>  #include <public/hvm/hvm_vcpu.h>
> +#include <asm/altp2m.h>

Not the least to avoid this I think ...

> @@ -719,6 +720,22 @@ int arch_domain_soft_reset(struct domain *d)
>      return ret;
>  }
>  
> +void arch_domain_set_access_required(struct domain *d, bool access_required)

... this belongs somewhere in x86/mm/.

> +{
> +    unsigned int i;
> +
> +    if ( !altp2m_active(d) )
> +         return;

Hard tab.

> +    for ( i = 0; i < MAX_ALTP2M; i++ )
> +    {
> +        if ( d->arch.altp2m_eptp[i] == mfn_x(INVALID_MFN) )
> +            continue;

Yet another EPT-specific check outside of EPT code. Why can't you
check the pointer you use ...

> +        d->arch.altp2m_p2m[i]->access_required = access_required;

... here against NULL, and otherwise do the store irrespective
of the value of d->arch.altp2m_eptp[i]?

> @@ -210,7 +211,7 @@ static int p2m_init_altp2m(struct domain *d)
>              return -ENOMEM;
>          }
>          p2m->p2m_class = p2m_alternate;
> -        p2m->access_required = 1;
> +        p2m->access_required = hostp2m->access_required;

There must have been a reason to have it start out as 1. You
mention the fact in the description, but not why it is okay (or
even necessary) to change it.

> --- a/xen/common/domctl.c
> +++ b/xen/common/domctl.c
> @@ -1094,6 +1094,8 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) 
> u_domctl)
>              domain_pause(d);
>              p2m_get_hostp2m(d)->access_required =
>                  op->u.access_required.access_required;
> +            arch_domain_set_access_required(d,
> +                op->u.access_required.access_required);

Perhaps the setting of the host p2m field should move into that
function as well?

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