From: John Garry <john.garry@huawei.com>
To: Will Deacon <will@kernel.org>
Cc: maz@kernel.org, linuxarm@huawei.com,
linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
robin.murphy@arm.com, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 0/2] iommu/arm-smmu-v3: Improve cmdq lock efficiency
Date: Fri, 13 Nov 2020 10:43:06 +0000 [thread overview]
Message-ID: <ca5a0f5f-91fb-4c11-f158-44e16343cdb2@huawei.com> (raw)
In-Reply-To: <b13d0858-e164-4670-a5c6-ab84e81724b7@huawei.com>
On 21/09/2020 14:58, John Garry wrote:
> On 21/09/2020 14:43, Will Deacon wrote:
>> On Fri, Aug 21, 2020 at 09:54:20PM +0800, John Garry wrote:
>>> As mentioned in [0], the CPU may consume many cycles processing
>>> arm_smmu_cmdq_issue_cmdlist(). One issue we find is the cmpxchg()
>>> loop to
>>> get space on the queue takes a lot of time once we start getting many
>>> CPUs contending - from experiment, for 64 CPUs contending the cmdq,
>>> success rate is ~ 1 in 12, which is poor, but not totally awful.
>>>
>>> This series removes that cmpxchg() and replaces with an atomic_add,
>>> same as how the actual cmdq deals with maintaining the prod pointer.
>> > I'm still not a fan of this.
>
> :(
>
>> Could you try to adapt the hacks I sent before,
>> please? I know they weren't quite right (I have no hardware to test
>> on), but
>> the basic idea is to fall back to a spinlock if the cmpxchg() fails. The
>> queueing in the spinlock implementation should avoid the contention.
>
> OK, so if you're asking me to try this again, then I can do that, and
> see what it gives us.
>
JFYI, to prove that this is not a problem which affects only our HW, I
managed to test an arm64 platform from another vendor. Generally I see
the same issue, and this patchset actually helps that platform even more.
CPUs Before After % Increase
Huawei D06 8 282K 302K 7%
Other 379K 420K 11%
Huawei D06 16 115K 193K 68K
Other 102K 291K 185K
Huawei D06 32 36K 80K 122%
Other 41K 156K 280%
Huawei D06 64 11K 30K 172%
Other 6K 47K 683%
I tested with something like [1], so unit is map+unmaps per cpu per
second - higher is better.
My D06 is memory poor, so would expect higher results otherwise (with
more memory). Indeed, my D05 has memory on all nodes and performs better.
Anyway, I see that the implementation here is not perfect, and I could
not get suggested approach to improve performance significantly. So back
to the drawing board...
Thanks,
John
[1]
https://lore.kernel.org/linux-iommu/20201102080646.2180-1-song.bao.hua@hisilicon.com/
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
prev parent reply other threads:[~2020-11-13 10:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-21 13:54 [PATCH v2 0/2] iommu/arm-smmu-v3: Improve cmdq lock efficiency John Garry
2020-08-21 13:54 ` [PATCH v2 1/2] iommu/arm-smmu-v3: Calculate max commands per batch John Garry
2020-08-21 13:54 ` [PATCH v2 2/2] iommu/arm-smmu-v3: Remove cmpxchg() in arm_smmu_cmdq_issue_cmdlist() John Garry
2020-09-01 11:17 ` [PATCH v2 0/2] iommu/arm-smmu-v3: Improve cmdq lock efficiency Song Bao Hua (Barry Song)
2020-09-21 13:43 ` Will Deacon
2020-09-21 13:58 ` John Garry
2020-09-23 14:47 ` John Garry
2020-11-13 10:43 ` John Garry [this message]
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=ca5a0f5f-91fb-4c11-f158-44e16343cdb2@huawei.com \
--to=john.garry@huawei.com \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=maz@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;
as well as URLs for NNTP newsgroup(s).