From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1D6DBA0C43; Thu, 23 Sep 2021 10:34:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8ECED41225; Thu, 23 Sep 2021 10:34:10 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id 62FD7410DD for ; Thu, 23 Sep 2021 10:34:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632386047; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EoQxd/8QfJx+7UUvAVaYFdoXCNa8s30PWxBSNugD38U=; b=Dbp1NHg3lxfcRYHYexYE0wZCx1b+ZT+HLueweyDBRm2Mij432cBQb8Xs+Jwi0xHZ330FbE 7cyauJXgVF/Lpc1xfY2XHQl1Z1UW1WONtYlOHZ9KQcB5iSaP2M9edkBENCm8VbCLTNvKT4 ViEmAwWetD+F430odukuGu3OauwVTxM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-93-01OOWYwROkiq-6LSLlAIwA-1; Thu, 23 Sep 2021 04:34:04 -0400 X-MC-Unique: 01OOWYwROkiq-6LSLlAIwA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8AA351006AA4; Thu, 23 Sep 2021 08:34:03 +0000 (UTC) Received: from [10.39.208.17] (unknown [10.39.208.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6768E1800D; Thu, 23 Sep 2021 08:34:02 +0000 (UTC) Message-ID: Date: Thu, 23 Sep 2021 10:34:00 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 To: =?UTF-8?Q?Eugenio_P=c3=a9rez?= , Chenbo Xia Cc: dev@dpdk.org, Pei Zhang , Jason Wang References: <20210827161231.579968-1-eperezma@redhat.com> From: Maxime Coquelin In-Reply-To: <20210827161231.579968-1-eperezma@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH] vhost: Clean iotlb cache on vring stop X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 8/27/21 18:12, Eugenio Pérez wrote: > Old IOVA cache entries are left when there is a change on virtio driver > in VM. In case that all these old entries have iova addresses lesser > than new iova entries, vhost code will need to iterate all the cache to > find the new ones. In case of just a new iova entry needed for the new > translations, this condition will last forever. > > This has been observed in virtio-net to testpmd's vfio-pci driver > transition, reducing the performance from more than 10Mpps to less than > 0.07Mpps if the hugepage address was higher than the networking > buffers. Since all new buffers are contained in this new gigantic page, > vhost needs to scan IOTLB_CACHE_SIZE - 1 for each translation at worst. > > Signed-off-by: Eugenio Pérez > Reported-by: Pei Zhang > --- > lib/vhost/vhost_user.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c > index 29a4c9af60..7de48f5333 100644 > --- a/lib/vhost/vhost_user.c > +++ b/lib/vhost/vhost_user.c > @@ -2113,6 +2113,8 @@ vhost_user_get_vring_base(struct virtio_net **pdev, > msg->size = sizeof(msg->payload.state); > msg->fd_num = 0; > > + vhost_user_iotlb_flush_all(vq); > + > vring_invalidate(dev, vq); > > return RTE_VHOST_MSG_RESULT_REPLY; > Reviewed-by: Maxime Coquelin Thanks, Maxime