linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: idxd: Remove unnecessary synchronize_irq() before free_irq()
@ 2022-05-13  8:16 cgel.zte
  2022-05-13 14:30 ` Dave Jiang
  2022-05-16 11:32 ` Vinod Koul
  0 siblings, 2 replies; 5+ messages in thread
From: cgel.zte @ 2022-05-13  8:16 UTC (permalink / raw)
  To: dave.jiang; +Cc: vkoul, dmaengine, linux-kernel, Minghao Chi, Zeal Robot

From: Minghao Chi <chi.minghao@zte.com.cn>

Calling synchronize_irq() right before free_irq() is quite useless. On one
hand the IRQ can easily fire again before free_irq() is entered, on the
other hand free_irq() itself calls synchronize_irq() internally (in a race
condition free way) before any state associated with the IRQ is freed.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
 drivers/dma/idxd/device.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
index 5363fb9218f2..9dd8e6bb21e6 100644
--- a/drivers/dma/idxd/device.c
+++ b/drivers/dma/idxd/device.c
@@ -1179,7 +1179,6 @@ void idxd_wq_free_irq(struct idxd_wq *wq)
 	struct idxd_device *idxd = wq->idxd;
 	struct idxd_irq_entry *ie = &wq->ie;
 
-	synchronize_irq(ie->vector);
 	free_irq(ie->vector, ie);
 	idxd_flush_pending_descs(ie);
 	if (idxd->request_int_handles)
--
2.25.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] dmaengine: idxd: Remove unnecessary synchronize_irq() before free_irq()
  2022-05-13  8:16 [PATCH] dmaengine: idxd: Remove unnecessary synchronize_irq() before free_irq() cgel.zte
@ 2022-05-13 14:30 ` Dave Jiang
  2022-05-16 11:32 ` Vinod Koul
  1 sibling, 0 replies; 5+ messages in thread
From: Dave Jiang @ 2022-05-13 14:30 UTC (permalink / raw)
  To: cgel.zte; +Cc: vkoul, dmaengine, linux-kernel, Minghao Chi, Zeal Robot


On 5/13/2022 1:16 AM, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
>
> Calling synchronize_irq() right before free_irq() is quite useless. On one
> hand the IRQ can easily fire again before free_irq() is entered, on the
> other hand free_irq() itself calls synchronize_irq() internally (in a race
> condition free way) before any state associated with the IRQ is freed.

Fair enough. Thanks.

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


>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> ---
>   drivers/dma/idxd/device.c | 1 -
>   1 file changed, 1 deletion(-)
>
> diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
> index 5363fb9218f2..9dd8e6bb21e6 100644
> --- a/drivers/dma/idxd/device.c
> +++ b/drivers/dma/idxd/device.c
> @@ -1179,7 +1179,6 @@ void idxd_wq_free_irq(struct idxd_wq *wq)
>   	struct idxd_device *idxd = wq->idxd;
>   	struct idxd_irq_entry *ie = &wq->ie;
>   
> -	synchronize_irq(ie->vector);
>   	free_irq(ie->vector, ie);
>   	idxd_flush_pending_descs(ie);
>   	if (idxd->request_int_handles)
> --
> 2.25.1
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] dmaengine: idxd: Remove unnecessary synchronize_irq() before free_irq()
  2022-05-13  8:16 [PATCH] dmaengine: idxd: Remove unnecessary synchronize_irq() before free_irq() cgel.zte
  2022-05-13 14:30 ` Dave Jiang
@ 2022-05-16 11:32 ` Vinod Koul
  2022-05-16 11:54   ` [PATCH V2] " cgel.zte
  1 sibling, 1 reply; 5+ messages in thread
From: Vinod Koul @ 2022-05-16 11:32 UTC (permalink / raw)
  To: cgel.zte; +Cc: dave.jiang, dmaengine, linux-kernel, Minghao Chi, Zeal Robot

On 13-05-22, 08:16, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> Calling synchronize_irq() right before free_irq() is quite useless. On one
> hand the IRQ can easily fire again before free_irq() is entered, on the
> other hand free_irq() itself calls synchronize_irq() internally (in a race
> condition free way) before any state associated with the IRQ is freed.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>

where is this report...?

> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> ---
>  drivers/dma/idxd/device.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
> index 5363fb9218f2..9dd8e6bb21e6 100644
> --- a/drivers/dma/idxd/device.c
> +++ b/drivers/dma/idxd/device.c
> @@ -1179,7 +1179,6 @@ void idxd_wq_free_irq(struct idxd_wq *wq)
>  	struct idxd_device *idxd = wq->idxd;
>  	struct idxd_irq_entry *ie = &wq->ie;
>  
> -	synchronize_irq(ie->vector);
>  	free_irq(ie->vector, ie);
>  	idxd_flush_pending_descs(ie);
>  	if (idxd->request_int_handles)
> --
> 2.25.1
> 

-- 
~Vinod

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH V2] dmaengine: idxd: Remove unnecessary synchronize_irq() before free_irq()
  2022-05-16 11:32 ` Vinod Koul
@ 2022-05-16 11:54   ` cgel.zte
  2022-05-16 17:50     ` Vinod Koul
  0 siblings, 1 reply; 5+ messages in thread
From: cgel.zte @ 2022-05-16 11:54 UTC (permalink / raw)
  To: vkoul; +Cc: cgel.zte, chi.minghao, dave.jiang, dmaengine, linux-kernel, zealci

From: Minghao Chi <chi.minghao@zte.com.cn>

Calling synchronize_irq() right before free_irq() is quite useless. On one
hand the IRQ can easily fire again before free_irq() is entered, on the
other hand free_irq() itself calls synchronize_irq() internally (in a race
condition free way), before any state associated with the IRQ is freed.

Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
v1->v2:
	remove Reported-by: Zeal Robot <zealci@zte.com.cn>
 drivers/dma/idxd/device.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
index 5363fb9218f2..9dd8e6bb21e6 100644
--- a/drivers/dma/idxd/device.c
+++ b/drivers/dma/idxd/device.c
@@ -1179,7 +1179,6 @@ void idxd_wq_free_irq(struct idxd_wq *wq)
 	struct idxd_device *idxd = wq->idxd;
 	struct idxd_irq_entry *ie = &wq->ie;
 
-	synchronize_irq(ie->vector);
 	free_irq(ie->vector, ie);
 	idxd_flush_pending_descs(ie);
 	if (idxd->request_int_handles)
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH V2] dmaengine: idxd: Remove unnecessary synchronize_irq() before free_irq()
  2022-05-16 11:54   ` [PATCH V2] " cgel.zte
@ 2022-05-16 17:50     ` Vinod Koul
  0 siblings, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2022-05-16 17:50 UTC (permalink / raw)
  To: cgel.zte; +Cc: chi.minghao, dave.jiang, dmaengine, linux-kernel, zealci

On 16-05-22, 11:54, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> Calling synchronize_irq() right before free_irq() is quite useless. On one
> hand the IRQ can easily fire again before free_irq() is entered, on the
> other hand free_irq() itself calls synchronize_irq() internally (in a race
> condition free way), before any state associated with the IRQ is freed.

You should not have missed Dave's ack. I have added that and pushed

-- 
~Vinod

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-05-16 17:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-13  8:16 [PATCH] dmaengine: idxd: Remove unnecessary synchronize_irq() before free_irq() cgel.zte
2022-05-13 14:30 ` Dave Jiang
2022-05-16 11:32 ` Vinod Koul
2022-05-16 11:54   ` [PATCH V2] " cgel.zte
2022-05-16 17:50     ` Vinod Koul

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).