From: Jason Gunthorpe <jgg@ziepe.ca>
To: Jean-Philippe Brucker <jean-philippe@linaro.org>
Cc: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>,
kvmarm@lists.linux.dev, iommu@lists.linux.dev,
linux-arm-kernel@lists.infradead.org, linuxarm@huawei.com,
kevin.tian@intel.com, alex.williamson@redhat.com, maz@kernel.org,
oliver.upton@linux.dev, will@kernel.org, robin.murphy@arm.com,
jonathan.cameron@huawei.com
Subject: Re: [RFC PATCH v2 0/7] iommu/arm-smmu-v3: Use pinned KVM VMID for stage 2
Date: Fri, 9 Feb 2024 08:48:29 -0400 [thread overview]
Message-ID: <20240209124829.GB31743@ziepe.ca> (raw)
In-Reply-To: <20240209115824.GA2922446@myrica>
On Fri, Feb 09, 2024 at 11:58:24AM +0000, Jean-Philippe Brucker wrote:
> * Stage-1 TLB entries in the SMMU have a bit (ASET) saying "this entry
> is private and does not participate in BTM", which we set for private
> SMMU address spaces.
>
> Annoyingly, the stage-2 TLB entries do not have it. With BTM all VMIDs
> are shared between CPU and SMMU.
Right, the spec justified this decision like this:
Note: Arm expects that SMMU stage 2 address spaces are generally
shared with their respective PE virtual machine stage 2
configuration. If broadcast invalidation is required to be avoided
for a particular SMMU stage 2 address space, Arm recommends that a
hypervisor configures the STE with a VMID that is not allocated for
virtual machine use on the PEs.
Which doesn't match how Linux works and I think after the recent KVM
PUCK call on this topic we can say it does not match how Linux will
work going into the future. Assuming the KVM S2 and IOMMU S2 are
shared is not true.
So unfortuntely this creates a waste as the BTM will generate
worthless invalidation workload on the related IOMMU S2. We cannot do
as the spec suggests to avoid broadcast invalidation here with a
unique VMID as that will break vSVA vBTM invalidation to the S1.
I do wonder how much of a performance negative this will create. At
least the S1 isn't flushed so perhaps the performace hit is
small.
Anyhow, I view it as a defect that the HW doesn't have a BTM ignore
bit at the S2 level so that we can use the same VMID to make vBTM work
but not participate in CPU originated invalidations for a non-shared
S2. A global bit to disable S2 BTM would have been fine for Linux.
> - The old VFIO_TYPE1_NESTING_IOMMU lets userspace allocate a private
> stage-2, and has only been used for testing as far as I know. I don't
> think I ever found a program that used it in the wild, but haven't
> checked recently.
There isn't, it is useless and cannot do anything. A patch has been
waiting to remove it for a while now, I've got it in my part 3 right
now.
> It needs to be deprecated over a few releases (starting with a
> warning maybe?),
No need, we just NOP'd it. It has no user visible side effect,
replacing the S2 with a S1 is fine.
> and the replacement API shouldn't allow creating a
> stage-2 without a KVM context.
See my remarks yesterday.
Jason
_______________________________________________
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:[~2024-02-09 12:48 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-08 15:18 [RFC PATCH v2 0/7] iommu/arm-smmu-v3: Use pinned KVM VMID for stage 2 Shameer Kolothum
2024-02-08 15:18 ` [RFC PATCH v2 1/7] KVM: Add generic infrastructure to support pinned VMIDs Shameer Kolothum
2024-06-24 15:48 ` Sean Christopherson
2024-02-08 15:18 ` [RFC PATCH v2 2/7] KVM: arm64: Introduce support to pin VMIDs Shameer Kolothum
2024-06-24 19:22 ` Oliver Upton
2024-06-24 19:34 ` Shameerali Kolothum Thodi
2024-06-24 19:52 ` Oliver Upton
2024-02-08 15:18 ` [RFC PATCH v2 3/7] KVM: arm64: Add interfaces for pinned VMID support Shameer Kolothum
2024-02-08 15:18 ` [RFC PATCH v2 4/7] iommufd: Associate kvm pointer to iommufd ctx Shameer Kolothum
2024-02-08 15:42 ` Jason Gunthorpe
2024-06-24 16:53 ` Sean Christopherson
2024-06-24 17:07 ` Jason Gunthorpe
2024-06-24 17:54 ` Sean Christopherson
2024-06-24 18:01 ` Jason Gunthorpe
2024-06-24 19:12 ` Oliver Upton
2024-06-24 19:29 ` Sean Christopherson
2024-06-24 19:51 ` Oliver Upton
2024-06-24 22:35 ` Jason Gunthorpe
2024-06-25 2:21 ` Tian, Kevin
2024-06-24 19:13 ` Shameerali Kolothum Thodi
2024-06-25 1:53 ` Tian, Kevin
2024-02-08 15:18 ` [RFC PATCH v2 5/7] iommu: Pass in kvm pointer to domain_alloc_user Shameer Kolothum
2024-02-08 15:43 ` Jason Gunthorpe
2024-02-08 15:18 ` [RFC PATCH v2 6/7] iommu/arm-smmu-v3: Use KVM VMID for s2 stage Shameer Kolothum
2024-02-08 15:59 ` Jason Gunthorpe
2024-02-08 16:14 ` Shameerali Kolothum Thodi
2024-02-08 16:26 ` Jason Gunthorpe
2024-02-08 16:36 ` Shameerali Kolothum Thodi
2024-02-08 15:18 ` [RFC PATCH v2 7/7] iommu/arm-smmu-v3: Enable broadcast TLB maintenance Shameer Kolothum
2024-02-08 15:35 ` [RFC PATCH v2 0/7] iommu/arm-smmu-v3: Use pinned KVM VMID for stage 2 Jason Gunthorpe
2024-02-08 15:49 ` Shameerali Kolothum Thodi
2024-02-08 16:07 ` Jason Gunthorpe
2024-02-09 11:58 ` Jean-Philippe Brucker
2024-02-09 12:48 ` Jason Gunthorpe [this message]
2024-02-09 13:54 ` Shameerali Kolothum Thodi
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=20240209124829.GB31743@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=alex.williamson@redhat.com \
--cc=iommu@lists.linux.dev \
--cc=jean-philippe@linaro.org \
--cc=jonathan.cameron@huawei.com \
--cc=kevin.tian@intel.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linuxarm@huawei.com \
--cc=maz@kernel.org \
--cc=oliver.upton@linux.dev \
--cc=robin.murphy@arm.com \
--cc=shameerali.kolothum.thodi@huawei.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).