* [PATCH v2] vdpa/ifc/base: wait for queue disable before saving q-state
[not found] <20221025072302.1683505-1-abhishek.maheshwari@intel.com>
@ 2022-11-02 3:22 ` Abhishek Maheshwari
2022-11-02 9:54 ` [PATCH v3] " Abhishek Maheshwari
0 siblings, 1 reply; 10+ messages in thread
From: Abhishek Maheshwari @ 2022-11-02 3:22 UTC (permalink / raw)
To: maxime.coquelin, xiao.w.wang
Cc: dev, stable, chenbo.xia, purna.chandra.mandal, andy.pei,
Abhishek Maheshwari
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
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
---
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..281366f2a0 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 > 0)
+ WARNINGOUT("Failed Q:%d disable, Saved state invalid\n",
+ i);
+
if (hw->device_type == IFCVF_BLK)
ring_state = *(u32 *)(hw->lm_cfg +
IFCVF_LM_RING_STATE_OFFSET +
--
2.31.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3] vdpa/ifc/base: wait for queue disable before saving q-state
2022-11-02 3:22 ` [PATCH v2] vdpa/ifc/base: wait for queue disable before saving q-state Abhishek Maheshwari
@ 2022-11-02 9:54 ` Abhishek Maheshwari
2022-11-02 14:56 ` Pei, Andy
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Abhishek Maheshwari @ 2022-11-02 9:54 UTC (permalink / raw)
To: maxime.coquelin, xiao.w.wang
Cc: dev, stable, chenbo.xia, purna.chandra.mandal, andy.pei,
Abhishek Maheshwari
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
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);
+
if (hw->device_type == IFCVF_BLK)
ring_state = *(u32 *)(hw->lm_cfg +
IFCVF_LM_RING_STATE_OFFSET +
--
2.31.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH v3] vdpa/ifc/base: wait for queue disable before saving q-state
2022-11-02 9:54 ` [PATCH v3] " Abhishek Maheshwari
@ 2022-11-02 14:56 ` Pei, Andy
2022-11-03 2:37 ` Xia, Chenbo
2022-11-03 4:36 ` [PATCH v4] " Abhishek Maheshwari
2 siblings, 0 replies; 10+ messages in thread
From: Pei, Andy @ 2022-11-02 14:56 UTC (permalink / raw)
To: Maheshwari, Abhishek, maxime.coquelin, Wang, Xiao W
Cc: dev, stable, Xia, Chenbo, Mandal, Purna Chandra
> -----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
> 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);
> +
> if (hw->device_type == IFCVF_BLK)
> ring_state = *(u32 *)(hw->lm_cfg +
> IFCVF_LM_RING_STATE_OFFSET +
> --
> 2.31.1
Acked-by: Andy Pei <andy.pei@intel.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH v3] vdpa/ifc/base: wait for queue disable before saving q-state
2022-11-02 9:54 ` [PATCH v3] " Abhishek Maheshwari
2022-11-02 14:56 ` Pei, Andy
@ 2022-11-03 2:37 ` Xia, Chenbo
2022-11-03 4:36 ` [PATCH v4] " Abhishek Maheshwari
2 siblings, 0 replies; 10+ messages in thread
From: Xia, Chenbo @ 2022-11-03 2:37 UTC (permalink / raw)
To: Maheshwari, Abhishek, maxime.coquelin, Wang, Xiao W
Cc: dev, stable, Mandal, Purna Chandra, Pei, Andy
> -----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
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v4] vdpa/ifc/base: wait for queue disable before saving q-state
2022-11-02 9:54 ` [PATCH v3] " Abhishek Maheshwari
2022-11-02 14:56 ` Pei, Andy
2022-11-03 2:37 ` Xia, Chenbo
@ 2022-11-03 4:36 ` Abhishek Maheshwari
2022-11-03 9:35 ` [PATCH v5] " Abhishek Maheshwari
2 siblings, 1 reply; 10+ messages in thread
From: Abhishek Maheshwari @ 2022-11-03 4:36 UTC (permalink / raw)
To: maxime.coquelin, xiao.w.wang
Cc: dev, stable, chenbo.xia, purna.chandra.mandal, andy.pei,
Abhishek Maheshwari
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
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
v4:
* Fixing print argument format to %u in warning
---
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..929eaafff2 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:%u disable, Saved state invalid\n",
+ i);
+
if (hw->device_type == IFCVF_BLK)
ring_state = *(u32 *)(hw->lm_cfg +
IFCVF_LM_RING_STATE_OFFSET +
--
2.31.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v5] vdpa/ifc/base: wait for queue disable before saving q-state
2022-11-03 4:36 ` [PATCH v4] " Abhishek Maheshwari
@ 2022-11-03 9:35 ` Abhishek Maheshwari
2022-11-04 2:31 ` Xia, Chenbo
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Abhishek Maheshwari @ 2022-11-03 9:35 UTC (permalink / raw)
To: maxime.coquelin, xiao.w.wang
Cc: dev, stable, chenbo.xia, purna.chandra.mandal, Abhishek Maheshwari
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: 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
v4:
* Fixing print argument format to %u in warning
v5:
* Addressing comments based on input that line length limit is 100
---
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..60555a6786 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,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_try = 10;
+ while (q_disable_try-- && IFCVF_READ_REG16(&cfg->queue_enable))
+ msec_delay(10);
+
+ if (!q_disable_try)
+ WARNINGOUT("Failed to disable Q:%u, Saved state could be invalid\n", i);
+
if (hw->device_type == IFCVF_BLK)
ring_state = *(u32 *)(hw->lm_cfg +
IFCVF_LM_RING_STATE_OFFSET +
--
2.31.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH v5] vdpa/ifc/base: wait for queue disable before saving q-state
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
2 siblings, 0 replies; 10+ messages in thread
From: Xia, Chenbo @ 2022-11-04 2:31 UTC (permalink / raw)
To: Maheshwari, Abhishek, maxime.coquelin, Wang, Xiao W
Cc: dev, stable, Mandal, Purna Chandra, Pei, Andy
> -----Original Message-----
> From: Maheshwari, Abhishek <abhishek.maheshwari@intel.com>
> Sent: Thursday, November 3, 2022 5:35 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>; Maheshwari,
> Abhishek <abhishek.maheshwari@intel.com>
> Subject: [PATCH v5] 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")
>
Will remove above blank line and add Andy's A-By when applying
For this patch:
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
> 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
>
> v4:
> * Fixing print argument format to %u in warning
>
> v5:
> * Addressing comments based on input that line length limit is 100
> ---
> 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..60555a6786 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,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_try = 10;
> + while (q_disable_try-- && IFCVF_READ_REG16(&cfg->queue_enable))
> + msec_delay(10);
> +
> + if (!q_disable_try)
> + WARNINGOUT("Failed to disable Q:%u, Saved state could be
> invalid\n", i);
> +
> if (hw->device_type == IFCVF_BLK)
> ring_state = *(u32 *)(hw->lm_cfg +
> IFCVF_LM_RING_STATE_OFFSET +
> --
> 2.31.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH v5] vdpa/ifc/base: wait for queue disable before saving q-state
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
2 siblings, 0 replies; 10+ messages in thread
From: Mandal, Purna Chandra @ 2022-11-04 2:38 UTC (permalink / raw)
To: Maheshwari, Abhishek, maxime.coquelin, Wang, Xiao W
Cc: dev, stable, Xia, Chenbo
-----Original Message-----
From: Maheshwari, Abhishek <abhishek.maheshwari@intel.com>
Sent: Thursday, November 3, 2022 3:05 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>; Maheshwari, Abhishek <abhishek.maheshwari@intel.com>
Subject: [PATCH v5] 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: 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
v4:
* Fixing print argument format to %u in warning
v5:
* Addressing comments based on input that line length limit is 100
---
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..60555a6786 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,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_try = 10;
+ while (q_disable_try-- && IFCVF_READ_REG16(&cfg->queue_enable))
+ msec_delay(10);
+
+ if (!q_disable_try)
+ WARNINGOUT("Failed to disable Q:%u, Saved state could be invalid\n",
+i);
+
if (hw->device_type == IFCVF_BLK)
ring_state = *(u32 *)(hw->lm_cfg +
IFCVF_LM_RING_STATE_OFFSET +
--
2.31.1
Ack. Reviewed by Purna Chandra Mandal <purna.chandra,mandal@intel.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH v5] vdpa/ifc/base: wait for queue disable before saving q-state
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
2 siblings, 0 replies; 10+ messages in thread
From: Xia, Chenbo @ 2022-11-10 7:02 UTC (permalink / raw)
To: Maheshwari, Abhishek, maxime.coquelin, Wang, Xiao W
Cc: dev, stable, Mandal, Purna Chandra
> -----Original Message-----
> From: Maheshwari, Abhishek <abhishek.maheshwari@intel.com>
> Sent: Thursday, November 3, 2022 5:35 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>; Maheshwari,
> Abhishek <abhishek.maheshwari@intel.com>
> Subject: [PATCH v5] 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: 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
>
> v4:
> * Fixing print argument format to %u in warning
>
> v5:
> * Addressing comments based on input that line length limit is 100
> ---
> 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..60555a6786 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,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_try = 10;
> + while (q_disable_try-- && IFCVF_READ_REG16(&cfg->queue_enable))
> + msec_delay(10);
> +
> + if (!q_disable_try)
> + WARNINGOUT("Failed to disable Q:%u, Saved state could be
> invalid\n", i);
> +
> if (hw->device_type == IFCVF_BLK)
> ring_state = *(u32 *)(hw->lm_cfg +
> IFCVF_LM_RING_STATE_OFFSET +
> --
> 2.31.1
Applied to next-virtio/main, thanks
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2] vdpa/ifc/base: wait for queue disable before saving q-state
@ 2022-11-02 3:04 Abhishek Maheshwari
0 siblings, 0 replies; 10+ messages in thread
From: Abhishek Maheshwari @ 2022-11-02 3:04 UTC (permalink / raw)
To: maxime.coquelin, xiao.w.wang
Cc: dev, stable, chenbo.xia, purna.chandra.mandal, andy.pei,
Abhishek Maheshwari
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
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
---
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..59d5ac765e 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 > 0)
+ WARNINGOUT("Failed Q disable: %d. Saved state is invalid\n",
+ i);
+
if (hw->device_type == IFCVF_BLK)
ring_state = *(u32 *)(hw->lm_cfg +
IFCVF_LM_RING_STATE_OFFSET +
--
2.31.1
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-11-10 7:02 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20221025072302.1683505-1-abhishek.maheshwari@intel.com>
2022-11-02 3:22 ` [PATCH v2] vdpa/ifc/base: wait for queue disable before saving q-state 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
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
2022-11-02 3:04 [PATCH v2] " Abhishek Maheshwari
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).