mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Ashish Mhetre <amhetre@nvidia.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: Thu, 1 Aug 2024 17:42:52 +0100	[thread overview]
Message-ID: <6cb4e7db-4ac0-43b4-a823-7d230ff3438b@arm.com> (raw)
In-Reply-To: <20240801033432.106837-2-amhetre@nvidia.com>

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.

> 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

  reply	other threads:[~2024-08-01 16:42 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 [this message]
2024-08-05  4:25     ` Ashish Mhetre
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=6cb4e7db-4ac0-43b4-a823-7d230ff3438b@arm.com \
    --to=robin.murphy@arm.com \
    --cc=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=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®