Re: [RFC PATCH 10/16] RISC-V: KVM: Implement VMID allocator

2019-07-30 Thread Paolo Bonzini
On 29/07/19 13:57, Anup Patel wrote: > + /* First user of a new VMID version? */ > + if (unlikely(vmid_next == 0)) { > + atomic_long_inc(&vmid_version); > + vmid_next = 1; > + vmid_version is only written under vmid_lock, so it doesn't need to be atomic. You only n

[RFC PATCH 10/16] RISC-V: KVM: Implement VMID allocator

2019-07-29 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 S