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 8B014A0C55; Wed, 13 Oct 2021 12:06:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 183AC410DA; Wed, 13 Oct 2021 12:06:32 +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 56B2540150 for ; Wed, 13 Oct 2021 12:06:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634119590; 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=iafO7iLA/fW50Uu3u3lY8HCdPh36PP5h7/KzT6bsrGk=; b=aQVQq5sqzCoCiSeBFilClOIDk4bYlqRHSpyQWn/sJPaVLKfu2XONyvg4z27KnCIQ/svhrS MmRecIL5uQ/nqWkQJGmpEYrjdd8U7yto4Mme5aEYz7V8vmd7kYY+vAqrILApPfH2sfHbhf 9m8+Aw2LKJqanbr9kOnpECjiVDh28gc= 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-460-QH1dCoAHPrCsP8UJINgoCA-1; Wed, 13 Oct 2021 06:06:27 -0400 X-MC-Unique: QH1dCoAHPrCsP8UJINgoCA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 959E9362F8; Wed, 13 Oct 2021 10:06:26 +0000 (UTC) Received: from [10.39.208.25] (unknown [10.39.208.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9C2E05D9D5; Wed, 13 Oct 2021 10:06:25 +0000 (UTC) Message-ID: <033827d7-8f70-80e0-7dbb-22f501bc6df2@redhat.com> Date: Wed, 13 Oct 2021 12:06:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 To: Xueming Li , dev@dpdk.org Cc: Matan Azrad , Viacheslav Ovsiienko References: <20210923081758.178745-1-xuemingl@nvidia.com> <20210923081758.178745-2-xuemingl@nvidia.com> From: Maxime Coquelin In-Reply-To: <20210923081758.178745-2-xuemingl@nvidia.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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: 7bit Subject: Re: [dpdk-dev] [PATCH 2/2] vdpa/mlx5: retry VAR allocation during vDPA restart 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 9/23/21 10:17, Xueming Li wrote: > VAR is the device memory space for the virtio queues doorbells, qemu > could mmap it to directly to speed up doorbell push. > > On a busy system, Qemu takes time to release VAR resources during driver > shutdown. If vdpa restarted quickly, the VAR allocation failed with > error 28 since the VAR is singleton resource per device. > > This patch adds retry mechanism for VAR allocation. > > Signed-off-by: Xueming Li > Reviewed-by: Matan Azrad > --- > drivers/vdpa/mlx5/mlx5_vdpa.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c > index 6d17d7a6f3..991739e984 100644 > --- a/drivers/vdpa/mlx5/mlx5_vdpa.c > +++ b/drivers/vdpa/mlx5/mlx5_vdpa.c > @@ -693,7 +693,14 @@ mlx5_vdpa_dev_probe(struct rte_device *dev) > if (attr.num_lag_ports == 0) > priv->num_lag_ports = 1; > priv->ctx = ctx; > - priv->var = mlx5_glue->dv_alloc_var(ctx, 0); > + for (retry = 0; retry < 7; retry++) { > + priv->var = mlx5_glue->dv_alloc_var(ctx, 0); > + if (priv->var != NULL) > + break; > + DRV_LOG(WARNING, "Failed to allocate VAR, retry %d.\n", retry); > + /* Wait Qemu release VAR during vdpa restart, 0.1 sec based. */ > + usleep(100000U << retry); > + } > if (!priv->var) { > DRV_LOG(ERR, "Failed to allocate VAR %u.", errno); > goto error; > That looks fragile, but at least we have a warning we can rely on. Shouldn't we have a way to wait for Qemu to release the resources at vdpa driver shutdown time? Also as on patch 1, please add a Fixes tag it you want it to be backported. Regards, Maxime