From: Jason Wang <jasowang@redhat.com>
To: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: netdev@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>,
"Eugenio Pérez" <eperezma@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Jesper Dangaard Brouer" <hawk@kernel.org>,
"John Fastabend" <john.fastabend@gmail.com>,
virtualization@lists.linux.dev, bpf@vger.kernel.org
Subject: Re: [RFC net-next v1 04/12] virtio_ring: perform premapped operations based on per-buffer
Date: Tue, 24 Sep 2024 15:35:01 +0800 [thread overview]
Message-ID: <CACGkMEtuF8xx-R08oKmoZo3dMSnCBkjG9tKTZJ=mL1z=SgO2tQ@mail.gmail.com> (raw)
In-Reply-To: <20240924013204.13763-5-xuanzhuo@linux.alibaba.com>
On Tue, Sep 24, 2024 at 9:32 AM Xuan Zhuo <xuanzhuo@linux.alibaba.com> wrote:
>
> The current configuration sets the virtqueue (vq) to premapped mode,
> implying that all buffers submitted to this queue must be mapped ahead
> of time. This presents a challenge for the virtnet send queue (sq): the
> virtnet driver would be required to keep track of dma information for vq
> size * 17, which can be substantial. However, if the premapped mode were
> applied on a per-buffer basis, the complexity would be greatly reduced.
> With AF_XDP enabled, AF_XDP buffers would become premapped, while kernel
> skb buffers could remain unmapped.
>
> We can distinguish them by sg_page(sg), When sg_page(sg) is NULL, this
> indicates that the driver has performed DMA mapping in advance, allowing
> the Virtio core to directly utilize sg_dma_address(sg) without
> conducting any internal DMA mapping. Additionally, DMA unmap operations
> for this buffer will be bypassed.
So I think we still need some explanation here. I think this works for
virtio-net as the sgs are initialized by the virtio-net device itself.
But it seems not the case for all the others where the sgs were passed
from the uppyer subsystem. For example in __virtscsi_add_cmd(), we
had:
if (sc && sc->sc_data_direction != DMA_NONE) {
if (sc->sc_data_direction != DMA_FROM_DEVICE)
out = &sc->sdb.table;
if (sc->sc_data_direction != DMA_TO_DEVICE)
in = &sc->sdb.table;
}
/* Request header. */
sg_init_one(&req, &cmd->req, req_size);
sgs[out_num++] = &req;
/* Data-out buffer. */
if (out) {
/* Place WRITE protection SGLs before Data OUT payload */
if (scsi_prot_sg_count(sc))
sgs[out_num++] = scsi_prot_sglist(sc);
sgs[out_num++] = out->sgl;
}
Thanks
next prev parent reply other threads:[~2024-09-24 7:35 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-24 1:31 [RFC net-next v1 00/12] virtio-net: support AF_XDP zero copy (tx) Xuan Zhuo
2024-09-24 1:31 ` [RFC net-next v1 01/12] virtio_ring: introduce vring_need_unmap_buffer Xuan Zhuo
2024-09-24 1:31 ` [RFC net-next v1 02/12] virtio_ring: split: record extras for indirect buffers Xuan Zhuo
2024-09-24 7:34 ` Jason Wang
2024-09-24 8:32 ` Xuan Zhuo
2024-09-24 1:31 ` [RFC net-next v1 03/12] virtio_ring: packed: " Xuan Zhuo
2024-09-24 1:31 ` [RFC net-next v1 04/12] virtio_ring: perform premapped operations based on per-buffer Xuan Zhuo
2024-09-24 7:35 ` Jason Wang [this message]
2024-09-24 8:22 ` Xuan Zhuo
2024-09-24 1:31 ` [RFC net-next v1 05/12] virtio-net: rq submits premapped per-buffer Xuan Zhuo
2024-09-24 1:31 ` [RFC net-next v1 06/12] virtio_ring: remove API virtqueue_set_dma_premapped Xuan Zhuo
2024-09-24 1:31 ` [RFC net-next v1 07/12] virtio_net: refactor the xmit type Xuan Zhuo
2024-09-24 7:35 ` Jason Wang
2024-09-24 11:39 ` Xuan Zhuo
2024-09-24 1:32 ` [RFC net-next v1 08/12] virtio_net: xsk: bind/unbind xsk for tx Xuan Zhuo
2024-09-24 7:35 ` Jason Wang
2024-09-24 9:22 ` Xuan Zhuo
2024-09-24 1:32 ` [RFC net-next v1 09/12] virtio_net: xsk: prevent disable tx napi Xuan Zhuo
2024-09-24 1:32 ` [RFC net-next v1 10/12] virtio_net: xsk: tx: support xmit xsk buffer Xuan Zhuo
2024-09-24 7:35 ` Jason Wang
2024-09-24 11:41 ` Xuan Zhuo
2024-09-24 1:32 ` [RFC net-next v1 11/12] virtio_net: update tx timeout record Xuan Zhuo
2024-09-24 1:32 ` [RFC net-next v1 12/12] virtio_net: xdp_features add NETDEV_XDP_ACT_XSK_ZEROCOPY Xuan Zhuo
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='CACGkMEtuF8xx-R08oKmoZo3dMSnCBkjG9tKTZJ=mL1z=SgO2tQ@mail.gmail.com' \
--to=jasowang@redhat.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eperezma@redhat.com \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.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