From: John Garry <john.g.garry@oracle.com>
To: Robin Murphy <robin.murphy@arm.com>, joro@8bytes.org
Cc: will@kernel.org, iommu@lists.linux.dev,
linux-kernel@vger.kernel.org, zhangzekun11@huawei.com
Subject: Re: [PATCH 0/2] iommu/iova: Make the rcache depot properly flexible
Date: Tue, 15 Aug 2023 14:35:37 +0100 [thread overview]
Message-ID: <1aa1ecad-bdf0-84c8-a37f-94e1d0fb8a03@oracle.com> (raw)
In-Reply-To: <b9bda816-612c-b646-63e7-54cb3fedf1f4@arm.com>
On 15/08/2023 12:11, Robin Murphy wrote:
>>
>> This threshold is the number of online CPUs, right?
>
> Yes, that's nominally half of the current fixed size (based on all the
> performance figures from the original series seemingly coming from a
> 16-thread machine,
If you are talking about
https://lore.kernel.org/linux-iommu/20230811130246.42719-1-zhangzekun11@huawei.com/,
then I think it's a 256-CPU system and the DMA controller has 16 HW
queues. The 16 HW queues are relevant as the per-completion queue
interrupt handler runs on a fixed CPU from the set of 16 CPUs in the HW
queue interrupt handler affinity mask. And what this means is while any
CPU may alloc an IOVA, only those 16 CPUs handling each HW queue
interrupt will be free'ing IOVAs.
> but seemed like a fair compromise. I am of course
> keen to see how real-world testing actually pans out.
>
>>> it's enough of a challenge to get my 4-core dev board with spinning disk
>>> and gigabit ethernet to push anything into a depot at all 😄
>>>
>>
>> I have to admit that I was hoping to also see a more aggressive
>> reclaim strategy, where we also trim the per-CPU rcaches when not in
>> use. Leizhen proposed something like this a long time ago.
>
> Don't think I haven't been having various elaborate ideas for making it
> cleverer with multiple thresholds and self-tuning, however I have
> managed to restrain myself 😉
>
OK, understood. My main issue WRT scalability is that the total
cacheable IOVAs (CPU and depot rcache) scales up with the number of
CPUs, but many DMA controllers have a fixed number of max in-flight
requests.
Consider a SCSI storage controller on a 256-CPU system. The in-flight
limit for this example controller is 4096, which would typically never
be even used up or may not be even usable.
For this device, we need 4096 * 6 [IOVA rcache range] = ~24K cached
IOVAs if we were to pre-allocate them all - obviously I am ignoring that
we have the per-CPU rcache for speed and it would not make sense to
share one set. However, according to current IOVA driver, we can in
theory cache upto ((256 [CPUs] * 2 [loaded + prev]) + 32 [depot size]) *
6 [rcache range] * 128 (IOVA per mag) = ~420K IOVAs. That's ~17x what we
would ever need.
Something like NVMe is different, as its total requests can scale up
with the CPU count, but only to a limit. I am not sure about network
controllers.
Anyway, this is just something which I think should be considered -
which I guess already has been.
> At this point I'm just looking to confirm whether the fundamental
> concepts are sound, and at least no worse than the current behaviour
> (hence keeping it split into 2 distinct patches for the sake of review
> and debugging). If it proves solid then we can absolutely come back and
> go to town on enhancements later.
Thanks,
John
next prev parent reply other threads:[~2023-08-15 13:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-14 17:53 Robin Murphy
2023-08-14 17:53 ` [PATCH 1/2] iommu/iova: Make the rcache depot scale better Robin Murphy
2023-08-21 8:11 ` Srivastava, Dheeraj Kumar
2023-08-21 8:55 ` Robin Murphy
2023-08-21 9:03 ` Srivastava, Dheeraj Kumar
2023-08-21 12:02 ` John Garry
2023-08-21 12:28 ` Robin Murphy
2023-08-14 17:53 ` [PATCH 2/2] iommu/iova: Manage the depot list size Robin Murphy
2023-08-15 14:11 ` zhangzekun (A)
2023-08-16 4:25 ` Jerry Snitselaar
2023-08-16 16:52 ` Robin Murphy
2023-08-15 10:24 ` [PATCH 0/2] iommu/iova: Make the rcache depot properly flexible John Garry
2023-08-15 11:11 ` Robin Murphy
2023-08-15 13:35 ` John Garry [this message]
2023-08-16 15:10 ` Robin Murphy
2023-08-21 11:35 ` John Garry
2023-08-17 16:39 ` Jerry Snitselaar
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=1aa1ecad-bdf0-84c8-a37f-94e1d0fb8a03@oracle.com \
--to=john.g.garry@oracle.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
--cc=zhangzekun11@huawei.com \
/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®