From: Ashish Mhetre <amhetre@nvidia.com>
To: Robin Murphy <robin.murphy@arm.com>, will@kernel.org, joro@8bytes.org
Cc: linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev,
linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org
Subject: Re: [PATCH V2 2/2] include: linux: Update gather only if it's not NULL
Date: Mon, 5 Aug 2024 09:55:01 +0530 [thread overview]
Message-ID: <deda486f-8d1c-4990-9636-d267831247bd@nvidia.com> (raw)
In-Reply-To: <6cb4e7db-4ac0-43b4-a823-7d230ff3438b@arm.com>
On 8/1/2024 10:12 PM, Robin Murphy wrote:
> External email: Use caution opening links or attachments
>
>
> On 01/08/2024 4:34 am, Ashish Mhetre wrote:
>> Gather can be NULL when unmap is called for freeing old table while
>> mapping. If it's NULL then there is no need to add page for syncing
>> the TLB.
>
> But that's only because __arm_lpae_unmap() is now choosing to
> over-invalidate the table entries for simplicity. I think it would make
> more sense to handle that at the callsite, e.g. "if (gather &&
> !iommu_iotlb_gather_queued(gather))".
>
> Also doesn't this mean that bisection is broken as-is since patch #1 on
> its own is going to blow up dereferencing NULL->pgsize when it gets here?
>
> Thanks,
> Robin.
>
Yes, gather can be NULL because of patch #1 only. I will fix it at
callsite only
with a single patch rather than splitting.
>> Signed-off-by: Ashish Mhetre <amhetre@nvidia.com>
>> ---
>> include/linux/iommu.h | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/include/linux/iommu.h b/include/linux/iommu.h
>> index 4d47f2c33311..2a28c1ef8517 100644
>> --- a/include/linux/iommu.h
>> +++ b/include/linux/iommu.h
>> @@ -928,6 +928,9 @@ static inline void
>> iommu_iotlb_gather_add_page(struct iommu_domain *domain,
>> struct
>> iommu_iotlb_gather *gather,
>> unsigned long iova,
>> size_t size)
>> {
>> + if (!gather)
>> + return;
>> +
>> /*
>> * If the new page is disjoint from the current range or is
>> mapped at
>> * a different granularity, then sync the TLB so that the gather
next prev parent reply other threads:[~2024-08-05 4:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-01 3:34 [PATCH V2 1/2] iommu: Optimize IOMMU UnMap Ashish Mhetre
2024-08-01 3:34 ` [PATCH V2 2/2] include: linux: Update gather only if it's not NULL Ashish Mhetre
2024-08-01 16:42 ` Robin Murphy
2024-08-05 4:25 ` Ashish Mhetre [this message]
2024-08-01 16:23 ` [PATCH V2 1/2] iommu: Optimize IOMMU UnMap Robin Murphy
2024-08-05 4:17 ` Ashish Mhetre
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=deda486f-8d1c-4990-9636-d267831247bd@nvidia.com \
--to=amhetre@nvidia.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=robin.murphy@arm.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
all inboxes | Powered by JetHome®