On 06/06/2010 04:06 PM, Avi Kivity wrote:
When we call rmap_remove(), we (almost) always immediately follow it by an __set_spte() to a nonpresent pte. Since we need to perform the two operations atomically, to avoid losing the dirty and accessed bits, introduce a helper drop_spte() and convert all call sites. The operation is still nonatomic at this point. @@ -1498,13 +1502,14 @@ static void kvm_mmu_page_unlink_children(struct kvm *kvm, ent&= PT64_BASE_ADDR_MASK; mmu_page_remove_parent_pte(page_header(ent), &pt[i]); + pt[i] = shadow_trap_nonpresent_pte; } else { if (is_large_pte(ent)) --kvm->stat.lpages; - rmap_remove(kvm,&pt[i]); + drop_spte(kvm,&pt[i], + shadow_trap_nonpresent_pte); } } - pt[i] = shadow_trap_nonpresent_pte; } }
Autotest points out that this transformation (and an identical one in zap_pte) does not preserve the semantics; if the outer if () fails, the new code does not update pt[i].
With the original line after the if () retained, autotest is happier. -- error compiling committee.c: too many arguments to function -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html