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 946BA42355; Thu, 12 Oct 2023 15:45:21 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6265C40633; Thu, 12 Oct 2023 15:45:19 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 77035402C9 for ; Thu, 12 Oct 2023 15:45:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697118317; 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=QcS+UlwKcYNn6X90R+tLYEAMdcZOrkH5PK+ssrst2go=; b=Y+vLZa94tzZYNcMIuuGU6UvTjwWbKxozd2fmsezLLC1bTl9kYUptkTbltGT6oFWMQ607Wz 6xAb9gWNFDvlx1xGqT40o5QA5eM55eFWry4tW052aOPZI9oYdRhJlQuCyMnW0QvBoaery9 t4q+Gd4D3MhVw9ilr7i2CE/b4OrZMpc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-650-HUm7qjjsOC2O5muZh1jUZw-1; Thu, 12 Oct 2023 09:44:55 -0400 X-MC-Unique: HUm7qjjsOC2O5muZh1jUZw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3C6A081DA87; Thu, 12 Oct 2023 13:44:55 +0000 (UTC) Received: from [10.39.208.36] (unknown [10.39.208.36]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5920AC15BBC; Thu, 12 Oct 2023 13:44:53 +0000 (UTC) Message-ID: <166bee66-2be8-5850-deaf-6e00dd9b38ea@redhat.com> Date: Thu, 12 Oct 2023 15:44:52 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH] vdpa/mlx5: fix unregister kick handler order To: Yajun Wu , matan@nvidia.com, Viacheslav Ovsiienko , Li Zhang Cc: dev@dpdk.org, thomas@monjalon.net, rasland@nvidia.com, roniba@nvidia.com, stable@dpdk.org References: <20230808113221.227319-1-yajunw@nvidia.com> From: Maxime Coquelin In-Reply-To: <20230808113221.227319-1-yajunw@nvidia.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 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: 7bit 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 On 8/8/23 13:32, Yajun Wu wrote: > The mlx5_vdpa_virtq_kick_handler function may still be running and waiting > on virtq->virtq_lock while mlx5_vdpa_cqe_event_unset function is trying to > re-initialize the virtq->virtq_lock. > > This causes mlx5_vdpa_virtq_kick_handler thread can't be wake up and can't > be unregister. Following print may loop forever when calling > rte_vhost_driver_unregister(socket_path): > > mlx5_vdpa: Try again to unregister fd 154 of virtq 11 interrupt > mlx5_vdpa: Try again to unregister fd 154 of virtq 11 interrupt > ... > > The fix is to move mlx5_vdpa_virtq_unregister_intr_handle before > mlx5_vdpa_cqe_event_unset. > > Fixes: 057f7d2084 ("vdpa/mlx5: optimize datapath-control synchronization") > Cc: stable@dpdk.org > > Signed-off-by: Yajun Wu > Acked-by: Matan Azrad > --- > drivers/vdpa/mlx5/mlx5_vdpa.c | 1 + > drivers/vdpa/mlx5/mlx5_vdpa_cthread.c | 1 - > 2 files changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c > index f1737f82a8..8b1de8bd62 100644 > --- a/drivers/vdpa/mlx5/mlx5_vdpa.c > +++ b/drivers/vdpa/mlx5/mlx5_vdpa.c > @@ -282,6 +282,7 @@ _internal_mlx5_vdpa_dev_close(struct mlx5_vdpa_priv *priv, > int ret = 0; > int vid = priv->vid; > > + mlx5_vdpa_virtq_unreg_intr_handle_all(priv); > mlx5_vdpa_cqe_event_unset(priv); > if (priv->state == MLX5_VDPA_STATE_CONFIGURED) { > ret |= mlx5_vdpa_lm_log(priv); > diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_cthread.c b/drivers/vdpa/mlx5/mlx5_vdpa_cthread.c > index 6e6624e5a3..1d84e422d4 100644 > --- a/drivers/vdpa/mlx5/mlx5_vdpa_cthread.c > +++ b/drivers/vdpa/mlx5/mlx5_vdpa_cthread.c > @@ -190,7 +190,6 @@ mlx5_vdpa_c_thread_handle(void *arg) > pthread_mutex_unlock(&virtq->virtq_lock); > break; > case MLX5_VDPA_TASK_DEV_CLOSE_NOWAIT: > - mlx5_vdpa_virtq_unreg_intr_handle_all(priv); > pthread_mutex_lock(&priv->steer_update_lock); > mlx5_vdpa_steer_unset(priv); > pthread_mutex_unlock(&priv->steer_update_lock); Reviewed-by: Maxime Coquelin Thanks, Maxime