[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250415200635.GA210309.vipinsh@google.com>
Date: Tue, 15 Apr 2025 13:06:35 -0700
From: Vipin Sharma <vipinsh@...gle.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 3/3] KVM: x86/mmu: Defer allocation of shadow MMU's
hashed page list
On 2025-04-01 08:57:14, Sean Christopherson wrote:
> +static __ro_after_init HLIST_HEAD(empty_page_hash);
> +
> +static struct hlist_head *kvm_get_mmu_page_hash(struct kvm *kvm, gfn_t gfn)
> +{
> + struct hlist_head *page_hash = READ_ONCE(kvm->arch.mmu_page_hash);
> +
> + if (!page_hash)
> + return &empty_page_hash;
> +
> + return &page_hash[kvm_page_table_hashfn(gfn)];
> +}
> +
>
> @@ -2357,6 +2368,7 @@ static struct kvm_mmu_page *__kvm_mmu_get_shadow_page(struct kvm *kvm,
> struct kvm_mmu_page *sp;
> bool created = false;
>
> + BUG_ON(!kvm->arch.mmu_page_hash);
> sp_list = &kvm->arch.mmu_page_hash[kvm_page_table_hashfn(gfn)];
Why do we need READ_ONCE() at kvm_get_mmu_page_hash() but not here? My
understanding is that it is in kvm_get_mmu_page_hash() to avoid compiler
doing any read tear. If yes, then the same condition is valid here,
isn't it?
Powered by blists - more mailing lists