From: "Li,Rongqing" <lirongqing@baidu.com>
To: "joro@8bytes.org" <joro@8bytes.org>,
"will@kernel.org" <will@kernel.org>,
"robin.murphy@arm.com" <robin.murphy@arm.com>,
"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
"baolu.lu@linux.intel.com" <baolu.lu@linux.intel.com>,
"vasant.hegde@amd.com" <vasant.hegde@amd.com>
Subject: 答复: [PATCH][v2] iommu: move the adding group info to proper place
Date: Tue, 11 Feb 2025 10:14:49 +0000 [thread overview]
Message-ID: <a77952f74d1e4d718d24983b2292971d@baidu.com> (raw)
In-Reply-To: <20250107033558.41135-1-lirongqing@baidu.com>
> After commit fa0828036488 ("iommu: Split iommu_group_add_device()"), the
> adding group information is left in iommu_group_alloc_device, but which only
> allocate group device, not attach the device to iommu group;
>
> so move the print to iommu probing and adding functions
>
> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
Ping
Thanks
-LiRongQing
> ---
> Diff with v1: add log when iommu_group_alloc_device failed in
> iommu_group_add_device
>
> drivers/iommu/iommu.c | 21 ++++++++++++++-------
> 1 file changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index
> 599030e..2eaa8ab 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -586,6 +586,9 @@ static int __iommu_probe_device(struct device *dev,
> struct list_head *group_list
>
> mutex_unlock(&group->mutex);
>
> + trace_add_device_to_group(group->id, dev);
> + dev_info(dev, "Adding to iommu group %d\n", group->id);
> +
> return 0;
>
> err_remove_gdev:
> @@ -594,6 +597,7 @@ static int __iommu_probe_device(struct device *dev,
> struct list_head *group_list
> err_put_group:
> iommu_deinit_device(dev);
> mutex_unlock(&group->mutex);
> + dev_err(dev, "Failed to add to iommu group %d: %d\n", group->id, ret);
> iommu_group_put(group);
>
> return ret;
> @@ -1192,10 +1196,6 @@ static struct group_device
> *iommu_group_alloc_device(struct iommu_group *group,
> goto err_free_name;
> }
>
> - trace_add_device_to_group(group->id, dev);
> -
> - dev_info(dev, "Adding to iommu group %d\n", group->id);
> -
> return device;
>
> err_free_name:
> @@ -1204,7 +1204,6 @@ static struct group_device
> *iommu_group_alloc_device(struct iommu_group *group,
> sysfs_remove_link(&dev->kobj, "iommu_group");
> err_free_device:
> kfree(device);
> - dev_err(dev, "Failed to add to iommu group %d: %d\n", group->id, ret);
> return ERR_PTR(ret);
> }
>
> @@ -1219,10 +1218,14 @@ static struct group_device
> *iommu_group_alloc_device(struct iommu_group *group, int
> iommu_group_add_device(struct iommu_group *group, struct device *dev) {
> struct group_device *gdev;
> + int ret;
>
> gdev = iommu_group_alloc_device(group, dev);
> - if (IS_ERR(gdev))
> - return PTR_ERR(gdev);
> + if (IS_ERR(gdev)) {
> + ret = PTR_ERR(gdev);
> + dev_err(dev, "Failed to add to iommu group %d: %d\n", group->id,
> ret);
> + return ret;
> + }
>
> iommu_group_ref_get(group);
> dev->iommu_group = group;
> @@ -1230,6 +1233,10 @@ int iommu_group_add_device(struct
> iommu_group *group, struct device *dev)
> mutex_lock(&group->mutex);
> list_add_tail(&gdev->list, &group->devices);
> mutex_unlock(&group->mutex);
> +
> + trace_add_device_to_group(group->id, dev);
> + dev_info(dev, "Adding to iommu group %d\n", group->id);
> +
> return 0;
> }
> EXPORT_SYMBOL_GPL(iommu_group_add_device);
> --
> 2.9.4
next prev parent reply other threads:[~2025-02-11 10:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-07 3:35 [PATCH][v2] iommu: move the adding group info to proper place Li RongQing
2025-01-07 4:00 ` Pranjal Shrivastava
2025-01-07 12:22 ` Vasant Hegde
2025-01-07 12:30 ` 答复: [外部邮件] " Li,Rongqing
2025-01-07 13:46 ` Vasant Hegde
2025-02-11 10:14 ` Li,Rongqing [this message]
2025-02-11 17:51 ` Robin Murphy
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=a77952f74d1e4d718d24983b2292971d@baidu.com \
--to=lirongqing@baidu.com \
--cc=baolu.lu@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=robin.murphy@arm.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