From: sashiko-bot@kernel.org
To: "Anlai Lu" <agicy@qq.com>
Cc: "Eugenio Perez" <eperezma@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
virtualization@lists.linux.dev
Subject: Re: [PATCH v2 1/6] iommu/virtio: publish the endpoint before replaying it
Date: Sun, 04 Oct 2026 13:09:50 +0000 [thread overview]
Message-ID: <20261004130950.DD1B51F00893@smtp.kernel.org> (raw)
In-Reply-To: <tencent_D1D6479CD59F6E5CED7C653937DE66C73106@qq.com>
> The device drops a domain's mappings together with its last endpoint, so
> the first endpoint attaching to a domain has to replay them. The driver
> published that endpoint only after the replay (nr_endpoints++, without a
> lock), while viommu_map_pages() used the same counter, also without a
> lock, to decide whether to queue its own MAP or leave it to the replay. A
> map_pages() landing after the replay's walk had passed its range and
> before the counter was bumped was therefore queued by nobody: the mapping
> stayed in the driver's tree and never reached the device, silently, until
> the domain was detached and attached again - DMA to it faults in the
> meantime.
>
> Publish the endpoint first, with the decision moved into
> viommu_add_mapping() under mappings_lock so that it cannot race the
> insert, and let the replay pick up the rest. A mapping that such a race
> sends while the replay walks it is on the device twice, which the spec says
> [ ... ]
> change the device ends with exactly the mappings the driver believes in,
> in every run.
>
> Fixes: edcd69ab9a32 ("iommu: Add virtio-iommu driver")
> Signed-off-by: Anlai Lu <agicy@qq.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/tencent_D757B544955DDC509B5DC7161F425620BA08@qq.com?part=1
next prev parent reply other threads:[~2026-10-04 13:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-04 12:59 [PATCH v2 0/6] iommu/virtio: batch the mapping replay Anlai Lu
2026-10-04 13:01 ` [PATCH v2 1/6] iommu/virtio: publish the endpoint before replaying it Anlai Lu
2026-10-04 13:09 ` sashiko-bot [this message]
2026-10-04 13:01 ` [PATCH v2 2/6] iommu/virtio: queue an UNMAP for every removed mapping Anlai Lu
2026-10-04 13:15 ` sashiko-bot
2026-10-04 13:01 ` [PATCH v2 3/6] iommu/virtio: allocate the UNMAP request with the mapping Anlai Lu
2026-10-04 13:09 ` sashiko-bot
2026-10-04 13:01 ` [PATCH v2 4/6] iommu/virtio: stop queueing and draining once the device is removed Anlai Lu
2026-10-04 13:11 ` sashiko-bot
2026-10-04 13:01 ` [PATCH v2 5/6] iommu/virtio: read the endpoint count under the lock in the iotlb paths Anlai Lu
2026-10-04 13:08 ` sashiko-bot
2026-10-04 13:01 ` [PATCH v2 6/6] iommu/virtio: batch the mapping replay on domain attach Anlai Lu
2026-10-04 13:08 ` sashiko-bot
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=20261004130950.DD1B51F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agicy@qq.com \
--cc=eperezma@redhat.com \
--cc=mst@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=virtualization@lists.linux.dev \
/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.