Re: [PATCH v3 11/19] RISC-V: KVM: Implement VMID allocator

2019-08-06 Thread Anup Patel
On Mon, Aug 5, 2019 at 7:13 PM Anup Patel wrote: > > We implement a simple VMID allocator for Guests/VMs which: > 1. Detects number of VMID bits at boot-time > 2. Uses atomic number to track VMID version and increments >VMID version whenever we run-out of VMIDs > 3. Flushes Guest TLBs on all

Re: [PATCH v3 11/19] RISC-V: KVM: Implement VMID allocator

2019-08-05 Thread Anup Patel
On Mon, Aug 5, 2019 at 9:33 PM Paolo Bonzini wrote: > > On 05/08/19 15:43, Anup Patel wrote: > > + spin_lock(_lock); > > + > > + /* > > + * We need to re-check the vmid_version here to ensure that if > > + * another vcpu already allocated a valid vmid for this vm. > > + */

Re: [PATCH v3 11/19] RISC-V: KVM: Implement VMID allocator

2019-08-05 Thread Paolo Bonzini
On 05/08/19 15:43, Anup Patel wrote: > + spin_lock(_lock); > + > + /* > + * We need to re-check the vmid_version here to ensure that if > + * another vcpu already allocated a valid vmid for this vm. > + */ > + if (!kvm_riscv_stage2_vmid_ver_changed(vmid)) { > +

[PATCH v3 11/19] RISC-V: KVM: Implement VMID allocator

2019-08-05 Thread Anup Patel
We implement a simple VMID allocator for Guests/VMs which: 1. Detects number of VMID bits at boot-time 2. Uses atomic number to track VMID version and increments VMID version whenever we run-out of VMIDs 3. Flushes Guest TLBs on all host CPUs whenever we run-out of VMIDs 4. Force updates HW