lkml.org 
[lkml]   [2021]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3 8/8] KVM: x86/mmu: Lazily allocate memslot rmaps
From
Date
On 06/05/21 20:42, Ben Gardon wrote:
> + /*
> + * memslots_have_rmaps is set and read in different lock contexts,
> + * so protect it with smp_load/store.
> + */
> + smp_store_release(&kvm->arch.memslots_have_rmaps, true);

Shorter and better: /* write rmap pointers before memslots_have_rmaps */

> + mutex_unlock(&kvm->slots_arch_lock);
> + return 0;
> +}
> +
> bool kvm_memslots_have_rmaps(struct kvm *kvm)
> {
> - return kvm->arch.memslots_have_rmaps;
> + /*
> + * memslots_have_rmaps is set and read in different lock contexts,
> + * so protect it with smp_load/store.
> + */
> + return smp_load_acquire(&kvm->arch.memslots_have_rmaps);
> }
>

Likewise, /* read memslots_have_rmaps before the rmaps themselves */

Paolo

\
 
 \ /
  Last update: 2021-05-07 10:29    [W:0.190 / U:0.644 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site