From: Marc Zyngier <marc.zyngier@arm.com>
To: Mark Rutland <mark.rutland@arm.com>,
Shannon Zhao <zhaoshenglong@huawei.com>
Cc: kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH] KVM: ARM: updtae the VMID generation logic
Date: Thu, 29 Mar 2018 17:48:19 +0100 [thread overview]
Message-ID: <861sg2su98.wl-marc.zyngier@arm.com> (raw)
In-Reply-To: <20180329152758.za6ppojjiw6ea52u@lakrids.cambridge.arm.com>
On Thu, 29 Mar 2018 16:27:58 +0100,
Mark Rutland wrote:
>
> On Thu, Mar 29, 2018 at 11:00:24PM +0800, Shannon Zhao wrote:
> > From: zhaoshenglong <zhaoshenglong@huawei.com>
> >
> > Currently the VMID for some VM is allocated during VCPU entry/exit
> > context and will be updated when kvm_next_vmid inversion. So this will
> > cause the existing VMs exiting from guest and flush the tlb and icache.
> >
> > Also, while a platform with 8 bit VMID supports 255 VMs, it can create
> > more than 255 VMs and if we create e.g. 256 VMs, some VMs will occur
> > page fault since at some moment two VMs have same VMID.
>
> Have you seen this happen?
>
> I beleive that update_vttbr() should prevent this. We intialize
> kvm_vmid_gen to 1, and when we init a VM, we set its vmid_gen to 0. So
> the first time a VM is scheduled, update_vttbr() will allocate a VMID,
> and by construction we shouldn't be able to allocate the same VMID to
> multiple active VMs, regardless of whether we overflow several
> times.
I remember testing that exact scenario when we implemented the VMID
rollover a (long) while back. Maybe we've introduced a regression, but
we're supposed to support 255 VMs running at the same time (which is
not the same as having 255 VMs in total).
Shannon: if you have observed such regression, please let us know.
>
> > This patch uses the bitmap to record which VMID used and available.
> > Initialize the VMID and vttbr during creating the VM instead of VCPU
> > entry/exit context. Also it will return error to user space if it wants
> > to create VMs more than the supporting number.
>
> This creates a functional regression for anyone creating a large number
> of VMs.
Indeed, and I'm not buys that approach at all. As I said above, the
intent is that we can have up to 2^VMID_SIZE-1 VMs running at the same
time, and *any* number of VMs in the system.
> If VMID overflow is a real bottleneck, it would be vastly better to
> improve the VMID allocator along the lines of the arm64 ASID allocator,
> so that upon overflow we reserve the set of active VMIDs (and therefore
> avoid expensive TLB + icache maintenance). That does not require a
> global limit on the number of VMs.
+1.
Thanks,
M.
--
Jazz is not dead, it just smell funny.
next prev parent reply other threads:[~2018-03-29 16:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-29 15:00 [PATCH] KVM: ARM: updtae the VMID generation logic Shannon Zhao
2018-03-29 15:27 ` Mark Rutland
2018-03-29 16:48 ` Marc Zyngier [this message]
2018-03-30 1:56 ` Shannon Zhao
2018-03-30 9:01 ` Marc Zyngier
2018-03-30 9:52 ` Shannon Zhao
2018-03-30 10:48 ` Marc Zyngier
2018-03-30 13:42 ` Shannon Zhao
2018-03-30 16:13 ` Marc Zyngier
2018-04-03 16:49 ` Mark Rutland
2018-04-04 8:43 ` Marc Zyngier
2018-04-04 15:26 ` Marc Zyngier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=861sg2su98.wl-marc.zyngier@arm.com \
--to=marc.zyngier@arm.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=mark.rutland@arm.com \
--cc=zhaoshenglong@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox