Re: [PATCH v2] serial: stm32: optimize spin lock usage

2021-04-16 Thread dillon min
Hi Johan, On Fri, Apr 16, 2021 at 4:35 PM Johan Hovold wrote: > > On Tue, Apr 13, 2021 at 07:44:39AM +0800, dillon min wrote: > > Hi Johan, Erwan > > > > It seems still a bit of a problem in the current version, not deadlock > > but access register at the same time. > > > > For driver , we should

Re: [PATCH v2] serial: stm32: optimize spin lock usage

2021-04-16 Thread Johan Hovold
[ Please avoid top-posting. ] On Thu, Apr 15, 2021 at 07:09:14PM +0200, Erwan LE RAY wrote: > Hi Dillon, > > STM32MP151 is mono-core, but both STM32MP153 and STM32MP157 are > dual-core (see > https://www.st.com/content/st_com/en/products/microcontrollers-microprocessors/stm32-arm-cortex-mpus.ht

Re: [PATCH v2] serial: stm32: optimize spin lock usage

2021-04-16 Thread Johan Hovold
On Tue, Apr 13, 2021 at 07:44:39AM +0800, dillon min wrote: > Hi Johan, Erwan > > It seems still a bit of a problem in the current version, not deadlock > but access register at the same time. > > For driver , we should consider it running under smp, let's think > about it for this case: > > sta

Re: [PATCH v2] serial: stm32: optimize spin lock usage

2021-04-15 Thread Hua Dillon
Hi Erwan, Erwan LE RAY 于2021年4月16日周五 上午1:10写道: > > Hi Dillon, > > STM32MP151 is mono-core, but both STM32MP153 and STM32MP157 are > dual-core (see > https://www.st.com/content/st_com/en/products/microcontrollers-microprocessors/stm32-arm-cortex-mpus.html). > So your point is fully relevant, thank

Re: [PATCH v2] serial: stm32: optimize spin lock usage

2021-04-15 Thread Erwan LE RAY
Hi Dillon, STM32MP151 is mono-core, but both STM32MP153 and STM32MP157 are dual-core (see https://www.st.com/content/st_com/en/products/microcontrollers-microprocessors/stm32-arm-cortex-mpus.html). So your point is fully relevant, thanks. ST already fixed the same issue in st-asc.c driver in

Re: [PATCH v2] serial: stm32: optimize spin lock usage

2021-04-12 Thread dillon min
Hi Johan, Erwan It seems still a bit of a problem in the current version, not deadlock but access register at the same time. For driver , we should consider it running under smp, let's think about it for this case: static void stm32_usart_console_write(struct console *co, const char *s,

Re: [PATCH v2] serial: stm32: optimize spin lock usage

2021-04-12 Thread dillon min
Hi Johan, Yes, there is no deadlock. my fault. I forget the local_irq_save() plus spin_lock() is spin_lock_irqsave(). Thanks for your review. please ignore this patch. Best regards Dillon On Mon, Apr 12, 2021 at 9:08 PM Johan Hovold wrote: > > On Mon, Apr 12, 2021 at 05:31:38PM +0800, dillon.

Re: [PATCH v2] serial: stm32: optimize spin lock usage

2021-04-12 Thread Johan Hovold
On Mon, Apr 12, 2021 at 05:31:38PM +0800, dillon.min...@gmail.com wrote: > From: dillon min > > To avoid potential deadlock in spin_lock usage, use spin_lock_irqsave, > spin_trylock_irqsave(), spin_unlock_irqrestore() in process context. This doesn't make much sense as console_write can be calle

[PATCH v2] serial: stm32: optimize spin lock usage

2021-04-12 Thread dillon . minfei
From: dillon min To avoid potential deadlock in spin_lock usage, use spin_lock_irqsave, spin_trylock_irqsave(), spin_unlock_irqrestore() in process context. remove unused local_irq_save/restore call. Cc: Alexandre Torgue Cc: Maxime Coquelin Cc: Gerald Baeza Cc: Erwan Le Ray Reported-by: ker