DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Xia, Chenbo" <chenbo.xia@intel.com>
To: "Maheshwari, Abhishek" <abhishek.maheshwari@intel.com>,
	"maxime.coquelin@redhat.com" <maxime.coquelin@redhat.com>,
	"Wang, Xiao W" <xiao.w.wang@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"stable@dpdk.org" <stable@dpdk.org>,
	"Mandal, Purna Chandra" <purna.chandra.mandal@intel.com>,
	"Pei, Andy" <andy.pei@intel.com>
Subject: RE: [PATCH v3] vdpa/ifc/base: wait for queue disable before saving q-state
Date: Thu, 3 Nov 2022 02:37:35 +0000	[thread overview]
Message-ID: <SN6PR11MB35040DA2A496EBDB542C6D959C389@SN6PR11MB3504.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20221102095458.2165448-1-abhishek.maheshwari@intel.com>

> -----Original Message-----
> From: Maheshwari, Abhishek <abhishek.maheshwari@intel.com>
> Sent: Wednesday, November 2, 2022 5:55 PM
> To: maxime.coquelin@redhat.com; Wang, Xiao W <xiao.w.wang@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org; Xia, Chenbo <chenbo.xia@intel.com>;
> Mandal, Purna Chandra <purna.chandra.mandal@intel.com>; Pei, Andy
> <andy.pei@intel.com>; Maheshwari, Abhishek <abhishek.maheshwari@intel.com>
> Subject: [PATCH v3] vdpa/ifc/base: wait for queue disable before saving q-
> state
> 
> 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.
> 
> Fixes: 5d75517beffe ("vdpa/ifc/base: access block device registers")
> Cc: andy.pei@intel.com

No need to add above next time

> Cc: stable@dpdk.org
> 
> Signed-off-by: Abhishek Maheshwari <abhishek.maheshwari@intel.com>
> 
> ---
> v2:
> * Fixing the styling issues
> * Addressing comment to avoid reading the register again after
>   exhausting the tries
> 
> v3:
> * Fixing warning condition
> ---
>  drivers/vdpa/ifc/base/ifcvf.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/vdpa/ifc/base/ifcvf.c b/drivers/vdpa/ifc/base/ifcvf.c
> index f1e1474447..06996fd5d7 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_try;
> 
>  	cfg = hw->common_cfg;
>  	if (!cfg) {
> @@ -275,6 +276,21 @@ 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_try = 10;
> +		while (q_disable_try-- && IFCVF_READ_REG16(&cfg->queue_enable))
> +			msec_delay(10);
> +
> +		if (!q_disable_try)
> +			WARNINGOUT("Failed Q:%d disable, Saved state invalid\n",
> +				   i);

No need to start a new line here.

Thanks,
Chenbo

> +
>  		if (hw->device_type == IFCVF_BLK)
>  			ring_state = *(u32 *)(hw->lm_cfg +
>  					IFCVF_LM_RING_STATE_OFFSET +
> --
> 2.31.1


  parent reply	other threads:[~2022-11-03  2:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-25  7:23 [PATCH] " Abhishek Maheshwari
2022-11-02  3:22 ` [PATCH v2] " Abhishek Maheshwari
2022-11-02  9:54   ` [PATCH v3] " Abhishek Maheshwari
2022-11-02 14:56     ` Pei, Andy
2022-11-03  2:37     ` Xia, Chenbo [this message]
2022-11-03  4:36     ` [PATCH v4] " Abhishek Maheshwari
2022-11-03  9:35       ` [PATCH v5] " Abhishek Maheshwari
2022-11-04  2:31         ` Xia, Chenbo
2022-11-04  2:38         ` Mandal, Purna Chandra
2022-11-10  7:02         ` Xia, Chenbo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SN6PR11MB35040DA2A496EBDB542C6D959C389@SN6PR11MB3504.namprd11.prod.outlook.com \
    --to=chenbo.xia@intel.com \
    --cc=abhishek.maheshwari@intel.com \
    --cc=andy.pei@intel.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=purna.chandra.mandal@intel.com \
    --cc=stable@dpdk.org \
    --cc=xiao.w.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).