From: Dmitry Osipenko <digetx@gmail.com>
To: Nicolin Chen <nicoleotsuka@gmail.com>,
thierry.reding@gmail.com, joro@8bytes.org
Cc: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
jonathanh@nvidia.com, hch@infradead.org,
linux-tegra@vger.kernel.org
Subject: Re: [PATCH v4 1/2] iommu/tegra-smmu: Unwrap tegra_smmu_group_get
Date: Sat, 3 Oct 2020 17:27:56 +0300 [thread overview]
Message-ID: <0cc12c08-e2f2-b915-e7b4-8e2e94ea2ac4@gmail.com> (raw)
In-Reply-To: <35d789ae-7deb-7f8c-0556-98fe73f5999f@gmail.com>
29.09.2020 20:41, Dmitry Osipenko пишет:
> 29.09.2020 09:13, Nicolin Chen пишет:
>> The tegra_smmu_group_get was added to group devices in different
>> SWGROUPs and it'd return a NULL group pointer upon a mismatch at
>> tegra_smmu_find_group(), so for most of clients/devices, it very
>> likely would mismatch and need a fallback generic_device_group().
>>
>> But now tegra_smmu_group_get handles devices in same SWGROUP too,
>> which means that it would allocate a group for every new SWGROUP
>> or would directly return an existing one upon matching a SWGROUP,
>> i.e. any device will go through this function.
>>
>> So possibility of having a NULL group pointer in device_group()
>> is upon failure of either devm_kzalloc() or iommu_group_alloc().
>> In either case, calling generic_device_group() no longer makes a
>> sense. Especially for devm_kzalloc() failing case, it'd cause a
>> problem if it fails at devm_kzalloc() yet succeeds at a fallback
>> generic_device_group(), because it does not create a group->list
>> for other devices to match.
>>
>> This patch simply unwraps the function to clean it up.
>>
>> Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
>> ---
>
> Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Osipenko <digetx@gmail.com>
To: Nicolin Chen <nicoleotsuka@gmail.com>,
thierry.reding@gmail.com, joro@8bytes.org
Cc: vdumpa@nvidia.com, jonathanh@nvidia.com,
linux-tegra@vger.kernel.org, iommu@lists.linux-foundation.org,
linux-kernel@vger.kernel.org, hch@infradead.org
Subject: Re: [PATCH v4 1/2] iommu/tegra-smmu: Unwrap tegra_smmu_group_get
Date: Sat, 3 Oct 2020 17:27:56 +0300 [thread overview]
Message-ID: <0cc12c08-e2f2-b915-e7b4-8e2e94ea2ac4@gmail.com> (raw)
In-Reply-To: <35d789ae-7deb-7f8c-0556-98fe73f5999f@gmail.com>
29.09.2020 20:41, Dmitry Osipenko пишет:
> 29.09.2020 09:13, Nicolin Chen пишет:
>> The tegra_smmu_group_get was added to group devices in different
>> SWGROUPs and it'd return a NULL group pointer upon a mismatch at
>> tegra_smmu_find_group(), so for most of clients/devices, it very
>> likely would mismatch and need a fallback generic_device_group().
>>
>> But now tegra_smmu_group_get handles devices in same SWGROUP too,
>> which means that it would allocate a group for every new SWGROUP
>> or would directly return an existing one upon matching a SWGROUP,
>> i.e. any device will go through this function.
>>
>> So possibility of having a NULL group pointer in device_group()
>> is upon failure of either devm_kzalloc() or iommu_group_alloc().
>> In either case, calling generic_device_group() no longer makes a
>> sense. Especially for devm_kzalloc() failing case, it'd cause a
>> problem if it fails at devm_kzalloc() yet succeeds at a fallback
>> generic_device_group(), because it does not create a group->list
>> for other devices to match.
>>
>> This patch simply unwraps the function to clean it up.
>>
>> Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
>> ---
>
> Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
next prev parent reply other threads:[~2020-10-03 14:28 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-29 6:13 [PATCH v4 0/2] iommu/tegra-smmu: Two followup changes Nicolin Chen
2020-09-29 6:13 ` Nicolin Chen
2020-09-29 6:13 ` [PATCH v4 1/2] iommu/tegra-smmu: Unwrap tegra_smmu_group_get Nicolin Chen
2020-09-29 6:13 ` Nicolin Chen
2020-09-29 17:41 ` Dmitry Osipenko
2020-09-29 17:41 ` Dmitry Osipenko
2020-10-03 14:27 ` Dmitry Osipenko [this message]
2020-10-03 14:27 ` Dmitry Osipenko
2020-10-08 9:55 ` Thierry Reding
2020-10-08 9:55 ` Thierry Reding
2020-09-29 6:13 ` [PATCH v4 2/2] iommu/tegra-smmu: Expand mutex protection range Nicolin Chen
2020-09-29 6:13 ` Nicolin Chen
2020-09-29 17:42 ` Dmitry Osipenko
2020-09-29 17:42 ` Dmitry Osipenko
2020-09-30 0:31 ` Nicolin Chen
2020-09-30 0:31 ` Nicolin Chen
2020-10-03 14:28 ` Dmitry Osipenko
2020-10-03 14:28 ` Dmitry Osipenko
2020-10-08 9:56 ` Thierry Reding
2020-10-08 9:56 ` Thierry Reding
2020-11-07 8:35 ` [PATCH v4 0/2] iommu/tegra-smmu: Two followup changes Nicolin Chen
2020-11-07 8:35 ` Nicolin Chen
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=0cc12c08-e2f2-b915-e7b4-8e2e94ea2ac4@gmail.com \
--to=digetx@gmail.com \
--cc=hch@infradead.org \
--cc=iommu@lists.linux-foundation.org \
--cc=jonathanh@nvidia.com \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=nicoleotsuka@gmail.com \
--cc=thierry.reding@gmail.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 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.