[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen stable-4.6] xen/arm: p2m: Release the p2m lock before undoing the mappings
commit 1e3e9447460037d125014fe4eb5b3172b130663c Author: Julien Grall <julien.grall@xxxxxxx> AuthorDate: Fri May 20 14:37:42 2016 +0100 Commit: Stefano Stabellini <sstabellini@xxxxxxxxxx> CommitDate: Sat May 21 16:21:32 2016 +0100 xen/arm: p2m: Release the p2m lock before undoing the mappings Since commit 4b25423a "arch/arm: unmap partially-mapped memory regions", Xen has been undoing the P2M mappings when an error occurred during insertion or memory allocation. This is done by calling recursively apply_p2m_changes, however the second call is done with the p2m lock taken which will result in a deadlock for the current processor. The p2m lock is here to protect 2 threads modifying concurrently the page tables. However, it does not guarantee the ordering of the changes. I.e if 2 threads request change on regions that overlaps, then the result is undefined. Therefore it is fine to move the recursive call to undo the changes after the lock is released. Signed-off-by: Julien Grall <julien.grall@xxxxxxx> Reviewed-by: Wei Chen <Wei.Chen@xxxxxxx> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx> Tested-by: Wei Chen <Wei.Chen@xxxxxxx> --- xen/arch/arm/p2m.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index ecc6153..a4a08f6 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1105,6 +1105,14 @@ tlbflush: out: + for ( level = P2M_ROOT_LEVEL; level < 4; level ++ ) + { + if ( mappings[level] ) + unmap_domain_page(mappings[level]); + } + + spin_unlock(&p2m->lock); + if ( rc < 0 && ( op == INSERT || op == ALLOCATE ) && addr != start_gpaddr ) { @@ -1117,14 +1125,6 @@ out: mattr, 0, p2m_invalid, d->arch.p2m.default_access); } - for ( level = P2M_ROOT_LEVEL; level < 4; level ++ ) - { - if ( mappings[level] ) - unmap_domain_page(mappings[level]); - } - - spin_unlock(&p2m->lock); - return rc; } -- generated by git-patchbot for /home/xen/git/xen.git#stable-4.6 _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |