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 4BEA6A0542; Wed, 26 Oct 2022 07:32:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3416140E28; Wed, 26 Oct 2022 07:32:59 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 18E5840A7F for ; Wed, 26 Oct 2022 07:32:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666762377; 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=C2nX+uKHW5OM1s6m+mk2jPkfpgITNnhY0Ynjov9DYq0=; b=OZ4wlorwMYehKO/qPq1XFry4BOmp4PWv1iQRsDcPjKMGZuKNlmH98dI3nGPG5SyJLMPWqe OkFEFvEFFtkRaTsmwwowCqfyaTGtZOrlV/occwbmytZPvhad5NdmL9crfoxwZWyVI93xbK 5/HhQms51V1Xu37hjjq9GB9BkFOeI3k= 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-27-bIJdT3l-M7afn2JDMvvQBA-1; Wed, 26 Oct 2022 01:32:50 -0400 X-MC-Unique: bIJdT3l-M7afn2JDMvvQBA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3A6B1833A0E; Wed, 26 Oct 2022 05:32:39 +0000 (UTC) Received: from [10.39.208.48] (unknown [10.39.208.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B65661415117; Wed, 26 Oct 2022 05:32:27 +0000 (UTC) Message-ID: Date: Wed, 26 Oct 2022 07:32:26 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 To: Abhishek Maheshwari , xiao.w.wang@intel.com, chenbo.xia@intel.com Cc: dev@dpdk.org, purna.chandra.mandal@intel.com References: <20221025075149.1713006-1-abhishek.maheshwari@intel.com> From: Maxime Coquelin Subject: Re: [PATCH] vdpa/ifc/base: wait for queue disable before saving q-state In-Reply-To: <20221025075149.1713006-1-abhishek.maheshwari@intel.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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 Hi Abhishek, On 10/25/22 09:51, Abhishek Maheshwari wrote: > Some ifc hardware require synchronization between disabling a queue and > saving queue-state from LM registers. When queue is disabled from vDPA > driver, ifc device stops executing new virtio-cmds and then updates LM > registers with used/avail index. Before saving the queue-state, vDPA > driver should wait until the queue is disabled from backend. I think it should be considered a fix, and so requires a Fixes tag and stable@dpdk.org to be cc'ed. > Signed-off-by: Abhishek Maheshwari > --- > drivers/vdpa/ifc/base/ifcvf.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/drivers/vdpa/ifc/base/ifcvf.c b/drivers/vdpa/ifc/base/ifcvf.c > index f1e1474447..76690c1f55 100644 > --- a/drivers/vdpa/ifc/base/ifcvf.c > +++ b/drivers/vdpa/ifc/base/ifcvf.c > @@ -257,6 +257,7 @@ ifcvf_hw_disable(struct ifcvf_hw *hw) > u32 i; > struct ifcvf_pci_common_cfg *cfg; > u32 ring_state; > + int q_disable_tries; > > cfg = hw->common_cfg; > if (!cfg) { > @@ -275,6 +276,20 @@ ifcvf_hw_disable(struct ifcvf_hw *hw) > continue; > } > > + /* Some ifc hardware require synchronization between disabling a queue > + * and saving queue-state from LM registers. When queue is disabled from > + * vDPA driver, ifc device stops executing new virtio-cmds and then > + * updates LM registers with used/avail index. Before saving the > + * queue-state, vDPA driver waits until the queue is disabled from > + * backend. > + */ > + q_disable_tries = 10; > + while (q_disable_tries-- && IFCVF_READ_REG16(&cfg->queue_enable)) > + msec_delay(10); > + > + if (IFCVF_READ_REG16(&cfg->queue_enable)) > + WARNINGOUT("Failed Q disable: %d. saved state is invalid\n", i); Maybe checking q_disable_tries > 0 is enough here. Also, should we really continue the disablement if synchronization failed? > + > if (hw->device_type == IFCVF_BLK) > ring_state = *(u32 *)(hw->lm_cfg + > IFCVF_LM_RING_STATE_OFFSET +