From: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
To: "Leizhen (ThunderTown)"
<thunder.leizhen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Cc: Kefeng Wang
<wangkefeng.wang-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
linux-kernel
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Jinyue Li <lijinyue-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
iommu
<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
Libin <huawei.libin-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
Hanjun Guo <guohanjun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
linux-arm-kernel
<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH v2 1/3] iommu/arm-smmu-v3: put off the execution of TLBI* to reduce lock confliction
Date: Thu, 19 Oct 2017 10:12:26 +0100 [thread overview]
Message-ID: <20171019091225.GA29762@arm.com> (raw)
In-Reply-To: <59E8155D.2070102-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
On Thu, Oct 19, 2017 at 11:00:45AM +0800, Leizhen (ThunderTown) wrote:
>
>
> On 2017/10/18 20:58, Will Deacon wrote:
> > Hi Thunder,
> >
> > On Tue, Sep 12, 2017 at 09:00:36PM +0800, Zhen Lei wrote:
> >> Because all TLBI commands should be followed by a SYNC command, to make
> >> sure that it has been completely finished. So we can just add the TLBI
> >> commands into the queue, and put off the execution until meet SYNC or
> >> other commands. To prevent the followed SYNC command waiting for a long
> >> time because of too many commands have been delayed, restrict the max
> >> delayed number.
> >>
> >> According to my test, I got the same performance data as I replaced writel
> >> with writel_relaxed in queue_inc_prod.
> >>
> >> Signed-off-by: Zhen Lei <thunder.leizhen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> >> ---
> >> drivers/iommu/arm-smmu-v3.c | 42 +++++++++++++++++++++++++++++++++++++-----
> >> 1 file changed, 37 insertions(+), 5 deletions(-)
> >
> > If we want to go down the route of explicit command batching, I'd much
> > rather do it by implementing the iotlb_range_add callback in the driver,
> > and have a fixed-length array of batched ranges on the domain. We could
> I think even if iotlb_range_add callback is implemented, this patch is still valuable. The main purpose
> of this patch is to reduce dsb operation. So in the scenario with iotlb_range_add implemented:
> .iotlb_range_add:
> spin_lock_irqsave(&smmu->cmdq.lock, flags);
> ...
> add tlbi range-1 to cmq-queue
> ...
> add tlbi range-n to cmq-queue //n
> dsb
> ...
> spin_unlock_irqrestore(&smmu->cmdq.lock, flags);
>
> .iotlb_sync
> spin_lock_irqsave(&smmu->cmdq.lock, flags);
> ...
> add cmd_sync to cmq-queue
> dsb
> ...
> spin_unlock_irqrestore(&smmu->cmdq.lock, flags);
>
> Although iotlb_range_add can reduce n-1 dsb operations, but there are
> still 1 left. If n is not large enough, this patch is helpful.
Then pick an n that is large enough, based on the compatible string.
Will
WARNING: multiple messages have this Message-ID (diff)
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/3] iommu/arm-smmu-v3: put off the execution of TLBI* to reduce lock confliction
Date: Thu, 19 Oct 2017 10:12:26 +0100 [thread overview]
Message-ID: <20171019091225.GA29762@arm.com> (raw)
In-Reply-To: <59E8155D.2070102@huawei.com>
On Thu, Oct 19, 2017 at 11:00:45AM +0800, Leizhen (ThunderTown) wrote:
>
>
> On 2017/10/18 20:58, Will Deacon wrote:
> > Hi Thunder,
> >
> > On Tue, Sep 12, 2017 at 09:00:36PM +0800, Zhen Lei wrote:
> >> Because all TLBI commands should be followed by a SYNC command, to make
> >> sure that it has been completely finished. So we can just add the TLBI
> >> commands into the queue, and put off the execution until meet SYNC or
> >> other commands. To prevent the followed SYNC command waiting for a long
> >> time because of too many commands have been delayed, restrict the max
> >> delayed number.
> >>
> >> According to my test, I got the same performance data as I replaced writel
> >> with writel_relaxed in queue_inc_prod.
> >>
> >> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> >> ---
> >> drivers/iommu/arm-smmu-v3.c | 42 +++++++++++++++++++++++++++++++++++++-----
> >> 1 file changed, 37 insertions(+), 5 deletions(-)
> >
> > If we want to go down the route of explicit command batching, I'd much
> > rather do it by implementing the iotlb_range_add callback in the driver,
> > and have a fixed-length array of batched ranges on the domain. We could
> I think even if iotlb_range_add callback is implemented, this patch is still valuable. The main purpose
> of this patch is to reduce dsb operation. So in the scenario with iotlb_range_add implemented:
> .iotlb_range_add:
> spin_lock_irqsave(&smmu->cmdq.lock, flags);
> ...
> add tlbi range-1 to cmq-queue
> ...
> add tlbi range-n to cmq-queue //n
> dsb
> ...
> spin_unlock_irqrestore(&smmu->cmdq.lock, flags);
>
> .iotlb_sync
> spin_lock_irqsave(&smmu->cmdq.lock, flags);
> ...
> add cmd_sync to cmq-queue
> dsb
> ...
> spin_unlock_irqrestore(&smmu->cmdq.lock, flags);
>
> Although iotlb_range_add can reduce n-1 dsb operations, but there are
> still 1 left. If n is not large enough, this patch is helpful.
Then pick an n that is large enough, based on the compatible string.
Will
WARNING: multiple messages have this Message-ID (diff)
From: Will Deacon <will.deacon@arm.com>
To: "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com>
Cc: Joerg Roedel <joro@8bytes.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
iommu <iommu@lists.linux-foundation.org>,
Robin Murphy <robin.murphy@arm.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
Hanjun Guo <guohanjun@huawei.com>,
Libin <huawei.libin@huawei.com>, Jinyue Li <lijinyue@huawei.com>,
Kefeng Wang <wangkefeng.wang@huawei.com>
Subject: Re: [PATCH v2 1/3] iommu/arm-smmu-v3: put off the execution of TLBI* to reduce lock confliction
Date: Thu, 19 Oct 2017 10:12:26 +0100 [thread overview]
Message-ID: <20171019091225.GA29762@arm.com> (raw)
In-Reply-To: <59E8155D.2070102@huawei.com>
On Thu, Oct 19, 2017 at 11:00:45AM +0800, Leizhen (ThunderTown) wrote:
>
>
> On 2017/10/18 20:58, Will Deacon wrote:
> > Hi Thunder,
> >
> > On Tue, Sep 12, 2017 at 09:00:36PM +0800, Zhen Lei wrote:
> >> Because all TLBI commands should be followed by a SYNC command, to make
> >> sure that it has been completely finished. So we can just add the TLBI
> >> commands into the queue, and put off the execution until meet SYNC or
> >> other commands. To prevent the followed SYNC command waiting for a long
> >> time because of too many commands have been delayed, restrict the max
> >> delayed number.
> >>
> >> According to my test, I got the same performance data as I replaced writel
> >> with writel_relaxed in queue_inc_prod.
> >>
> >> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> >> ---
> >> drivers/iommu/arm-smmu-v3.c | 42 +++++++++++++++++++++++++++++++++++++-----
> >> 1 file changed, 37 insertions(+), 5 deletions(-)
> >
> > If we want to go down the route of explicit command batching, I'd much
> > rather do it by implementing the iotlb_range_add callback in the driver,
> > and have a fixed-length array of batched ranges on the domain. We could
> I think even if iotlb_range_add callback is implemented, this patch is still valuable. The main purpose
> of this patch is to reduce dsb operation. So in the scenario with iotlb_range_add implemented:
> .iotlb_range_add:
> spin_lock_irqsave(&smmu->cmdq.lock, flags);
> ...
> add tlbi range-1 to cmq-queue
> ...
> add tlbi range-n to cmq-queue //n
> dsb
> ...
> spin_unlock_irqrestore(&smmu->cmdq.lock, flags);
>
> .iotlb_sync
> spin_lock_irqsave(&smmu->cmdq.lock, flags);
> ...
> add cmd_sync to cmq-queue
> dsb
> ...
> spin_unlock_irqrestore(&smmu->cmdq.lock, flags);
>
> Although iotlb_range_add can reduce n-1 dsb operations, but there are
> still 1 left. If n is not large enough, this patch is helpful.
Then pick an n that is large enough, based on the compatible string.
Will
next prev parent reply other threads:[~2017-10-19 9:12 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-12 13:00 [PATCH v2 0/3] arm-smmu: performance optimization Zhen Lei
2017-09-12 13:00 ` Zhen Lei
2017-09-12 13:00 ` [PATCH v2 2/3] iommu/arm-smmu-v3: add support for unmap an iova range with only one tlb sync Zhen Lei
2017-09-12 13:00 ` Zhen Lei
[not found] ` <1505221238-9428-3-git-send-email-thunder.leizhen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-10-18 13:00 ` Will Deacon
2017-10-18 13:00 ` Will Deacon
2017-10-18 13:00 ` Will Deacon
[not found] ` <20171018130003.GE4077-5wv7dgnIgG8@public.gmane.org>
2017-10-19 3:17 ` Leizhen (ThunderTown)
2017-10-19 3:17 ` Leizhen (ThunderTown)
2017-10-19 3:17 ` Leizhen (ThunderTown)
2017-09-12 13:00 ` [PATCH v2 3/3] iommu/arm-smmu: add support for unmap a memory " Zhen Lei
2017-09-12 13:00 ` Zhen Lei
[not found] ` <1505221238-9428-1-git-send-email-thunder.leizhen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-09-12 13:00 ` [PATCH v2 1/3] iommu/arm-smmu-v3: put off the execution of TLBI* to reduce lock confliction Zhen Lei
2017-09-12 13:00 ` Zhen Lei
2017-09-12 13:00 ` Zhen Lei
[not found] ` <1505221238-9428-2-git-send-email-thunder.leizhen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-10-18 12:58 ` Will Deacon
2017-10-18 12:58 ` Will Deacon
2017-10-18 12:58 ` Will Deacon
[not found] ` <20171018125849.GD4077-5wv7dgnIgG8@public.gmane.org>
2017-10-19 3:00 ` Leizhen (ThunderTown)
2017-10-19 3:00 ` Leizhen (ThunderTown)
2017-10-19 3:00 ` Leizhen (ThunderTown)
[not found] ` <59E8155D.2070102-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-10-19 9:12 ` Will Deacon [this message]
2017-10-19 9:12 ` Will Deacon
2017-10-19 9:12 ` Will Deacon
2017-09-19 4:31 ` [PATCH v2 0/3] arm-smmu: performance optimization Nate Watterson
2017-09-19 4:31 ` Nate Watterson
2017-09-19 4:31 ` Nate Watterson
2017-09-19 6:26 ` Leizhen (ThunderTown)
2017-09-19 6:26 ` Leizhen (ThunderTown)
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=20171019091225.GA29762@arm.com \
--to=will.deacon-5wv7dgnigg8@public.gmane.org \
--cc=guohanjun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=huawei.libin-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=lijinyue-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=thunder.leizhen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=wangkefeng.wang-hv44wF8Li93QT0dZR+AlfA@public.gmane.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.