diff mbox series

[v2,1/2] dmaengine: idxd: Set wq state to disabled in idxd_wq_disable_cleanup()

Message ID 20220928154856.623545-2-jsnitsel@redhat.com (mailing list archive)
State Accepted
Commit 8e527aac055557897d43a3d74d7970ef5cf6a8bb
Headers show
Series dmaengine: idxd: Fix up re-enabling device workqueues | expand

Commit Message

Jerry Snitselaar Sept. 28, 2022, 3:48 p.m. UTC
If we are calling idxd_wq_disable_cleanup(), the workqueue should be
in a disabled state. So set the workqueue state to IDXD_WQ_DISABLED so
that the state reflects that. Currently if there is a device failure,
and a software reset is attempted the workqueues will not be
re-enabled due to idxd_wq_enable() seeing that state as already being
IDXD_WQ_ENABLED.

Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
---
 drivers/dma/idxd/device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dave Jiang Sept. 28, 2022, 3:54 p.m. UTC | #1
On 9/28/2022 8:48 AM, Jerry Snitselaar wrote:
> If we are calling idxd_wq_disable_cleanup(), the workqueue should be
> in a disabled state. So set the workqueue state to IDXD_WQ_DISABLED so
> that the state reflects that. Currently if there is a device failure,
> and a software reset is attempted the workqueues will not be
> re-enabled due to idxd_wq_enable() seeing that state as already being
> IDXD_WQ_ENABLED.
>
> Cc: Fenghua Yu <fenghua.yu@intel.com>
> Cc: Dave Jiang <dave.jiang@intel.com>
> Cc: Vinod Koul <vkoul@kernel.org>
> Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>


> ---
>   drivers/dma/idxd/device.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
> index 5a8cc52c1abf..31911e255ac1 100644
> --- a/drivers/dma/idxd/device.c
> +++ b/drivers/dma/idxd/device.c
> @@ -258,7 +258,6 @@ void idxd_wq_reset(struct idxd_wq *wq)
>   	operand = BIT(wq->id % 16) | ((wq->id / 16) << 16);
>   	idxd_cmd_exec(idxd, IDXD_CMD_RESET_WQ, operand, NULL);
>   	idxd_wq_disable_cleanup(wq);
> -	wq->state = IDXD_WQ_DISABLED;
>   }
>   
>   int idxd_wq_map_portal(struct idxd_wq *wq)
> @@ -378,6 +377,7 @@ static void idxd_wq_disable_cleanup(struct idxd_wq *wq)
>   	struct idxd_device *idxd = wq->idxd;
>   
>   	lockdep_assert_held(&wq->wq_lock);
> +	wq->state = IDXD_WQ_DISABLED;
>   	memset(wq->wqcfg, 0, idxd->wqcfg_size);
>   	wq->type = IDXD_WQT_NONE;
>   	wq->threshold = 0;
diff mbox series

Patch

diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
index 5a8cc52c1abf..31911e255ac1 100644
--- a/drivers/dma/idxd/device.c
+++ b/drivers/dma/idxd/device.c
@@ -258,7 +258,6 @@  void idxd_wq_reset(struct idxd_wq *wq)
 	operand = BIT(wq->id % 16) | ((wq->id / 16) << 16);
 	idxd_cmd_exec(idxd, IDXD_CMD_RESET_WQ, operand, NULL);
 	idxd_wq_disable_cleanup(wq);
-	wq->state = IDXD_WQ_DISABLED;
 }
 
 int idxd_wq_map_portal(struct idxd_wq *wq)
@@ -378,6 +377,7 @@  static void idxd_wq_disable_cleanup(struct idxd_wq *wq)
 	struct idxd_device *idxd = wq->idxd;
 
 	lockdep_assert_held(&wq->wq_lock);
+	wq->state = IDXD_WQ_DISABLED;
 	memset(wq->wqcfg, 0, idxd->wqcfg_size);
 	wq->type = IDXD_WQT_NONE;
 	wq->threshold = 0;