- I thought of a different approach to write protection: write protectIt is very a good approach and it is blazing fast.
the L4 sptes, on write fault add write permission to the L4 spte and
write protect the L3 sptes that it points to, etc. This method can use
the slot bitmap to reduce the number of write faults. However we can
reintroduce the slot bitmap if/when we use the method, this shouldn't
block the patch.
I have no time to implement it currently,
could you update it into the TODO list?
Atomic operation is too expensive, I retained the comment "/* avoid RMW */"+static void rmapp_remove_write_access(struct kvm *kvm, unsigned longMust use an atomic operation here to avoid losing dirty or accessed bit.
*rmapp)
+{
+ u64 *spte = rmap_next(kvm, rmapp, NULL);
+
+ while (spte) {
+ /* avoid RMW */
+ if (is_writable_pte(*spte))
+ *spte&= ~PT_WRITABLE_MASK;
and wait someone take a good approach for it.