Messages in this thread | | | Date | Wed, 2 Mar 2022 19:20:13 +0100 | Subject | Re: [PATCH v3 22/28] KVM: x86/mmu: Zap defunct roots via asynchronous worker | From | Paolo Bonzini <> |
| |
On 3/2/22 19:01, Sean Christopherson wrote: >> + */ >> + 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...)
I did it this way because it seemed like a reasonable fallback for any present or future caller.
> 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.
Not that I know of. You really need to know that the rwlock is been used for its shared/exclusive locking behavior. But even on ther OSes use shared/exclusive instead of read/write, there are no analogous nouns and people end up using readers/writers anyway.
>> 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?
I'm already running the usual battery of tests, so I should be able to post it either tomorrow (early in my evening) or Friday morning.
Paolo
| |