lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <120c62f5-f1ae-4269-9933-a3ce62220af4@linux.alibaba.com>
Date: Wed, 17 Jan 2024 11:41:04 +0800
From: Heng Qi <hengqi@...ux.alibaba.com>
To: Simon Horman <horms@...nel.org>
Cc: netdev@...r.kernel.org, virtualization@...ts.linux.dev,
 Jason Wang <jasowang@...hat.com>, "Michael S. Tsirkin" <mst@...hat.com>,
 Paolo Abeni <pabeni@...hat.com>, Jakub Kicinski <kuba@...nel.org>,
 Eric Dumazet <edumazet@...gle.com>, "David S. Miller" <davem@...emloft.net>,
 Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
Subject: Re: [PATCH net-next 3/3] virtio-net: reduce the CPU consumption of
 dim worker



在 2024/1/17 上午3:56, Simon Horman 写道:
> 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@...ux.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.

Hi Simon,

It should be struct virtio_net_ctrl_coal_vq.

Thanks.

>
>
>> +	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;
>> +}
> ...


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