From: Simon Horman <horms@kernel.org>
To: Heng Qi <hengqi@linux.alibaba.com>
Cc: netdev@vger.kernel.org, virtualization@lists.linux.dev,
Jason Wang <jasowang@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Paolo Abeni <pabeni@redhat.com>, Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>,
Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Subject: Re: [PATCH net-next 3/3] virtio-net: reduce the CPU consumption of dim worker
Date: Tue, 16 Jan 2024 19:56:46 +0000 [thread overview]
Message-ID: <20240116195646.GF588419@kernel.org> (raw)
In-Reply-To: <1705410693-118895-4-git-send-email-hengqi@linux.alibaba.com>
On Tue, Jan 16, 2024 at 09:11:33PM +0800, Heng Qi wrote:
> Accumulate multiple request commands to kick the device once,
> and obtain the processing results of the corresponding commands
> asynchronously. The batch command method is used to optimize the
> CPU overhead of the DIM worker caused by the guest being busy
> waiting for the command response result.
>
> On an 8-queue device, without this patch, the guest cpu overhead
> due to waiting for cvq could be 10+% and above. With this patch,
> the corresponding overhead is basically invisible.
>
> Signed-off-by: Heng Qi <hengqi@linux.alibaba.com>
...
> @@ -3520,22 +3568,99 @@ static int virtnet_send_notf_coal_vq_cmds(struct virtnet_info *vi,
> return 0;
> }
>
> +static bool virtnet_add_dim_command(struct virtnet_info *vi,
> + struct virtnet_batch_coal *ctrl)
> +{
> + struct scatterlist *sgs[4], hdr, stat, out;
> + unsigned out_num = 0;
> + int ret;
> +
> + /* Caller should know better */
> + BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ));
> +
> + ctrl->hdr.class = VIRTIO_NET_CTRL_NOTF_COAL;
> + ctrl->hdr.cmd = VIRTIO_NET_CTRL_NOTF_COAL_VQS_SET;
> +
> + /* Add header */
> + sg_init_one(&hdr, &ctrl->hdr, sizeof(ctrl->hdr));
> + sgs[out_num++] = &hdr;
> +
> + /* Add body */
> + sg_init_one(&out, &ctrl->num_entries, sizeof(ctrl->num_entries) +
> + ctrl->num_entries * sizeof(struct virtnet_coal_entry));
Hi Heng Qi,
I am a bit confused.
With this series applied on top of net-next
struct virtnet_coal_entry doesn't seem to exist.
> + sgs[out_num++] = &out;
> +
> + /* Add return status. */
> + ctrl->status = VIRTIO_NET_OK;
> + sg_init_one(&stat, &ctrl->status, sizeof(ctrl->status));
> + sgs[out_num] = &stat;
> +
> + BUG_ON(out_num + 1 > ARRAY_SIZE(sgs));
> + ret = virtqueue_add_sgs(vi->cvq, sgs, out_num, 1, ctrl, GFP_ATOMIC);
> + if (ret < 0) {
> + dev_warn(&vi->vdev->dev, "Failed to add sgs for command vq: %d\n.", ret);
> + return false;
> + }
> +
> + virtqueue_kick(vi->cvq);
> +
> + ctrl->usable = false;
> + vi->cvq_cmd_nums++;
> +
> + return true;
> +}
...
next prev parent reply other threads:[~2024-01-16 19:56 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-16 13:11 [PATCH net-next 0/3] virtio-net: a fix and some updates for virtio dim Heng Qi
2024-01-16 13:11 ` [PATCH net-next 1/3] virtio-net: fix possible dim status unrecoverable Heng Qi
2024-01-16 13:15 ` Michael S. Tsirkin
2024-01-17 3:34 ` Heng Qi
2024-01-16 13:11 ` [PATCH net-next 2/3] virtio-net: batch dim request Heng Qi
2024-01-16 19:49 ` Simon Horman
2024-01-17 3:38 ` Heng Qi
2024-01-16 13:11 ` [PATCH net-next 3/3] virtio-net: reduce the CPU consumption of dim worker Heng Qi
2024-01-16 19:56 ` Simon Horman [this message]
2024-01-17 3:41 ` Heng Qi
2024-01-19 10:31 ` kernel test robot
2024-01-19 13:43 ` kernel test robot
2024-01-22 7:19 ` Xuan Zhuo
2024-01-22 7:42 ` Xuan Zhuo
2024-01-19 12:28 ` [PATCH net-next 0/3] virtio-net: a fix and some updates for virtio dim Michael S. Tsirkin
2024-01-19 14:20 ` Heng Qi
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=20240116195646.GF588419@kernel.org \
--to=horms@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hengqi@linux.alibaba.com \
--cc=jasowang@redhat.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 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.