From: Jason Gunthorpe <jgg@nvidia.com>
To: Michael Shavit <mshavit@google.com>
Cc: Robin Murphy <robin.murphy@arm.com>,
iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, will@kernel.org,
nicolinc@nvidia.com, tina.zhang@intel.com,
jean-philippe@linaro.org
Subject: Re: [RFC PATCH v1 2/8] iommu/arm-smmu-v3: Perform invalidations over installed_smmus
Date: Mon, 21 Aug 2023 08:57:58 -0300 [thread overview]
Message-ID: <ZONRRubvUK7GXO4i@nvidia.com> (raw)
In-Reply-To: <CAKHBV24L7pTajkStWCRiW7976+B8VtDHRDpo+Emta0RshkvRhQ@mail.gmail.com>
On Mon, Aug 21, 2023 at 04:33:36PM +0800, Michael Shavit wrote:
> > Notice that arm_smmu_tlb_inv_range_asid() already duplicates
> > arm_smmu_tlb_inv_range_domain().
> >
> > IMHO I would split the ATC step out of arm_smmu_mm_invalidate_range(),
> > get rid of arm_smmu_tlb_inv_range_domain(), and have the mmu notifier
> > just do as it already does:
> >
> > if (!(smmu_domain->smmu->features & ARM_SMMU_FEAT_BTM))
> > arm_smmu_tlb_inv_range_domain_no_atc(start, size, smmu_mn->cd->asid,
> > PAGE_SIZE, false, smmu_domain);
> > arm_smmu_atc_inv_domain(smmu_domain, start, size);
> >
> > And make arm_smmu_tlb_inv_range_domain() just call
> > arm_smmu_tlb_inv_range_domain_no_atc();
> > arm_smmu_atc_inv_domain();
>
> That's a nice clean-up but doesn't really solve the problem faced by this patch.
>
> This patch series eliminates the smmu_domain->smmu handle, replacing
> it for a list of SMMUs. So SVA can no longer optimize the
> arm_smmu_tlb_inv_range_asid call away by checking whether the SMMU BTM
> feature is enabled since there's now a list of SMMUs with possibly
> heterogeneous support for the feature.
You could also go in the direction of making a SVA BTM and SV non-BTM
domain type and then you know what to do immediately in the notifier.
> Since there's now a loop over a series of SMMUs inside
> arm_smmu_tlb_inv_range_asid, it makes sense to move the check into
> that loop. This technically works because only SVA is calling
> arm_smmu_tlb_inv_range_asid but can (IMO) risk introducing bugs in
> the future since it's not obvious from the function name.
Well, I would remove the duplication and add an argument if you intend
to share the function that loops
Jason
WARNING: multiple messages have this Message-ID (diff)
From: Jason Gunthorpe <jgg@nvidia.com>
To: Michael Shavit <mshavit@google.com>
Cc: Robin Murphy <robin.murphy@arm.com>,
iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, will@kernel.org,
nicolinc@nvidia.com, tina.zhang@intel.com,
jean-philippe@linaro.org
Subject: Re: [RFC PATCH v1 2/8] iommu/arm-smmu-v3: Perform invalidations over installed_smmus
Date: Mon, 21 Aug 2023 08:57:58 -0300 [thread overview]
Message-ID: <ZONRRubvUK7GXO4i@nvidia.com> (raw)
In-Reply-To: <CAKHBV24L7pTajkStWCRiW7976+B8VtDHRDpo+Emta0RshkvRhQ@mail.gmail.com>
On Mon, Aug 21, 2023 at 04:33:36PM +0800, Michael Shavit wrote:
> > Notice that arm_smmu_tlb_inv_range_asid() already duplicates
> > arm_smmu_tlb_inv_range_domain().
> >
> > IMHO I would split the ATC step out of arm_smmu_mm_invalidate_range(),
> > get rid of arm_smmu_tlb_inv_range_domain(), and have the mmu notifier
> > just do as it already does:
> >
> > if (!(smmu_domain->smmu->features & ARM_SMMU_FEAT_BTM))
> > arm_smmu_tlb_inv_range_domain_no_atc(start, size, smmu_mn->cd->asid,
> > PAGE_SIZE, false, smmu_domain);
> > arm_smmu_atc_inv_domain(smmu_domain, start, size);
> >
> > And make arm_smmu_tlb_inv_range_domain() just call
> > arm_smmu_tlb_inv_range_domain_no_atc();
> > arm_smmu_atc_inv_domain();
>
> That's a nice clean-up but doesn't really solve the problem faced by this patch.
>
> This patch series eliminates the smmu_domain->smmu handle, replacing
> it for a list of SMMUs. So SVA can no longer optimize the
> arm_smmu_tlb_inv_range_asid call away by checking whether the SMMU BTM
> feature is enabled since there's now a list of SMMUs with possibly
> heterogeneous support for the feature.
You could also go in the direction of making a SVA BTM and SV non-BTM
domain type and then you know what to do immediately in the notifier.
> Since there's now a loop over a series of SMMUs inside
> arm_smmu_tlb_inv_range_asid, it makes sense to move the check into
> that loop. This technically works because only SVA is calling
> arm_smmu_tlb_inv_range_asid but can (IMO) risk introducing bugs in
> the future since it's not obvious from the function name.
Well, I would remove the duplication and add an argument if you intend
to share the function that loops
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:[~2023-08-21 11:58 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-17 18:16 [RFC PATCH v1 0/8] Install domain onto multiple smmus Michael Shavit
2023-08-17 18:16 ` Michael Shavit
2023-08-17 18:16 ` [RFC PATCH v1 1/8] iommu/arm-smmu-v3: Add list of installed_smmus Michael Shavit
2023-08-17 18:16 ` Michael Shavit
2023-08-17 19:05 ` Jason Gunthorpe
2023-08-17 19:05 ` Jason Gunthorpe
2023-08-17 19:34 ` Robin Murphy
2023-08-17 19:34 ` Robin Murphy
2023-08-18 5:34 ` Michael Shavit
2023-08-18 5:34 ` Michael Shavit
2023-08-17 18:16 ` [RFC PATCH v1 2/8] iommu/arm-smmu-v3: Perform invalidations over installed_smmus Michael Shavit
2023-08-17 18:16 ` Michael Shavit
2023-08-17 19:20 ` Jason Gunthorpe
2023-08-17 19:20 ` Jason Gunthorpe
2023-08-17 19:41 ` Robin Murphy
2023-08-17 19:41 ` Robin Murphy
2023-08-18 3:44 ` Michael Shavit
2023-08-18 3:44 ` Michael Shavit
2023-08-18 13:51 ` Jason Gunthorpe
2023-08-18 13:51 ` Jason Gunthorpe
2023-08-21 8:33 ` Michael Shavit
2023-08-21 8:33 ` Michael Shavit
2023-08-21 11:57 ` Jason Gunthorpe [this message]
2023-08-21 11:57 ` Jason Gunthorpe
2023-08-22 8:17 ` Michael Shavit
2023-08-22 8:17 ` Michael Shavit
2023-08-22 8:21 ` Michael Shavit
2023-08-22 8:21 ` Michael Shavit
2023-08-22 10:10 ` Michael Shavit
2023-08-22 10:10 ` Michael Shavit
2023-08-22 14:15 ` Jason Gunthorpe
2023-08-22 14:15 ` Jason Gunthorpe
2023-08-17 18:16 ` [RFC PATCH v1 3/8] iommu/arm-smmu-v3-sva: Allocate new ASID from installed_smmus Michael Shavit
2023-08-17 18:16 ` Michael Shavit
2023-08-17 18:38 ` Jason Gunthorpe
2023-08-17 18:38 ` Jason Gunthorpe
2023-08-21 9:31 ` Michael Shavit
2023-08-21 9:31 ` Michael Shavit
2023-08-21 11:54 ` Jason Gunthorpe
2023-08-21 11:54 ` Jason Gunthorpe
2023-08-21 13:38 ` Michael Shavit
2023-08-21 13:38 ` Michael Shavit
2023-08-21 13:50 ` Jason Gunthorpe
2023-08-21 13:50 ` Jason Gunthorpe
2023-08-21 14:16 ` Michael Shavit
2023-08-21 14:16 ` Michael Shavit
2023-08-21 14:26 ` Jason Gunthorpe
2023-08-21 14:26 ` Jason Gunthorpe
2023-08-21 14:39 ` Michael Shavit
2023-08-21 14:39 ` Michael Shavit
2023-08-21 14:56 ` Jason Gunthorpe
2023-08-21 14:56 ` Jason Gunthorpe
2023-08-22 8:53 ` Michael Shavit
2023-08-22 8:53 ` Michael Shavit
2023-08-17 18:16 ` [RFC PATCH v1 4/8] iommu/arm-smmu-v3: check smmu compatibility on attach Michael Shavit
2023-08-17 18:16 ` Michael Shavit
2023-08-17 19:16 ` Robin Murphy
2023-08-17 19:16 ` Robin Murphy
2023-08-18 3:14 ` Michael Shavit
2023-08-18 3:14 ` Michael Shavit
2023-08-17 18:16 ` [RFC PATCH v1 5/8] iommu/arm-smmu-v3: Add arm_smmu_device as a parameter to domain_finalise Michael Shavit
2023-08-17 18:16 ` Michael Shavit
2023-08-17 18:16 ` [RFC PATCH v1 6/8] iommu/arm-smmu-v3: Free VMID when uninstalling domain from SMMU Michael Shavit
2023-08-17 18:16 ` Michael Shavit
2023-08-17 18:50 ` Jason Gunthorpe
2023-08-17 18:50 ` Jason Gunthorpe
2023-08-17 18:16 ` [RFC PATCH v1 7/8] iommu/arm-smmu-v3: check for domain initialization using pgtbl_ops Michael Shavit
2023-08-17 18:16 ` Michael Shavit
2023-08-17 18:16 ` [RFC PATCH v1 8/8] iommu/arm-smmu-v3: allow multi-SMMU domain installs Michael Shavit
2023-08-17 18:16 ` Michael Shavit
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=ZONRRubvUK7GXO4i@nvidia.com \
--to=jgg@nvidia.com \
--cc=iommu@lists.linux.dev \
--cc=jean-philippe@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mshavit@google.com \
--cc=nicolinc@nvidia.com \
--cc=robin.murphy@arm.com \
--cc=tina.zhang@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.