Re: [Patch v4 16/18] KVM: x86/mmu: Allocate numa aware page tables during page fault

From: Vipin Sharma
Date: Mon Apr 03 2023 - 18:51:46 EST


On Tue, Mar 28, 2023 at 5:21 PM David Matlack <dmatlack@xxxxxxxxxx> wrote:
>
> On Mon, Mar 06, 2023 at 02:41:25PM -0800, Vipin Sharma wrote:
> > + r = mmu_topup_sp_memory_cache(&vcpu->arch.mmu_shadow_page_cache[nid],
> > + PT64_ROOT_MAX_LEVEL);
>
> This ignores the return value of mmu_topup_sp_memory_cache() for all but
> the last node.
>

Yeah, I will change it to exit the function on the first error.

> > static int mmu_memory_cache_try_empty(struct kvm_mmu_memory_cache *cache,
>
> nit: s/cache/caches/
>

Okay.

> > - struct mutex *cache_lock)
> > + int cache_count, struct mutex *cache_lock)
>
> nit: s/cache_count/nr_caches/

Okay.

>
> > {
> > - int freed = 0;
> > + int freed = 0, nid;
>
> nit: s/nid/i/
>
> (nothing in this function knows about NUMA so "nid" is an odd name here)

Okay.

> > +static inline bool kvm_numa_aware_page_table_enabled(struct kvm *kvm)
> > +{
> > + return kvm->arch.numa_aware_page_table;
>
> No need for this helper function. Accessing the variable directly makes
> lines shorter, does not introduce any code duplication, and reduces
> abstraction.
>

Okay.