From: Jason Gunthorpe <jgg@nvidia.com>
To: Vasant Hegde <vasant.hegde@amd.com>
Cc: iommu@lists.linux.dev, joro@8bytes.org, baolu.lu@linux.intel.com,
suravee.suthikulpanit@amd.com, robin.murphy@arm.com,
will@kernel.org
Subject: Re: [PATCH v3 1/3] iommu: Attach device group to old domain in error path
Date: Fri, 17 Feb 2023 09:44:36 -0400 [thread overview]
Message-ID: <Y++ExJjI/RAy99Cx@nvidia.com> (raw)
In-Reply-To: <20230215052642.6016-1-vasant.hegde@amd.com>
On Wed, Feb 15, 2023 at 05:26:40AM +0000, Vasant Hegde wrote:
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index de91dd88705b..e3336a11b6b9 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -2124,8 +2124,22 @@ static int __iommu_attach_group(struct iommu_domain *domain,
>
> ret = __iommu_group_for_each_dev(group, domain,
> iommu_group_do_attach_device);
> - if (ret == 0)
> + if (ret == 0) {
> group->domain = domain;
> + } else {
> + /*
> + * To recover from the case when certain device within the
> + * group fails to attach to the new domain, we need force
> + * attaching all devices back to the old domain. The old
> + * domain is compatible for all devices in the group,
> + * hence the iommu driver should always return success.
> + */
> + struct iommu_domain *old_domain = group->domain;
> +
> + group->domain = NULL;
> + WARN(__iommu_group_set_domain(group, old_domain),
> + "iommu driver failed to attach a compatible domain");
> + }
OK
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Jason
prev parent reply other threads:[~2023-02-17 13:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-15 5:26 [PATCH v3 1/3] iommu: Attach device group to old domain in error path Vasant Hegde
2023-02-15 5:26 ` [PATCH v3 2/3] iommu/amd: Skip attach device domain is same as new domain Vasant Hegde
2023-02-15 5:26 ` [PATCH v3 3/3] iommu/amd: Improve page fault error reporting Vasant Hegde
2023-02-16 9:41 ` Thorsten Leemhuis
2023-02-17 5:56 ` Vasant Hegde
2023-02-17 6:11 ` Linux regression tracking (Thorsten Leemhuis)
2023-02-16 10:18 ` Joerg Roedel
2023-02-17 5:53 ` [PATCH v3 1/3] iommu: Attach device group to old domain in error path Vasant Hegde
2023-02-18 14:42 ` Joerg Roedel
2023-02-19 10:17 ` Vasant Hegde
2023-03-12 14:42 ` Linux regression tracking (Thorsten Leemhuis)
2023-03-13 4:29 ` Vasant Hegde
2023-03-13 6:29 ` Linux regression tracking (Thorsten Leemhuis)
2023-02-17 13:44 ` Jason Gunthorpe [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=Y++ExJjI/RAy99Cx@nvidia.com \
--to=jgg@nvidia.com \
--cc=baolu.lu@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=robin.murphy@arm.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=vasant.hegde@amd.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