While the comment validly says "Sort by domain, if same domain by gfn", the implementation also included equal domain IDs in the first part of the check, thus rending the second part entirely dead and leaving deadlock potential when there's only a single domain involved.
Signed-off-by: Jan Beulich <[email protected]> --- a/xen/include/asm-x86/p2m.h +++ b/xen/include/asm-x86/p2m.h @@ -587,7 +587,7 @@ do { dest ## _t = (source ## t) ?: &scratch_t; \ } while (0) - if ( (rd->domain_id <= ld->domain_id) || + if ( (rd->domain_id < ld->domain_id) || ((rd == ld) && (gfn_x(rgfn) <= gfn_x(lgfn))) ) { assign_pointers(first, r);
