xen/altp2m: set access_required properly for all altp2ms
PATCH v3 1/1 xen/altp2m: set access_required properly for all altp2ms
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.
---
Cc: Stefano Stabellini <[email protected]>
Cc: Julien Grall <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Tamas K Lengyel <[email protected]>
---
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(-)
xen/arch/arm/mem_access.c +6 -0
@@ -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
xen/arch/x86/mm/mem_access.c +20 -0
@@ -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
xen/arch/x86/mm/p2m.c +2 -1
@@ -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 ); }
xen/common/domctl.c +2 -2
@@ -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 ;
xen/include/xen/domain.h +2 -0
@@ -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 );
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 9 lines · Razvan Cojocaru
For the hostp2m,
access_requiredstarts off as 0, then it can be set withxc_domain_set_access_required(). However, all the altp2ms set it to 1 on init, and ignore both the hostp2m and the hypercall. This patch setsaccess_requiredto 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 <[email protected]>
LGTM
Quoted 125 lines
---
Cc: Stefano Stabellini <[email protected]>
Cc: Julien Grall <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Tamas K Lengyel <[email protected]>
---
Changes since V2:
- Renamedarch_domain_set_access_required()toarch_p2m_set_access_required()(requested by Wei Liu).
- Added ASSERT(atomic_read(&d->pause_count)) toarch_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(-)xen/arch/arm/mem_access.c +6
-0@@ -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 xen/arch/x86/mm/mem_access.c +20
-0@@ -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 xen/arch/x86/mm/p2m.c +2
-1@@ -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 ); }xen/common/domctl.c +2
-2@@ -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 ;xen/include/xen/domain.h +2
-1@@ -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 ); --
Quoted 1 line
2.7.4
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 10 lines · Tamas K Lengyel
Quoted 8 lines · Razvan Cojocaru
For the hostp2m,
access_requiredstarts off as 0, then it can be set withxc_domain_set_access_required(). However, all the altp2ms set it to 1 on init, and ignore both the hostp2m and the hypercall. This patch setsaccess_requiredto the value from the hostp2m on altp2m init, and propagates the values received via hypercall to all the active altp2ms, when applicable.
Quoted 5 lines
Quoted 1 line
Signed-off-by Razvan Cojocaru <[email protected]>LGTM
Acked-by Tamas K Lengyel <[email protected]>
Thanks Tamas!
Does the patch need additional action before it can go in (sorry for the noise if it only hasn't gone in because it at the back of the queue).
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 16.07.18 at 10:35, <[email protected]> wrote:
Quoted 12 lines · Tamas K Lengyel
Quoted 9 lines · Razvan Cojocaru
For the hostp2m,
access_requiredstarts off as 0, then it can be set withxc_domain_set_access_required(). However, all the altp2ms set it to 1 on init, and ignore both the hostp2m and the hypercall. This patch setsaccess_requiredto 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 <[email protected]>
Quoted 8 lines
Quoted 3 lines
LGTM
Acked-by Tamas K Lengyel <[email protected]>Thanks Tamas!
Does the patch need additional action before it can go in (sorry for the noise if it only hasn't gone in because it at the back of the queue).
Once again - George's ack is missing. Please remember that generally it's the submitter to chase ack-s, not reviewers or committers.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 18 lines · Jan Beulich
Quoted 18 lines
Quoted 1 line
Quoted 1 line · On 16.07.18 at 10:35, <[email protected]> wrote:
Quoted 15 lines · Tamas K Lengyel
Quoted 9 lines · Razvan Cojocaru
For the hostp2m,
access_requiredstarts off as 0, then it can be set withxc_domain_set_access_required(). However, all the altp2ms set it to 1 on init, and ignore both the hostp2m and the hypercall. This patch setsaccess_requiredto 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 <[email protected]>LGTM
Acked-by Tamas K Lengyel <[email protected]>
Quoted 7 lines
Quoted 4 lines
Thanks Tamas!
Does the patch need additional action before it can go in (sorry for the noise if it only hasn't gone in because it at the back of the queue).
Once again - George's ack is missing. Please remember that generally it's the submitter to chase ack-s, not reviewers or committers.
Do we need Julien's ack too?
-George
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Julien Grall
Acked-byHi,
Quoted 21 lines · George Dunlap
Quoted 20 lines · Jan Beulich
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 16.07.18 at 10:35, <[email protected]> wrote:
Quoted 10 lines · Tamas K Lengyel
Quoted 8 lines · Razvan Cojocaru
For the hostp2m,
access_requiredstarts off as 0, then it can be set withxc_domain_set_access_required(). However, all the altp2ms set it to 1 on init, and ignore both the hostp2m and the hypercall. This patch setsaccess_requiredto the value from the hostp2m on altp2m init, and propagates the values received via hypercall to all the active altp2ms, when applicable.Quoted 5 lines
Quoted 1 line
Signed-off-by Razvan Cojocaru <[email protected]>LGTM
Acked-by Tamas K Lengyel <[email protected]>Thanks Tamas!
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Does the patch need additional action before it can go in (sorry for the noise if it only hasn't gone in because it at the back of the queue).
Once again - George's ack is missing. Please remember that generally it's the submitter to chase ack-s, not reviewers or committers.
Do we need Julien's ack too?
Ravzan and Tamas are maintaining arm/mem_access.c. So Tamas's ack should be enough here. Just in case:
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 28 lines · Julien Grall
Hi,
Quoted 25 lines · George Dunlap
Quoted 24 lines · Jan Beulich
Quoted 23 lines
Quoted 1 line
Quoted 1 line · On 16.07.18 at 10:35, <[email protected]> wrote:
Quoted 10 lines · Tamas K Lengyel
Quoted 8 lines · Razvan Cojocaru
For the hostp2m,
access_requiredstarts off as 0, then it can be set withxc_domain_set_access_required(). However, all the altp2ms set it to 1 on init, and ignore both the hostp2m and the hypercall. This patch setsaccess_requiredto the value from the hostp2m on altp2m init, and propagates the values received via hypercall to all the active altp2ms, when applicable.Quoted 5 lines
Quoted 1 line
Signed-off-by Razvan Cojocaru <[email protected]>LGTM
Acked-by Tamas K Lengyel <[email protected]>Thanks Tamas!
Does the patch need additional action before it can go in (sorry for the
noise if it only hasn't gone in because it at the back of the queue).
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Once again - George's ack is missing. Please remember that generally it's the submitter to chase ack-s, not reviewers or committers.
Do we need Julien's ack too?
Ravzan and Tamas are maintaining
arm/mem_access.c. So Tamas's ack should be enough here.
Ah, got it.
Quoted 3 lines
Just in case:
Acked-by Julien Grall <[email protected]>
Thanks.
-G
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 8 lines · Razvan Cojocaru
For the hostp2m,
access_requiredstarts off as 0, then it can be set withxc_domain_set_access_required(). However, all the altp2ms set it to 1 on init, and ignore both the hostp2m and the hypercall. This patch setsaccess_requiredto 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 <[email protected]>
Quoted 117 lines
---
Cc: Stefano Stabellini <[email protected]>
Cc: Julien Grall <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Tamas K Lengyel <[email protected]>
---
Changes since V2:
- Renamedarch_domain_set_access_required()toarch_p2m_set_access_required()(requested by Wei Liu).
- Added ASSERT(atomic_read(&d->pause_count)) toarch_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(-)xen/arch/arm/mem_access.c +6
-0@@ -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 xen/arch/x86/mm/mem_access.c +20
-0@@ -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 xen/arch/x86/mm/p2m.c +2
-1@@ -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 ); }xen/common/domctl.c +2
-2@@ -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 ;xen/include/xen/domain.h +0
-0
xen/include/xen/domain.h void arch_domain_unpause(struct domain *d); · line 73
Quoted 8 lines
xen/include/xen/domain.h +2
-0@@ -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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel