From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C5EDC433F5 for ; Thu, 23 Sep 2021 08:34:12 +0000 (UTC) Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by mail.kernel.org (Postfix) with ESMTP id 9C1176105A for ; Thu, 23 Sep 2021 08:34:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9C1176105A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dpdk.org 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