[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f4189f26-eff9-9fd0-40a1-69ac7759dedf@redhat.com>
Date: Wed, 2 Mar 2022 19:20:13 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Christian Borntraeger <borntraeger@...ux.ibm.com>,
Janosch Frank <frankja@...ux.ibm.com>,
Claudio Imbrenda <imbrenda@...ux.ibm.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
David Hildenbrand <david@...hat.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, David Matlack <dmatlack@...gle.com>,
Ben Gardon <bgardon@...gle.com>,
Mingwei Zhang <mizhang@...gle.com>
Subject: Re: [PATCH v3 22/28] KVM: x86/mmu: Zap defunct roots via asynchronous
worker
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
Powered by blists - more mailing lists