All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Krishna Reddy <vdumpa@nvidia.com>,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	iommu@lists.linux-foundation.org, Will Deacon <will@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	Thierry Reding <treding@nvidia.com>
Subject: Re: [PATCH] iommu/io-pgtable-arm: Optimize partial walk flush for large scatter-gather list
Date: Wed, 16 Jun 2021 14:33:04 +0530	[thread overview]
Message-ID: <d9226f4349c445c6ca63dc632b29e3e0@codeaurora.org> (raw)
In-Reply-To: <8535b6c757a5584b495f135f4377053c@codeaurora.org>

On 2021-06-16 12:28, Sai Prakash Ranjan wrote:
> Hi Robin,
> 
> On 2021-06-15 19:23, Robin Murphy wrote:
>> On 2021-06-15 12:51, Sai Prakash Ranjan wrote:
> 
> <snip>...
> 
>>> Hi @Robin, from these discussions it seems they are not ok with the 
>>> change
>>> for all SoC vendor implementations and do not have any data on such 
>>> impact.
>>> As I mentioned above, on QCOM platforms we do have several 
>>> optimizations in HW
>>> for TLBIs and would like to make use of it and reduce the unmap 
>>> latency.
>>> What do you think, should this be made implementation specific?
>> 
>> Yes, it sounds like there's enough uncertainty for now that this needs
>> to be an opt-in feature. However, I still think that non-strict mode
>> could use it generically, since that's all about over-invalidating to
>> save time on individual unmaps - and relatively non-deterministic -
>> already.
>> 
>> So maybe we have a second set of iommu_flush_ops, or just a flag
>> somewhere to control the tlb_flush_walk functions internally, and the
>> choice can be made in the iommu_get_dma_strict() test, but also forced
>> on all the time by your init_context hook. What do you reckon?
>> 
> 
> Sounds good to me. Since you mentioned non-strict mode using it 
> generically,
> can't we just set tlb_flush_all() in io_pgtable_tlb_flush_walk() like 
> below
> based on quirk so that we don't need to add any check in 
> iommu_get_dma_strict()
> and just force the new flush_ops in init_context hook?
> 
> if (iop->cfg.quirks & IO_PGTABLE_QUIRK_NON_STRICT) {
>         iop->cfg.tlb->tlb_flush_all(iop->cookie);
>         return;
> }
> 

Instead of flush_ops in init_context hook, perhaps a io_pgtable quirk 
since this
is related to tlb, probably a bad name but IO_PGTABLE_QUIRK_TLB_INV 
which will be
set in init_context impl hook and the prev condition in 
io_pgtable_tlb_flush_walk()
becomes something like below. Seems very minimal and neat instead of 
poking into
tlb_flush_walk functions or touching dma strict with some flag?

if (iop->cfg.quirks & IO_PGTABLE_QUIRK_NON_STRICT ||
     iop->cfg.quirks & IO_PGTABLE_QUIRK_TLB_INV) {
         iop->cfg.tlb->tlb_flush_all(iop->cookie);
         return;
}

Thanks,
Sai

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a 
member
of Code Aurora Forum, hosted by The Linux Foundation

WARNING: multiple messages have this Message-ID (diff)
From: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
To: Robin Murphy <robin.murphy@arm.com>
Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	iommu@lists.linux-foundation.org,
	Thierry Reding <treding@nvidia.com>,
	Will Deacon <will@kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] iommu/io-pgtable-arm: Optimize partial walk flush for large scatter-gather list
Date: Wed, 16 Jun 2021 14:33:04 +0530	[thread overview]
Message-ID: <d9226f4349c445c6ca63dc632b29e3e0@codeaurora.org> (raw)
In-Reply-To: <8535b6c757a5584b495f135f4377053c@codeaurora.org>

On 2021-06-16 12:28, Sai Prakash Ranjan wrote:
> Hi Robin,
> 
> On 2021-06-15 19:23, Robin Murphy wrote:
>> On 2021-06-15 12:51, Sai Prakash Ranjan wrote:
> 
> <snip>...
> 
>>> Hi @Robin, from these discussions it seems they are not ok with the 
>>> change
>>> for all SoC vendor implementations and do not have any data on such 
>>> impact.
>>> As I mentioned above, on QCOM platforms we do have several 
>>> optimizations in HW
>>> for TLBIs and would like to make use of it and reduce the unmap 
>>> latency.
>>> What do you think, should this be made implementation specific?
>> 
>> Yes, it sounds like there's enough uncertainty for now that this needs
>> to be an opt-in feature. However, I still think that non-strict mode
>> could use it generically, since that's all about over-invalidating to
>> save time on individual unmaps - and relatively non-deterministic -
>> already.
>> 
>> So maybe we have a second set of iommu_flush_ops, or just a flag
>> somewhere to control the tlb_flush_walk functions internally, and the
>> choice can be made in the iommu_get_dma_strict() test, but also forced
>> on all the time by your init_context hook. What do you reckon?
>> 
> 
> Sounds good to me. Since you mentioned non-strict mode using it 
> generically,
> can't we just set tlb_flush_all() in io_pgtable_tlb_flush_walk() like 
> below
> based on quirk so that we don't need to add any check in 
> iommu_get_dma_strict()
> and just force the new flush_ops in init_context hook?
> 
> if (iop->cfg.quirks & IO_PGTABLE_QUIRK_NON_STRICT) {
>         iop->cfg.tlb->tlb_flush_all(iop->cookie);
>         return;
> }
> 

