Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1265383
| From | Peng Fan <van.freenix@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC] iommu: arm-smmu: correct reference count |
| Date | 2015-11-09 06:50 +0100 |
| Message-ID | <qsNv5-2fT-35@gated-at.bofh.it> (permalink) |
| References | <qqJlV-2OU-19@gated-at.bofh.it> <qqJFh-3bL-21@gated-at.bofh.it> <qrOjw-4rO-27@gated-at.bofh.it> <qrOjw-4rO-25@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi Will, On Fri, Nov 06, 2015 at 12:23:39PM +0000, Will Deacon wrote: >On Wed, Nov 04, 2015 at 10:48:28AM +0800, Peng Fan wrote: >> 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. > >Ok, I see what you're saying. iommu_group_get_for_dev has exactly the >same issue, so could you update arm-smmu-v3.c as well, please? I did not see the update about device_group for iommu, when I worked out this patch. Rebased to latest linux/master, whether to arm-smmu.c or arm-smmu-v3.c, only add 'iommu_group_put' at the end of iommu_group_get_for_dev is ok as the following. I'll send out V2. Thanks, Peng. > >Thanks, > >Will -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[RFC] iommu: arm-smmu: correct reference count Peng Fan <van.freenix@gmail.com> - 2015-11-03 14:00 +0100
Re: [RFC] iommu: arm-smmu: correct reference count Will Deacon <will.deacon@arm.com> - 2015-11-03 14:20 +0100
Re: [RFC] iommu: arm-smmu: correct reference count Will Deacon <will.deacon@arm.com> - 2015-11-06 13:30 +0100
Re: [RFC] iommu: arm-smmu: correct reference count Peng Fan <van.freenix@gmail.com> - 2015-11-09 06:50 +0100
csiph-web