From: Marc Zyngier <maz@kernel.org>
To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
Cc: "linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"will@kernel.org" <will@kernel.org>,
"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
"james.morse@arm.com" <james.morse@arm.com>,
"julien.thierry.kdev@gmail.com" <julien.thierry.kdev@gmail.com>,
"suzuki.poulose@arm.com" <suzuki.poulose@arm.com>,
"jean-philippe@linaro.org" <jean-philippe@linaro.org>,
Alexandru Elisei <Alexandru.Elisei@arm.com>,
Linuxarm <linuxarm@huawei.com>
Subject: Re: [RFC PATCH 0/3] kvm/arm: New VMID allocator based on asid(2nd approach)
Date: Fri, 04 Jun 2021 16:27:39 +0100 [thread overview]
Message-ID: <87lf7ptztg.wl-maz@kernel.org> (raw)
In-Reply-To: <95bb84ffdb0f4db3b64b38cc3b651f90@huawei.com>
On Fri, 04 Jun 2021 15:51:29 +0100,
Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com> wrote:
>
> Hi Marc,
>
> > -----Original Message-----
> > From: Marc Zyngier [mailto:maz@kernel.org]
> > Sent: 04 June 2021 14:55
> > To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
> > Cc: linux-arm-kernel@lists.infradead.org; kvmarm@lists.cs.columbia.edu;
> > linux-kernel@vger.kernel.org; will@kernel.org; catalin.marinas@arm.com;
> > james.morse@arm.com; julien.thierry.kdev@gmail.com;
> > suzuki.poulose@arm.com; jean-philippe@linaro.org; Alexandru Elisei
> > <Alexandru.Elisei@arm.com>; Linuxarm <linuxarm@huawei.com>
> > Subject: Re: [RFC PATCH 0/3] kvm/arm: New VMID allocator based on asid(2nd
> > approach)
> >
> > On Fri, 04 Jun 2021 09:13:10 +0100,
> > Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
> > wrote:
> > >
> > > Hi,
> > >
> > > > -----Original Message-----
> > > > From: Shameerali Kolothum Thodi
> > > > Sent: 06 May 2021 17:52
> > > > To: linux-arm-kernel@lists.infradead.org; kvmarm@lists.cs.columbia.edu;
> > > > linux-kernel@vger.kernel.org
> > > > Cc: maz@kernel.org; will@kernel.org; catalin.marinas@arm.com;
> > > > james.morse@arm.com; julien.thierry.kdev@gmail.com;
> > > > suzuki.poulose@arm.com; jean-philippe@linaro.org; Linuxarm
> > > > <linuxarm@huawei.com>
> > > > Subject: [RFC PATCH 0/3] kvm/arm: New VMID allocator based on asid(2nd
> > > > approach)
> > > >
> > > > This is based on a suggestion from Will [0] to try out the asid
> > > > based kvm vmid solution as a separate VMID allocator instead of
> > > > the shared lib approach attempted in v4[1].
> > > >
> > > > The idea is to compare both the approaches and see whether the
> > > > shared lib solution with callbacks make sense or not.
> > >
> > > A gentle ping on this. Please take a look and let me know.
> >
> > I had a look and I don't overly dislike it. I'd like to see the code
> > without the pinned stuff though, at least to ease the reviewing. I
> > haven't tested it in anger, but I have pushed the rebased code at [1]
> > as it really didn't apply to 5.13-rc4.
>
> Thanks for taking a look and the rebase. I will remove the pinned stuff
> in the next revision as that was added just to compare against the previous
> version.
>
> >
> > One thing I'm a bit worried about is that we so far relied on VMID 0
> > never being allocated to a guest, which is now crucial for protected
> > KVM. I can't really convince myself that this can never happen with
> > this.
>
> Hmm..not sure I quite follow that. As per the current logic vmid 0 is
> reserved and is not allocated to Guest.
And that's the bit I'm struggling to validate here. I guess it works
because cur_idx is set to 1 in new_vmid().
>
> > Plus, I've found this nugget:
> >
> > <quote
> > max_pinned_vmids = NUM_USER_VMIDS - num_possible_cpus() - 2;
> > </quote>
> >
> > What is this "- 2"? My hunch is that it should really be "- 1" as VMID
> > 0 is reserved, and we have no equivalent of KPTI for S2.
>
> I think this is more related to the "pinned vmid" stuff and was borrowed from
> the asid_update_limit() fn in arch/arm64/mm/context.c. But I missed the
> comment that explains the reason behind it. It says,
>
> ---x---
> /*
> * There must always be an ASID available after rollover. Ensure that,
> * even if all CPUs have a reserved ASID and the maximum number of ASIDs
> * are pinned, there still is at least one empty slot in the ASID map.
> */
> max_pinned_asids = num_available_asids - num_possible_cpus() - 2;
> ---x---
>
> So this is to make sure we will have at least one VMID available
> after rollover in case we have pinned the max number of VMIDs. I
> will include that comment to make it clear.
That doesn't really explain the -2. Or is that that we have one for
the extra empty slot, and one for the reserved?
Jean-Philippe?
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-06-04 15:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-06 16:52 [RFC PATCH 0/3] kvm/arm: New VMID allocator based on asid(2nd approach) Shameer Kolothum
2021-05-06 16:52 ` [RFC PATCH 1/3] arch/arm64: Introduce a capability to tell whether 16-bit VMID is available Shameer Kolothum
2021-05-06 16:52 ` [RFC PATCH 2/3] kvm/arm: Introduce a new vmid allocator for KVM Shameer Kolothum
2021-05-06 16:52 ` [RFC PATCH 3/3] kvm/arm: Align the VMID allocation with the arm64 ASID one Shameer Kolothum
2021-06-04 8:13 ` [RFC PATCH 0/3] kvm/arm: New VMID allocator based on asid(2nd approach) Shameerali Kolothum Thodi
2021-06-04 13:54 ` Marc Zyngier
2021-06-04 14:51 ` Shameerali Kolothum Thodi
2021-06-04 15:27 ` Marc Zyngier [this message]
2021-06-07 8:48 ` Jean-Philippe Brucker
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=87lf7ptztg.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=Alexandru.Elisei@arm.com \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=jean-philippe@linaro.org \
--cc=julien.thierry.kdev@gmail.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).