Instead of flush_ops in init_context hook, perhaps a io_pgtable quirk 
since this
is related to tlb, probably a bad name but IO_PGTABLE_QUIRK_TLB_INV 
which will be
set in init_context impl hook and the prev condition in 
io_pgtable_tlb_flush_walk()
becomes something like below. Seems very minimal and neat instead of 
poking into
tlb_flush_walk functions or touching dma strict with some flag?

if (iop->cfg.quirks & IO_PGTABLE_QUIRK_NON_STRICT ||
     iop->cfg.quirks & IO_PGTABLE_QUIRK_TLB_INV) {
         iop->cfg.tlb->tlb_flush_all(iop->cookie);
         return;
}

Thanks,
Sai

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a 
member
of Code Aurora Forum, hosted by The Linux Foundation
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2021-06-16  9:03 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09 14:53 [PATCH] iommu/io-pgtable-arm: Optimize partial walk flush for large scatter-gather list Sai Prakash Ranjan
2021-06-09 14:53 ` Sai Prakash Ranjan
2021-06-09 18:44 ` Robin Murphy
2021-06-09 18:44   ` Robin Murphy
2021-06-09 18:44   ` Robin Murphy
2021-06-10  5:24   ` Sai Prakash Ranjan
2021-06-10  5:24     ` Sai Prakash Ranjan
2021-06-10  9:08     ` Robin Murphy
2021-06-10  9:08       ` Robin Murphy
2021-06-10  9:08       ` Robin Murphy
2021-06-10  9:36       ` Sai Prakash Ranjan
2021-06-10  9:36         ` Sai Prakash Ranjan
2021-06-10 11:33         ` Robin Murphy
2021-06-10 11:33           ` Robin Murphy
2021-06-10 11:33           ` Robin Murphy
2021-06-10 11:54           ` Sai Prakash Ranjan
2021-06-10 11:54             ` Sai Prakash Ranjan
2021-06-10 15:29             ` Robin Murphy
2021-06-10 15:29               ` Robin Murphy
2021-06-10 15:29               ` Robin Murphy
2021-06-10 15:51               ` Sai Prakash Ranjan
2021-06-10 15:51                 ` Sai Prakash Ranjan
2021-06-11  0:37               ` Krishna Reddy
2021-06-11  0:37                 ` Krishna Reddy
2021-06-11  0:37                 ` Krishna Reddy
2021-06-11  0:54                 ` Sai Prakash Ranjan
2021-06-11  0:54                   ` Sai Prakash Ranjan
2021-06-11 16:49                   ` Krishna Reddy
2021-06-11 16:49                     ` Krishna Reddy
2021-06-11 16:49                     ` Krishna Reddy
2021-06-12  2:46                     ` Sai Prakash Ranjan
2021-06-12  2:46                       ` Sai Prakash Ranjan
2021-06-14 17:48                       ` Krishna Reddy
2021-06-14 17:48                         ` Krishna Reddy
2021-06-14 17:48                         ` Krishna Reddy
2021-06-15 11:51                         ` Sai Prakash Ranjan
2021-06-15 11:51                           ` Sai Prakash Ranjan
2021-06-15 13:53                           ` Robin Murphy
2021-06-15 13:53                             ` Robin Murphy
2021-06-15 13:53                             ` Robin Murphy
2021-06-16  6:58                             ` Sai Prakash Ranjan
2021-06-16  6:58                               ` Sai Prakash Ranjan
2021-06-16  9:03                               ` Sai Prakash Ranjan [this message]
2021-06-16  9:03                                 ` Sai Prakash Ranjan
2021-06-17 21:18                                 ` Krishna Reddy
2021-06-17 21:18                                   ` Krishna Reddy
2021-06-17 21:18                                   ` Krishna Reddy
2021-06-18  2:47                                   ` Sai Prakash Ranjan
2021-06-18  2:47                                     ` Sai Prakash Ranjan
2021-06-18  4:04                           ` Sai Prakash Ranjan
2021-06-18  4:04                             ` Sai Prakash Ranjan
2021-06-10 12:03           ` Thierry Reding
2021-06-10 12:03             ` Thierry Reding
2021-06-10 12:03             ` Thierry Reding

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=d9226f4349c445c6ca63dc632b29e3e0@codeaurora.org \
    --to=saiprakash.ranjan@codeaurora.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=treding@nvidia.com \
    --cc=vdumpa@nvidia.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 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.