From: Baolu Lu <baolu.lu@linux.intel.com>
To: Jason Gunthorpe <jgg@nvidia.com>, Yi Liu <yi.l.liu@intel.com>
Cc: "Tian, Kevin" <kevin.tian@intel.com>,
"iommu@lists.linux.dev" <iommu@lists.linux.dev>
Subject: Re: [RFC] iommufd: Use accurate dev_id in the PRI forwarding path
Date: Fri, 7 Mar 2025 09:32:47 +0800 [thread overview]
Message-ID: <626f37a5-7427-4e63-910c-785a66cae4b4@linux.intel.com> (raw)
In-Reply-To: <20250306190634.GH354511@nvidia.com>
On 3/7/25 03:06, Jason Gunthorpe wrote:
> On Thu, Mar 06, 2025 at 03:09:34PM +0800, Yi Liu wrote:
>> +bool iommu_group_is_singular(struct iommu_group *group)
>> +{
>> + bool res;
>> +
>> + mutex_lock(&group->mutex);
>> + res = list_count_nodes(&group->devices) == 1;
>> + mutex_unlock(&group->mutex);
>> +
>> + return res;
>> +}
>> +EXPORT_SYMBOL_NS_GPL(iommu_group_is_singular, "IOMMUFD_INTERNAL");
> I'm not so excited about something racy like this..
>
> I still think this is a bit wrong, we only care about aliases, not
> multi device groups.
>
> Aliases are created here:
>
> if (pci_for_each_dma_alias(pdev, get_pci_alias_or_group, &data))
> return data.group;
>
> And maybe in a few other places..
>
> Can you tag the group that it has aliases in it directly during group
> creation so there are no races?
>
> I've long had a desire to more clearly separate the two cases of
> groups:
>
> 1) The HW cannot tell the different struct device sources on a per
> DMA basis
> 2) There is a security intertwinement between the devices but they
> can all run separately in the IOMMU HW
>
> Maybe it is not so hard?
This is a long-standing issue. If I recall correctly, Joerg once
proposed the concept of iommu subgroup.
Thanks,
baolu
prev parent reply other threads:[~2025-03-07 1:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-05 13:03 [RFC] iommufd: Use accurate dev_id in the PRI forwarding path Yi Liu
2025-03-05 17:18 ` Jason Gunthorpe
2025-03-06 3:10 ` Tian, Kevin
2025-03-06 3:19 ` Baolu Lu
2025-03-06 3:30 ` Yi Liu
2025-03-06 4:10 ` Tian, Kevin
2025-03-06 4:55 ` Baolu Lu
2025-03-06 5:01 ` Yi Liu
2025-03-06 12:13 ` Jason Gunthorpe
2025-03-06 7:09 ` Yi Liu
2025-03-06 19:06 ` Jason Gunthorpe
2025-03-07 1:32 ` Baolu Lu [this message]
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=626f37a5-7427-4e63-910c-785a66cae4b4@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=kevin.tian@intel.com \
--cc=yi.l.liu@intel.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