mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
virtio_ring: use shadow flags when detaching split descriptors
Split virtqueues save descriptor flags and next indexes in desc_extra
before publishing descriptors to the device. The detach path uses the
shadow next index, but decides whether to continue by rereading the NEXT
flag from the shared descriptor.
Use the shadow flags for the continuation decision as well. This keeps
all detach metadata in the same driver-owned snapshot and avoids an
unnecessary shared-ring read.
Fixes: 72b5e89587 ("virtio-ring: store DMA metadata in desc_extra for split virtqueue")
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Assisted-by: LLM
Signed-off-by: sungbyeongchan <tjdqudcks0424@naver.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261008050423.32221-1-tjdqudcks0424@naver.com>
This commit is contained in:
parent
3d8c5b714c
commit
e498eb93f9
|
|
@ -910,7 +910,6 @@ static unsigned detach_buf_split_in_order(struct vring_virtqueue *vq,
|
|||
{
|
||||
struct vring_desc_extra *extra;
|
||||
unsigned int i;
|
||||
__virtio16 nextflag = cpu_to_virtio16(vq->vq.vdev, VRING_DESC_F_NEXT);
|
||||
|
||||
/* Clear data ptr. */
|
||||
vq->split.desc_state[head].data = NULL;
|
||||
|
|
@ -920,7 +919,7 @@ static unsigned detach_buf_split_in_order(struct vring_virtqueue *vq,
|
|||
/* Put back on free list: unmap first-level descriptors and find end */
|
||||
i = head;
|
||||
|
||||
while (vq->split.vring.desc[i].flags & nextflag) {
|
||||
while (extra[i].flags & VRING_DESC_F_NEXT) {
|
||||
i = vring_unmap_one_split(vq, &extra[i]);
|
||||
vq->vq.num_free++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user