On Wed, Feb 15, 2023, Marc Zyngier wrote: > On Wed, 15 Feb 2023 01:16:11 +0000, Anish Moorthy <amoorthy@xxxxxxxxxx> wrote: > > 8. Other capabilities. > > ====================== > > > > diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h > > index 109b18e2789c4..9352e7f8480fb 100644 > > --- a/include/linux/kvm_host.h > > +++ b/include/linux/kvm_host.h > > @@ -801,6 +801,9 @@ struct kvm { > > bool vm_bugged; > > bool vm_dead; > > > > + rwlock_t mem_fault_nowait_lock; > > + bool mem_fault_nowait; > > A full-fat rwlock to protect a single bool? What benefits do you > expect from a rwlock? Why is it preferable to an atomic access, or a > simple bitop? There's no need to have any kind off dedicated atomicity. The only readers are in vCPU context, just disallow KVM_CAP_MEM_FAULT_NOWAIT after vCPUs are created.