virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>,
	xiangxia.m.yue@gmail.com
Cc: netdev@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	Tonghao Zhang <zhangtonghao@didichuxing.com>,
	mst@redhat.com
Subject: Re: [PATCH net-next v5 3/4] net: vhost: factor out busy polling logic to vhost_net_busy_poll()
Date: Wed, 4 Jul 2018 17:18:09 +0800	[thread overview]
Message-ID: <6ca28b13-637e-8650-30a4-bb3f2ea96852@redhat.com> (raw)
In-Reply-To: <808dea9b-6240-8055-acaa-a1b96389a673@lab.ntt.co.jp>



On 2018年07月04日 15:59, Toshiaki Makita wrote:
> On 2018/07/04 13:31, xiangxia.m.yue@gmail.com wrote:
> ...
>> +static void vhost_net_busy_poll(struct vhost_net *net,
>> +				struct vhost_virtqueue *rvq,
>> +				struct vhost_virtqueue *tvq,
>> +				bool rx)
>> +{
>> +	unsigned long uninitialized_var(endtime);
>> +	unsigned long busyloop_timeout;
>> +	struct socket *sock;
>> +	struct vhost_virtqueue *vq = rx ? tvq : rvq;
>> +
>> +	mutex_lock_nested(&vq->mutex, rx ? VHOST_NET_VQ_TX: VHOST_NET_VQ_RX);
>> +
>> +	vhost_disable_notify(&net->dev, vq);
>> +	sock = rvq->private_data;
>> +	busyloop_timeout = rx ? rvq->busyloop_timeout : tvq->busyloop_timeout;
>> +
>> +	preempt_disable();
>> +	endtime = busy_clock() + busyloop_timeout;
>> +	while (vhost_can_busy_poll(tvq->dev, endtime) &&
>> +	       !(sock && sk_has_rx_data(sock->sk)) &&
>> +	       vhost_vq_avail_empty(tvq->dev, tvq))
>> +		cpu_relax();
>> +	preempt_enable();
>> +
>> +	if ((rx && !vhost_vq_avail_empty(&net->dev, vq)) ||
>> +	    (!rx && (sock && sk_has_rx_data(sock->sk)))) {
>> +		vhost_poll_queue(&vq->poll);
>> +	} else if (vhost_enable_notify(&net->dev, vq) && rx) {
> Hmm... on tx here sock has no rx data, so you are waiting for sock
> wakeup for rx and vhost_enable_notify() seems not needed. Do you want
> this actually?
>
> } else if (rx && vhost_enable_notify(&net->dev, vq)) {

Right, rx need to be checked first here.

Thanks

>> +		vhost_disable_notify(&net->dev, vq);
>> +		vhost_poll_queue(&vq->poll);
>> +	}

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2018-07-04  9:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-04  4:31 [PATCH net-next v5 0/4] net: vhost: improve performance when enable busyloop xiangxia.m.yue
2018-07-04  4:31 ` [PATCH net-next v5 1/4] net: vhost: lock the vqs one by one xiangxia.m.yue
2018-07-04  4:31 ` [PATCH net-next v5 2/4] net: vhost: replace magic number of lock annotation xiangxia.m.yue
2018-07-04  4:31 ` [PATCH net-next v5 3/4] net: vhost: factor out busy polling logic to vhost_net_busy_poll() xiangxia.m.yue
2018-07-04  4:31 ` [PATCH net-next v5 4/4] net: vhost: add rx busy polling in tx path xiangxia.m.yue
2018-07-04  6:27 ` [PATCH net-next v5 0/4] net: vhost: improve performance when enable busyloop Jason Wang
     [not found] ` <1530678698-33427-4-git-send-email-xiangxia.m.yue@gmail.com>
2018-07-04  7:59   ` [PATCH net-next v5 3/4] net: vhost: factor out busy polling logic to vhost_net_busy_poll() Toshiaki Makita
2018-07-04  9:18     ` Jason Wang [this message]
2018-07-04  9:46       ` Tonghao Zhang
2018-07-04 11:59         ` Jason Wang
2018-07-11  2:56 ` [PATCH net-next v5 0/4] net: vhost: improve performance when enable busyloop Jason Wang
     [not found] ` <934375dc-8925-c271-b2b0-b224ff5191c2@redhat.com>
2018-07-11  3:49   ` Tonghao Zhang
2018-07-11  5:12     ` Jason Wang
     [not found]     ` <4901593f-1d9e-2c47-b963-5fc1f48a1bfe@redhat.com>
2018-07-11 11:59       ` Michael S. Tsirkin
     [not found]       ` <20180711145421-mutt-send-email-mst@kernel.org>
2018-07-12  3:26         ` Jason Wang
2018-07-12  3:34           ` Michael S. Tsirkin
     [not found]           ` <20180712062756-mutt-send-email-mst@kernel.org>
2018-07-12  5:21             ` Jason Wang
     [not found]             ` <2898b8aa-8a7c-06ad-9dc0-0e97e2f8e417@redhat.com>
2018-07-12  5:24               ` Michael S. Tsirkin
2018-07-12  5:51                 ` Jason Wang

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=6ca28b13-637e-8650-30a4-bb3f2ea96852@redhat.com \
    --to=jasowang@redhat.com \
    --cc=makita.toshiaki@lab.ntt.co.jp \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xiangxia.m.yue@gmail.com \
    --cc=zhangtonghao@didichuxing.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;
as well as URLs for NNTP newsgroup(s).