+ */
+ if (!refcount_read(&kvm->users_count)) {
+ kvm_mmu_zap_all(kvm);
+ return;
+ }
I'd prefer we make this an assertion and shove this logic to set_nx_huge_pages(),
because in that case there's no need to zap anything, the guest can never run
again. E.g. (I'm trying to remember why I didn't do this before...)
One thing that keeps tripping me up is the "readers" verbiage. I get confused
because taking mmu_lock for read vs. write doesn't really have anything to do with
reading or writing state, e.g. "readers" still write SPTEs, and so I keep thinking
"readers" means anything iterating over the set of roots. Not sure if there's a
shorthand that won't be confusing.
It passes a smoke test, and also resolves the debate on the fate of patch 1.+1000, I love this approach. Do you want me to work on a v3, or shall I let you
have the honors?