linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tty: Remove pointless synchronize_irq() in uart_port_shutdown()
@ 2022-05-10 13:54 Thomas Pfaff
  2022-05-10 17:44 ` Thomas Gleixner
  2022-05-11  6:21 ` Jiri Slaby
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Pfaff @ 2022-05-10 13:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby; +Cc: Thomas Gleixner, linux-kernel

From: Thomas Pfaff <tpfaff@pcs.com>

Calling synchronize_irq() after free_irq() is pointless, the context to
the irq is already lost.
It was noticed while creating the bugfix "genirq: Synchronize interrupt 
thread startup".

Signed-off-by: Thomas Pfaff <tpfaff@pcs.com>
---
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 57840cf90388..b76e76e650ba 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1704,12 +1704,6 @@ static void uart_port_shutdown(struct tty_port *port)
 	 */
 	if (uport)
 		uport->ops->shutdown(uport);
-
-	/*
-	 * Ensure that the IRQ handler isn't running on another CPU.
-	 */
-	if (uport)
-		synchronize_irq(uport->irq);
 }
 
 static int uart_carrier_raised(struct tty_port *port)



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

* Re: [PATCH] tty: Remove pointless synchronize_irq() in uart_port_shutdown()
  2022-05-10 13:54 [PATCH] tty: Remove pointless synchronize_irq() in uart_port_shutdown() Thomas Pfaff
@ 2022-05-10 17:44 ` Thomas Gleixner
  2022-05-11  6:21 ` Jiri Slaby
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2022-05-10 17:44 UTC (permalink / raw)
  To: Thomas Pfaff, Greg Kroah-Hartman, Jiri Slaby; +Cc: linux-kernel

On Tue, May 10 2022 at 15:54, Thomas Pfaff wrote:
> From: Thomas Pfaff <tpfaff@pcs.com>
>
> Calling synchronize_irq() after free_irq() is pointless, the context to
> the irq is already lost.
> It was noticed while creating the bugfix "genirq: Synchronize interrupt 
> thread startup".
>
> Signed-off-by: Thomas Pfaff <tpfaff@pcs.com>

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>

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

* Re: [PATCH] tty: Remove pointless synchronize_irq() in uart_port_shutdown()
  2022-05-10 13:54 [PATCH] tty: Remove pointless synchronize_irq() in uart_port_shutdown() Thomas Pfaff
  2022-05-10 17:44 ` Thomas Gleixner
@ 2022-05-11  6:21 ` Jiri Slaby
  2022-05-11  7:48   ` Thomas Pfaff
  1 sibling, 1 reply; 4+ messages in thread
From: Jiri Slaby @ 2022-05-11  6:21 UTC (permalink / raw)
  To: Thomas Pfaff, Greg Kroah-Hartman; +Cc: Thomas Gleixner, linux-kernel

On 10. 05. 22, 15:54, Thomas Pfaff wrote:
> From: Thomas Pfaff <tpfaff@pcs.com>
> 
> Calling synchronize_irq() after free_irq() is pointless, the context to
> the irq is already lost.
> It was noticed while creating the bugfix "genirq: Synchronize interrupt
> thread startup".

That's correct for most drivers. But some drivers don't call free_irq() 
in ->shutdown(). So you likely have to move the synchronization to them. 
By a quick grep, I found icom, jsm, sccnxp, sifive, sunhv, and sunzilog.

> Signed-off-by: Thomas Pfaff <tpfaff@pcs.com>
> ---
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index 57840cf90388..b76e76e650ba 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -1704,12 +1704,6 @@ static void uart_port_shutdown(struct tty_port *port)
>   	 */
>   	if (uport)
>   		uport->ops->shutdown(uport);
> -
> -	/*
> -	 * Ensure that the IRQ handler isn't running on another CPU.
> -	 */
> -	if (uport)
> -		synchronize_irq(uport->irq);
>   }
>   
>   static int uart_carrier_raised(struct tty_port *port)
> 
> 


-- 
js
suse labs

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

* Re: [PATCH] tty: Remove pointless synchronize_irq() in uart_port_shutdown()
  2022-05-11  6:21 ` Jiri Slaby
@ 2022-05-11  7:48   ` Thomas Pfaff
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Pfaff @ 2022-05-11  7:48 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: Greg Kroah-Hartman, Thomas Gleixner, linux-kernel



On Wed, 11 May 2022, Jiri Slaby wrote:

> On 10. 05. 22, 15:54, Thomas Pfaff wrote:
> > From: Thomas Pfaff <tpfaff@pcs.com>
> > 
> > Calling synchronize_irq() after free_irq() is pointless, the context to
> > the irq is already lost.
> > It was noticed while creating the bugfix "genirq: Synchronize interrupt
> > thread startup".
> 
> That's correct for most drivers. But some drivers don't call free_irq() in
> ->shutdown(). So you likely have to move the synchronization to them. By a
> quick grep, I found icom, jsm, sccnxp, sifive, sunhv, and sunzilog.
> 

Sorry, I did not check all the drivers.
Then I would keep it in serial_core, as it does not hurt anymore.

Thanks,
    Thomas



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

end of thread, other threads:[~2022-05-11  7:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10 13:54 [PATCH] tty: Remove pointless synchronize_irq() in uart_port_shutdown() Thomas Pfaff
2022-05-10 17:44 ` Thomas Gleixner
2022-05-11  6:21 ` Jiri Slaby
2022-05-11  7:48   ` Thomas Pfaff

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