From: Peng Fan <b51431-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
To: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
Cc: Peng Fan <van.freenix-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [RFC] iommu: arm-smmu: correct reference count
Date: Wed, 4 Nov 2015 10:48:28 +0800 [thread overview]
Message-ID: <20151104024825.GA27479@shlinux2> (raw)
In-Reply-To: <20151103131734.GE14159-5wv7dgnIgG8@public.gmane.org>
Hi Will,
On Tue, Nov 03, 2015 at 01:17:34PM +0000, Will Deacon wrote:
>On Tue, Nov 03, 2015 at 08:59:17PM +0800, Peng Fan wrote:
>> iommu_group_alloc will initialize the reference count for group to 1.
>> iommu_group_add_device also increase the group reference count,
>> if nothing bad happends. And we need to add iommu_group_put to
>> decrease the reference count for group.
>>
>> Signed-off-by: Peng Fan <van.freenix-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> Cc: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
>> Cc: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
>> ---
>>
>> Not sure whether my understanding is correct or not. I checked rockchip-iommu.c
>> exynos-iommu.c and fsl_pamu_domain.c, and they all have iommu_group_put after
>> iommu_group_add_device.
>
>Doesn't this pair up with the iommu_group_remove_device in
>arm_smmu_remove_device? Are you actually seeing an issue in practice?
In arm_smmu_add_platform_device,
iommu_group_alloc --> group->device_kobj ref count will be init to 1.
iommu_group_add_device --> group->device_kobj ref count will be added 1 to 2.
In arm_smmu_remove_device:
iommu_group_remove_device --> Decrease group->device_kobj ref count by 1.
After arm_smmu_remove_device, the ref count of group->device_kobj is not 0.
So I think need to add iommu_group_put after iommu_group_add_device.
If I am wrong, please correct me.
Just code inspection, not have a platform to test this.
Regards,
Peng.
>
>Will
>_______________________________________________
>iommu mailing list
>iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
>https://lists.linuxfoundation.org/mailman/listinfo/iommu
--
WARNING: multiple messages have this Message-ID (diff)
From: b51431@freescale.com (Peng Fan)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC] iommu: arm-smmu: correct reference count
Date: Wed, 4 Nov 2015 10:48:28 +0800 [thread overview]
Message-ID: <20151104024825.GA27479@shlinux2> (raw)
In-Reply-To: <20151103131734.GE14159@arm.com>
Hi Will,
On Tue, Nov 03, 2015 at 01:17:34PM +0000, Will Deacon wrote:
>On Tue, Nov 03, 2015 at 08:59:17PM +0800, Peng Fan wrote:
>> iommu_group_alloc will initialize the reference count for group to 1.
>> iommu_group_add_device also increase the group reference count,
>> if nothing bad happends. And we need to add iommu_group_put to
>> decrease the reference count for group.
>>
>> Signed-off-by: Peng Fan <van.freenix@gmail.com>
>> Cc: Will Deacon <will.deacon@arm.com>
>> Cc: Joerg Roedel <joro@8bytes.org>
>> ---
>>
>> Not sure whether my understanding is correct or not. I checked rockchip-iommu.c
>> exynos-iommu.c and fsl_pamu_domain.c, and they all have iommu_group_put after
>> iommu_group_add_device.
>
>Doesn't this pair up with the iommu_group_remove_device in
>arm_smmu_remove_device? Are you actually seeing an issue in practice?
In arm_smmu_add_platform_device,
iommu_group_alloc --> group->device_kobj ref count will be init to 1.
iommu_group_add_device --> group->device_kobj ref count will be added 1 to 2.
In arm_smmu_remove_device:
iommu_group_remove_device --> Decrease group->device_kobj ref count by 1.
After arm_smmu_remove_device, the ref count of group->device_kobj is not 0.
So I think need to add iommu_group_put after iommu_group_add_device.
If I am wrong, please correct me.
Just code inspection, not have a platform to test this.
Regards,
Peng.
>
>Will
>_______________________________________________
>iommu mailing list
>iommu at lists.linux-foundation.org
>https://lists.linuxfoundation.org/mailman/listinfo/iommu
--
WARNING: multiple messages have this Message-ID (diff)
From: Peng Fan <b51431@freescale.com>
To: Will Deacon <will.deacon@arm.com>
Cc: Peng Fan <van.freenix@gmail.com>,
<iommu@lists.linux-foundation.org>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [RFC] iommu: arm-smmu: correct reference count
Date: Wed, 4 Nov 2015 10:48:28 +0800 [thread overview]
Message-ID: <20151104024825.GA27479@shlinux2> (raw)
In-Reply-To: <20151103131734.GE14159@arm.com>
Hi Will,
On Tue, Nov 03, 2015 at 01:17:34PM +0000, Will Deacon wrote:
>On Tue, Nov 03, 2015 at 08:59:17PM +0800, Peng Fan wrote:
>> iommu_group_alloc will initialize the reference count for group to 1.
>> iommu_group_add_device also increase the group reference count,
>> if nothing bad happends. And we need to add iommu_group_put to
>> decrease the reference count for group.
>>
>> Signed-off-by: Peng Fan <van.freenix@gmail.com>
>> Cc: Will Deacon <will.deacon@arm.com>
>> Cc: Joerg Roedel <joro@8bytes.org>
>> ---
>>
>> Not sure whether my understanding is correct or not. I checked rockchip-iommu.c
>> exynos-iommu.c and fsl_pamu_domain.c, and they all have iommu_group_put after
>> iommu_group_add_device.
>
>Doesn't this pair up with the iommu_group_remove_device in
>arm_smmu_remove_device? Are you actually seeing an issue in practice?
In arm_smmu_add_platform_device,
iommu_group_alloc --> group->device_kobj ref count will be init to 1.
iommu_group_add_device --> group->device_kobj ref count will be added 1 to 2.
In arm_smmu_remove_device:
iommu_group_remove_device --> Decrease group->device_kobj ref count by 1.
After arm_smmu_remove_device, the ref count of group->device_kobj is not 0.
So I think need to add iommu_group_put after iommu_group_add_device.
If I am wrong, please correct me.
Just code inspection, not have a platform to test this.
Regards,
Peng.
>
>Will
>_______________________________________________
>iommu mailing list
>iommu@lists.linux-foundation.org
>https://lists.linuxfoundation.org/mailman/listinfo/iommu
--
next prev parent reply other threads:[~2015-11-04 2:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-03 12:59 [RFC] iommu: arm-smmu: correct reference count Peng Fan
2015-11-03 12:59 ` Peng Fan
[not found] ` <1446555557-3097-1-git-send-email-van.freenix-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-11-03 13:17 ` Will Deacon
2015-11-03 13:17 ` Will Deacon
2015-11-03 13:17 ` Will Deacon
[not found] ` <20151103131734.GE14159-5wv7dgnIgG8@public.gmane.org>
2015-11-04 2:48 ` Peng Fan [this message]
2015-11-04 2:48 ` Peng Fan
2015-11-04 2:48 ` Peng Fan
2015-11-06 12:23 ` Will Deacon
2015-11-06 12:23 ` Will Deacon
2015-11-06 12:23 ` Will Deacon
[not found] ` <20151106122338.GI6087-5wv7dgnIgG8@public.gmane.org>
2015-11-09 5:41 ` Peng Fan
2015-11-09 5:41 ` Peng Fan
2015-11-09 5:41 ` Peng Fan
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=20151104024825.GA27479@shlinux2 \
--to=b51431-kzfg59tc24xl57midrcfdg@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=van.freenix-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=will.deacon-5wv7dgnIgG8@public.gmane.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.