lkml.org 
[lkml]   [2019]   [Dec]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] spi: spi-dw: Add lock protect dw_spi rx/tx to prevent concurrent calls
On Sat, Dec 21, 2019 at 11:48:19AM +0800, wuxu.wu wrote:
> dw_spi_irq()nd dw_spi_transfer_one concurrent calls.
>
> I find a panic in dw_writer(): txw = *(u8 *)(dws->tx);

Please fix the indentation of your commit log, it's indented by a
tab - look at other patches people are posting for examples...

> [ 1025.321302] Call trace:
> [ 1025.321309] machine_kexec+0x58/0x3e8
> [ 1025.321319] __crash_kexec+0x98/0x148

Please think hard before including complete backtraces in upstream
reports, they are very large and contain almost no useful information
relative to their size so often obscure the relevant content in your
message. If part of the backtrace is usefully illustrative then it's
usually better to pull out the relevant sections.

> [ 1025.321365] dw_spi_irq+0x48/0x70
> [ 1025.321377] __handle_irq_event_percpu+0x74/0x278
>
> Signed-off-by: wuxu.wu <wuxu.wu@huawei.com>
> ---

The Signed-off-by here has the right indenttion for the
changelog.

> static void dw_writer(struct dw_spi *dws)
> {
> - u32 max = tx_max(dws);
> + u32 max
> u16 txw = 0;
> + unsigned long flags;
>
> + spin_lock_irqsave(&dws->buf_lock, flags);

We shouldn't use spin_lock_irqsave() here since this is called
from interrupt context by interrupt_transfer() - we should use
plain old spin_lock() here. Otherwise the code change looks
good, well spotted!
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2019-12-27 01:51    [W:0.019 / U:0.504 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site