[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aCsz_wF7g1gku3GU@google.com>
Date: Mon, 19 May 2025 06:37:03 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Vipin Sharma <vipinsh@...gle.com>
Subject: Re: [PATCH v3 3/3] KVM: x86/mmu: Defer allocation of shadow MMU's
hashed page list
On Sat, May 17, 2025, Paolo Bonzini wrote:
> On 5/16/25 23:54, Sean Christopherson wrote:
> > + /*
> > + * Write mmu_page_hash exactly once as there may be concurrent readers,
> > + * e.g. to check for shadowed PTEs in mmu_try_to_unsync_pages(). Note,
> > + * mmu_lock must be held for write to add (or remove) shadow pages, and
> > + * so readers are guaranteed to see an empty list for their current
> > + * mmu_lock critical section.
> > + */
> > + WRITE_ONCE(kvm->arch.mmu_page_hash, h);
>
> Use smp_store_release here (unlike READ_ONCE(), it's technically incorrect
> to use WRITE_ONCE() here!),
Can you elaborate why? Due to my x86-centric life, my memory ordering knowledge
is woefully inadequate.
> with a remark that it pairs with kvm_get_mmu_page_hash(). That's both more
> accurate and leads to a better comment than "write exactly once".
Powered by blists - more mailing lists