From patchwork Tue Jun 29 16:11:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 94991 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E938BA0C3F; Tue, 29 Jun 2021 18:12:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8DC62411C9; Tue, 29 Jun 2021 18:11:54 +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 3BE56411D2 for ; Tue, 29 Jun 2021 18:11:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624983110; 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=4nA/YdQzawgs4cnJ0LJABUiVp395zGgXIjBbifv+O5A=; b=GlqF+B0RINa+fOVtY5e80HRNUokNz5ivBKFvY5onTqNw1ke1tDIrx48dNQ08ovmyfhVEnv 9vX8EZpc1ZgNqutlIpaEdRwmjGTb2OLEOplxWaYmCG4ds8fQDHh+Gp28dZ2+jDEUqXEbSN RtVA9WmNf89r925kDixScWnZmltyNtY= 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-263-TzhTpWCcO1aptPastIaYMw-1; Tue, 29 Jun 2021 12:11:49 -0400 X-MC-Unique: TzhTpWCcO1aptPastIaYMw-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 F39061835AC7; Tue, 29 Jun 2021 16:11:47 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.36.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id E0FBA5C1D0; Tue, 29 Jun 2021 16:11:46 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, chenbo.xia@intel.com, david.marchand@redhat.com Cc: Maxime Coquelin Date: Tue, 29 Jun 2021 18:11:29 +0200 Message-Id: <20210629161133.79472-4-maxime.coquelin@redhat.com> In-Reply-To: <20210629161133.79472-1-maxime.coquelin@redhat.com> References: <20210629161133.79472-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 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 Subject: [dpdk-dev] [PATCH v7 3/7] vhost: fix missing cache logging NUMA realloc 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" When the guest allocates virtqueues on a different NUMA node than the one the Vhost metadata are allocated, both the Vhost device struct and the virtqueues struct are reallocated. However, reallocating the log cache on the new NUMA node was not done. This patch fixes this by reallocating it if it has been allocated already, which means a live-migration is on-going. Fixes: 1818a63147fb ("vhost: move dirty logging cache out of virtqueue") Signed-off-by: Maxime Coquelin Reviewed-by: Chenbo Xia --- lib/vhost/vhost_user.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c index 5fb055ea2e..82adf80fe5 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -545,6 +545,16 @@ numa_realloc(struct virtio_net *dev, int index) vq->batch_copy_elems = new_batch_copy_elems; } + if (vq->log_cache) { + struct log_cache_entry *log_cache; + + log_cache = rte_realloc_socket(vq->log_cache, + sizeof(struct log_cache_entry) * VHOST_LOG_CACHE_NR, + 0, newnode); + if (log_cache) + vq->log_cache = log_cache; + } + rte_free(old_vq); }