All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tty: serial: rad-uart: replace spin_lock_irqsave by spin_lock in hard IRQ
@ 2020-11-20  1:26 ` Tian Tao
  0 siblings, 0 replies; 4+ messages in thread
From: Tian Tao @ 2020-11-20  1:26 UTC (permalink / raw)
  To: gregkh, jirislaby, linux-arm-kernel, linux-unisoc, linux-serial,
	linux-kernel

The code has been in a irq-disabled context since it is hard IRQ. There
is no necessity to do it again.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
 drivers/tty/serial/rda-uart.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/rda-uart.c b/drivers/tty/serial/rda-uart.c
index 85366e0..d6705a0 100644
--- a/drivers/tty/serial/rda-uart.c
+++ b/drivers/tty/serial/rda-uart.c
@@ -406,10 +406,9 @@ static void rda_uart_receive_chars(struct uart_port *port)
 static irqreturn_t rda_interrupt(int irq, void *dev_id)
 {
 	struct uart_port *port = dev_id;
-	unsigned long flags;
 	u32 val, irq_mask;
 
-	spin_lock_irqsave(&port->lock, flags);
+	spin_lock(&port->lock);
 
 	/* Clear IRQ cause */
 	val = rda_uart_read(port, RDA_UART_IRQ_CAUSE);
@@ -426,7 +425,7 @@ static irqreturn_t rda_interrupt(int irq, void *dev_id)
 		rda_uart_send_chars(port);
 	}
 
-	spin_unlock_irqrestore(&port->lock, flags);
+	spin_unlock(&port->lock);
 
 	return IRQ_HANDLED;
 }
-- 
2.7.4


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

* [PATCH] tty: serial: rad-uart: replace spin_lock_irqsave by spin_lock in hard IRQ
@ 2020-11-20  1:26 ` Tian Tao
  0 siblings, 0 replies; 4+ messages in thread
From: Tian Tao @ 2020-11-20  1:26 UTC (permalink / raw)
  To: gregkh, jirislaby, linux-arm-kernel, linux-unisoc, linux-serial,
	linux-kernel

The code has been in a irq-disabled context since it is hard IRQ. There
is no necessity to do it again.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
 drivers/tty/serial/rda-uart.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/rda-uart.c b/drivers/tty/serial/rda-uart.c
index 85366e0..d6705a0 100644
--- a/drivers/tty/serial/rda-uart.c
+++ b/drivers/tty/serial/rda-uart.c
@@ -406,10 +406,9 @@ static void rda_uart_receive_chars(struct uart_port *port)
 static irqreturn_t rda_interrupt(int irq, void *dev_id)
 {
 	struct uart_port *port = dev_id;
-	unsigned long flags;
 	u32 val, irq_mask;
 
-	spin_lock_irqsave(&port->lock, flags);
+	spin_lock(&port->lock);
 
 	/* Clear IRQ cause */
 	val = rda_uart_read(port, RDA_UART_IRQ_CAUSE);
@@ -426,7 +425,7 @@ static irqreturn_t rda_interrupt(int irq, void *dev_id)
 		rda_uart_send_chars(port);
 	}
 
-	spin_unlock_irqrestore(&port->lock, flags);
+	spin_unlock(&port->lock);
 
 	return IRQ_HANDLED;
 }
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] tty: serial: rad-uart: replace spin_lock_irqsave by spin_lock in hard IRQ
  2020-11-20  1:26 ` Tian Tao
@ 2020-11-20  8:15   ` Johan Hovold
  -1 siblings, 0 replies; 4+ messages in thread
From: Johan Hovold @ 2020-11-20  8:15 UTC (permalink / raw)
  To: Tian Tao
  Cc: gregkh, jirislaby, linux-arm-kernel, linux-unisoc, linux-serial,
	linux-kernel

On Fri, Nov 20, 2020 at 09:26:53AM +0800, Tian Tao wrote:
> The code has been in a irq-disabled context since it is hard IRQ. There
> is no necessity to do it again.
> 
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> ---
>  drivers/tty/serial/rda-uart.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/tty/serial/rda-uart.c b/drivers/tty/serial/rda-uart.c
> index 85366e0..d6705a0 100644
> --- a/drivers/tty/serial/rda-uart.c
> +++ b/drivers/tty/serial/rda-uart.c
> @@ -406,10 +406,9 @@ static void rda_uart_receive_chars(struct uart_port *port)
>  static irqreturn_t rda_interrupt(int irq, void *dev_id)
>  {
>  	struct uart_port *port = dev_id;
> -	unsigned long flags;
>  	u32 val, irq_mask;
>  
> -	spin_lock_irqsave(&port->lock, flags);
> +	spin_lock(&port->lock);

This will break with forced irq threading (i.e. "threadirqs") since the
console code can still end up being called from interrupt context (which
can result in a deadlock).

>  
>  	/* Clear IRQ cause */
>  	val = rda_uart_read(port, RDA_UART_IRQ_CAUSE);
> @@ -426,7 +425,7 @@ static irqreturn_t rda_interrupt(int irq, void *dev_id)
>  		rda_uart_send_chars(port);
>  	}
>  
> -	spin_unlock_irqrestore(&port->lock, flags);
> +	spin_unlock(&port->lock);
>  
>  	return IRQ_HANDLED;
>  }

Johan

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

* Re: [PATCH] tty: serial: rad-uart: replace spin_lock_irqsave by spin_lock in hard IRQ
@ 2020-11-20  8:15   ` Johan Hovold
  0 siblings, 0 replies; 4+ messages in thread
From: Johan Hovold @ 2020-11-20  8:15 UTC (permalink / raw)
  To: Tian Tao
  Cc: gregkh, linux-kernel, linux-unisoc, linux-serial, jirislaby,
	linux-arm-kernel

On Fri, Nov 20, 2020 at 09:26:53AM +0800, Tian Tao wrote:
> The code has been in a irq-disabled context since it is hard IRQ. There
> is no necessity to do it again.
> 
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> ---
>  drivers/tty/serial/rda-uart.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/tty/serial/rda-uart.c b/drivers/tty/serial/rda-uart.c
> index 85366e0..d6705a0 100644
> --- a/drivers/tty/serial/rda-uart.c
> +++ b/drivers/tty/serial/rda-uart.c
> @@ -406,10 +406,9 @@ static void rda_uart_receive_chars(struct uart_port *port)
>  static irqreturn_t rda_interrupt(int irq, void *dev_id)
>  {
>  	struct uart_port *port = dev_id;
> -	unsigned long flags;
>  	u32 val, irq_mask;
>  
> -	spin_lock_irqsave(&port->lock, flags);
> +	spin_lock(&port->lock);

This will break with forced irq threading (i.e. "threadirqs") since the
console code can still end up being called from interrupt context (which
can result in a deadlock).

>  
>  	/* Clear IRQ cause */
>  	val = rda_uart_read(port, RDA_UART_IRQ_CAUSE);
> @@ -426,7 +425,7 @@ static irqreturn_t rda_interrupt(int irq, void *dev_id)
>  		rda_uart_send_chars(port);
>  	}
>  
> -	spin_unlock_irqrestore(&port->lock, flags);
> +	spin_unlock(&port->lock);
>  
>  	return IRQ_HANDLED;
>  }

Johan

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-11-20  8:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-20  1:26 [PATCH] tty: serial: rad-uart: replace spin_lock_irqsave by spin_lock in hard IRQ Tian Tao
2020-11-20  1:26 ` Tian Tao
2020-11-20  8:15 ` Johan Hovold
2020-11-20  8:15   ` Johan Hovold

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.