qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Liu, Renwei" <Renwei.Liu@verisilicon.com>
To: "eric.auger@redhat.com" <eric.auger@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>
Cc: "qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
	"Wen, Jianxian" <Jianxian.Wen@verisilicon.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"Li, Chunming" <Chunming.Li@verisilicon.com>
Subject: RE: [PATCH v2] hw/arm/smmuv3: Simplify range invalidation
Date: Wed, 1 Sep 2021 06:33:25 +0000	[thread overview]
Message-ID: <4FA89A717CD8094DBA0FE20FA5F98EAA010E6EA1E0@SHASXM03.verisilicon.com> (raw)
In-Reply-To: <1805dcb3-6f99-0bf1-2d73-be0537c98512@redhat.com>

> -----Original Message-----
> From: Eric Auger [mailto:eric.auger@redhat.com]
> Sent: Tuesday, August 31, 2021 10:46 PM
> To: Liu, Renwei; Peter Maydell
> Cc: qemu-arm@nongnu.org; qemu-devel@nongnu.org; Li, Chunming; Wen,
> Jianxian
> Subject: Re: [PATCH v2] hw/arm/smmuv3: Simplify range invalidation
> 
> Hi Liu,
> 
> On 8/23/21 9:50 AM, Liu, Renwei wrote:
> > Simplify range invalidation which can avoid to iterate over all
> > iotlb entries multi-times. For instance invalidations patterns like
> > "invalidate 32 4kB pages starting from 0xffacd000" need to iterate
> over
> > all iotlb entries 6 times (num_pages: 1, 2, 16, 8, 4, 1). It only
> needs
> > to iterate over all iotlb entries once with new implementation.
> 
> This wouldn't work. This reverts commit
> 6d9cd115b9df ("hw/arm/smmuv3: Enforce invalidation on a power of two
> range")
> which is mandated for VFIO and virtio to work. IOTLB invalidations must
> be naturally aligned and with a power of 2 range, hence this iteration.
> 
> Thanks
>
> Eric
Hi Eric,

Could you try the patch firstly? I want to know whether it's failed
in your application scenario with this implementation.
I agree with you that IOTLB entry must be naturally aligned and
with a power of 2 range. But we can invalidate multi IOTLB entries
in one iteration. We check the overlap between invalidation range
and IOTLB range, not check mask. The final result is same with
your implementation (split to multi times with a power of 2 range).
I wonder why we can't implement it directly when the application can
send an invalidation command with a non power of 2 range.
We have tested it in our application scenario and not find any fail.

In addition, from the code implementation, smmu_iotlb_inv_iova()
should be OK. In another call smmuv3_inv_notifiers_iova() ->
smmuv3_notify_iova() -> memory_region_notify_iommu_one(),
it also checks range overlap. So it should be OK if the range
is not a power of 2.

Could you take a look at it again?

Thanks
Renwei Liu

  reply	other threads:[~2021-09-01  6:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-23  7:50 [PATCH v2] hw/arm/smmuv3: Simplify range invalidation Liu, Renwei
2021-08-31 14:46 ` Eric Auger
2021-09-01  6:33   ` Liu, Renwei [this message]
2021-09-01 13:14     ` Eric Auger
2021-09-02  1:47       ` Liu, Renwei

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=4FA89A717CD8094DBA0FE20FA5F98EAA010E6EA1E0@SHASXM03.verisilicon.com \
    --to=renwei.liu@verisilicon.com \
    --cc=Chunming.Li@verisilicon.com \
    --cc=Jianxian.Wen@verisilicon.com \
    --cc=eric.auger@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.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).