[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xen-devel] [PATCH V3] xen/altp2m: set access_required properly for all altp2ms
- To: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxx>
- From: George Dunlap <george.dunlap@xxxxxxxxxx>
- Date: Mon, 23 Jul 2018 12:35:35 +0100
- Autocrypt: addr=george.dunlap@xxxxxxxxxx; prefer-encrypt=mutual; keydata= xsFNBFPqG+MBEACwPYTQpHepyshcufo0dVmqxDo917iWPslB8lauFxVf4WZtGvQSsKStHJSj 92Qkxp4CH2DwudI8qpVbnWCXsZxodDWac9c3PordLwz5/XL41LevEoM3NWRm5TNgJ3ckPA+J K5OfSK04QtmwSHFP3G/SXDJpGs+oDJgASta2AOl9vPV+t3xG6xyfa2NMGn9wmEvvVMD44Z7R W3RhZPn/NEZ5gaJhIUMgTChGwwWDOX0YPY19vcy5fT4bTIxvoZsLOkLSGoZb/jHIzkAAznug Q7PPeZJ1kXpbW9EHHaUHiCD9C87dMyty0N3TmWfp0VvBCaw32yFtM9jUgB7UVneoZUMUKeHA fgIXhJ7I7JFmw3J0PjGLxCLHf2Q5JOD8jeEXpdxugqF7B/fWYYmyIgwKutiGZeoPhl9c/7RE Bf6f9Qv4AtQoJwtLw6+5pDXsTD5q/GwhPjt7ohF7aQZTMMHhZuS52/izKhDzIufl6uiqUBge 0lqG+/ViLKwCkxHDREuSUTtfjRc9/AoAt2V2HOfgKORSCjFC1eI0+8UMxlfdq2z1AAchinU0 eSkRpX2An3CPEjgGFmu2Je4a/R/Kd6nGU8AFaE8ta0oq5BSFDRYdcKchw4TSxetkG6iUtqOO ZFS7VAdF00eqFJNQpi6IUQryhnrOByw+zSobqlOPUO7XC5fjnwARAQABzSRHZW9yZ2UgVy4g RHVubGFwIDxkdW5sYXBnQHVtaWNoLmVkdT7CwYAEEwEKACoCGwMFCwkIBwMFFQoJCAsFFgID AQACHgECF4ACGQEFAlpk2IEFCQo9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U+J/RLywUiaLuHnXt40WvQ98kHm7uTsy36iWqqawPqzmn8m5ruynVHmmcXsLBZQQY AQoADwIbDAUCWmTXMwUJB+tP9gAKCRCmNjwxBZC0bb+2D/9hjn1k5WcRHlu19WGuH6q0Kgm1 LRT7PnnSz904igHNElMB5a7wRjw5kdNwU3sRm2nnmHeOJH8kYj2Hn1QgX5SqQsysWTHWOEse GeoXydx9zZZkt3oQJM+9NV1VjK0bOXwqhiQyEUWz5/9l467FS/k4FJ5CHNRumvhLa0l2HEEu 5pxq463HQZHDt4YE/9Y74eXOnYCB4nrYxQD/GSXEZvWryEWreDoaFqzq1TKtzHhFgQG7yFUE epxLRUUtYsEpT6Rks2l4LCqG3hVD0URFIiTyuxJx3VC2Ta4LH3hxQtiaIpuXqq2D4z63h6vC x2wxfZc/WRHGbr4NAlB81l35Q/UHyMocVuYLj0llF0rwU4AjiKZ5qWNSEdvEpL43fTvZYxQh DCjQTKbb38omu5P4kOf1HT7s+kmQKRtiLBlqHzK17D4K/180ADw7a3gnmr5RumcZP3NGSSZA 6jP5vNqQpNu4gqrPFWNQKQcW8HBiYFgq6SoLQQWbRxJDHvTRYJ2ms7oCe870gh4D1wFFqTLe yXiVqjddENGNaP8ZlCDw6EU82N8Bn5LXKjR1GWo2UK3CjrkHpTt3YYZvrhS2MO2EYEcWjyu6 LALF/lS6z6LKeQZ+t9AdQUcILlrx9IxqXv6GvAoBLJY1jjGBq+/kRPrWXpoaQn7FXWGfMqU+ NkY9enyrlw==
- Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wei.liu2@xxxxxxxxxx>, George Dunlap <George.Dunlap@xxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Ian Jackson <ian.jackson@xxxxxxxxxxxxx>, Tim Deegan <tim@xxxxxxx>, Julien Grall <julien.grall@xxxxxxx>, Tamas K Lengyel <tamas@xxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
- Delivery-date: Mon, 23 Jul 2018 11:35:42 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Openpgp: preference=signencrypt
On 06/28/2018 08:54 AM, Razvan Cojocaru wrote:
> For the hostp2m, access_required starts off as 0, then it can be
> set with xc_domain_set_access_required(). However, all the altp2ms
> set it to 1 on init, and ignore both the hostp2m and the hypercall.
> This patch sets access_required to the value from the hostp2m
> on altp2m init, and propagates the values received via hypercall
> to all the active altp2ms, when applicable.
>
> Signed-off-by: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>
Reviewed-by: George Dunlap <george.dunlap@xxxxxxxxxx>
>
> ---
> Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
> Cc: Julien Grall <julien.grall@xxxxxxx>
> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Cc: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> Cc: Jan Beulich <jbeulich@xxxxxxxx>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
> Cc: Tim Deegan <tim@xxxxxxx>
> Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
> Cc: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
> Cc: Tamas K Lengyel <tamas@xxxxxxxxxxxxx>
> ---
> Changes since V2:
> - Renamed arch_domain_set_access_required() to
> arch_p2m_set_access_required() (requested by Wei Liu).
> - Added ASSERT(atomic_read(&d->pause_count)) to
> arch_p2m_set_access_required() (requested by Wei Liu).
> ---
> xen/arch/arm/mem_access.c | 6 ++++++
> xen/arch/x86/mm/mem_access.c | 20 ++++++++++++++++++++
> xen/arch/x86/mm/p2m.c | 3 ++-
> xen/common/domctl.c | 4 ++--
> xen/include/xen/domain.h | 2 ++
> 5 files changed, 32 insertions(+), 3 deletions(-)
>
> diff --git a/xen/arch/arm/mem_access.c b/xen/arch/arm/mem_access.c
> index ae2686f..ba4ec78 100644
> --- a/xen/arch/arm/mem_access.c
> +++ b/xen/arch/arm/mem_access.c
> @@ -453,6 +453,12 @@ int p2m_get_mem_access(struct domain *d, gfn_t gfn,
> return ret;
> }
>
> +void arch_p2m_set_access_required(struct domain *d, bool access_required)
> +{
> + ASSERT(atomic_read(&d->pause_count));
> + p2m_get_hostp2m(d)->access_required = access_required;
> +}
> +
> /*
> * Local variables:
> * mode: C
> diff --git a/xen/arch/x86/mm/mem_access.c b/xen/arch/x86/mm/mem_access.c
> index c0cd017..464be49 100644
> --- a/xen/arch/x86/mm/mem_access.c
> +++ b/xen/arch/x86/mm/mem_access.c
> @@ -465,6 +465,26 @@ int p2m_get_mem_access(struct domain *d, gfn_t gfn,
> xenmem_access_t *access)
> return _p2m_get_mem_access(p2m, gfn, access);
> }
>
> +void arch_p2m_set_access_required(struct domain *d, bool access_required)
> +{
> + unsigned int i;
> +
> + ASSERT(atomic_read(&d->pause_count));
> +
> + p2m_get_hostp2m(d)->access_required = access_required;
> +
> + if ( !altp2m_active(d) )
> + return;
> +
> + for ( i = 0; i < MAX_ALTP2M; i++ )
> + {
> + struct p2m_domain *p2m = d->arch.altp2m_p2m[i];
> +
> + if ( p2m )
> + p2m->access_required = access_required;
> + }
> +}
> +
> /*
> * Local variables:
> * mode: C
> diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
> index c53cab4..8e9fbb5 100644
> --- a/xen/arch/x86/mm/p2m.c
> +++ b/xen/arch/x86/mm/p2m.c
> @@ -199,6 +199,7 @@ static int p2m_init_altp2m(struct domain *d)
> {
> unsigned int i;
> struct p2m_domain *p2m;
> + struct p2m_domain *hostp2m = p2m_get_hostp2m(d);
>
> mm_lock_init(&d->arch.altp2m_list_lock);
> for ( i = 0; i < MAX_ALTP2M; 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;
> _atomic_set(&p2m->active_vcpus, 0);
> }
>
> diff --git a/xen/common/domctl.c b/xen/common/domctl.c
> index 9b7bc08..789b30d 100644
> --- a/xen/common/domctl.c
> +++ b/xen/common/domctl.c
> @@ -1092,8 +1092,8 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t)
> u_domctl)
> else
> {
> domain_pause(d);
> - p2m_get_hostp2m(d)->access_required =
> - op->u.access_required.access_required;
> + arch_p2m_set_access_required(d,
> + op->u.access_required.access_required);
> domain_unpause(d);
> }
> break;
> diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h
> index 177cb35..f35e360 100644
> --- a/xen/include/xen/domain.h
> +++ b/xen/include/xen/domain.h
> @@ -66,6 +66,8 @@ void arch_domain_unpause(struct domain *d);
>
> int arch_domain_soft_reset(struct domain *d);
>
> +void arch_p2m_set_access_required(struct domain *d, bool access_required);
> +
> int arch_set_info_guest(struct vcpu *, vcpu_guest_context_u);
> void arch_get_info_guest(struct vcpu *, vcpu_guest_context_u);
>
>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|