debuggers.hg
changeset 22790:b01ef59c8c80
x86/mm: fix EPT PoD locking to match the normal p2m case.
This recursive-locking bug was fixed in the main p2m code in
20269:fd3d5d66c446 (in October 2009) but has lurked unseen in
the EPT side since then. Copy the fix across.
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
This recursive-locking bug was fixed in the main p2m code in
20269:fd3d5d66c446 (in October 2009) but has lurked unseen in
the EPT side since then. Copy the fix across.
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
author | Tim Deegan <Tim.Deegan@citrix.com> |
---|---|
date | Thu Jan 13 15:46:13 2011 +0000 (2011-01-13) |
parents | 54e91dcae649 |
children | 32b7a4f2d399 |
files | xen/arch/x86/mm/hap/p2m-ept.c |
line diff
1.1 --- a/xen/arch/x86/mm/hap/p2m-ept.c Thu Jan 13 15:38:48 2011 +0000 1.2 +++ b/xen/arch/x86/mm/hap/p2m-ept.c Thu Jan 13 15:46:13 2011 +0000 1.3 @@ -45,19 +45,26 @@ static int ept_pod_check_and_populate(st 1.4 ept_entry_t *entry, int order, 1.5 p2m_query_t q) 1.6 { 1.7 + /* Only take the lock if we don't already have it. Otherwise it 1.8 + * wouldn't be safe to do p2m lookups with the p2m lock held */ 1.9 + int do_locking = !p2m_locked_by_me(p2m); 1.10 int r; 1.11 - p2m_lock(p2m); 1.12 + 1.13 + if ( do_locking ) 1.14 + p2m_lock(p2m); 1.15 1.16 /* Check to make sure this is still PoD */ 1.17 if ( entry->sa_p2mt != p2m_populate_on_demand ) 1.18 { 1.19 - p2m_unlock(p2m); 1.20 + if ( do_locking ) 1.21 + p2m_unlock(p2m); 1.22 return 0; 1.23 } 1.24 1.25 r = p2m_pod_demand_populate(p2m, gfn, order, q); 1.26 1.27 - p2m_unlock(p2m); 1.28 + if ( do_locking ) 1.29 + p2m_unlock(p2m); 1.30 1.31 return r; 1.32 }