linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] spi: spi-bcm2835: Fix deadlock
@ 2021-07-16 21:02 alexandru.tachici
  2021-07-16 21:02 ` [PATCH 1/1] " alexandru.tachici
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: alexandru.tachici @ 2021-07-16 21:02 UTC (permalink / raw)
  To: linux-kernel, linux-spi, broonie
  Cc: nuno.sa, bootc, swarren, bcm-kernel-feedback-list, rjui,
	f.fainelli, nsaenz, Alexandru Tachici

From: Alexandru Tachici <alexandru.tachici@analog.com>

The bcm2835_spi_transfer_one function can create a deadlock
if it is called while another thread already has the
CCF lock.

This behavior was observed at boot and when trying to
print the clk_summary debugfs. I had registered
at the time multiple clocks of AD9545 through the CCF.
Tested this using an RPi 4 connected to AD9545 through SPI.

See upstream attempt here:
https://lore.kernel.org/lkml/20210614070718.78041-3-alexandru.tachici@analog.com/T/

This can happen to any other clock that needs to read
the rate/phase from hardware using the SPI. Because
when issuing a clk_get_rate/phase, the requesting thread
already holds the CCF lock. If another thread, in this case
the one that does the spi transfer tries the same, it will cause
a deadlock. This happens by chance because not always
every spi request gets deferred to a khthread.

Alexandru Tachici (1):
  spi: spi-bcm2835: Fix deadlock

 drivers/spi/spi-bcm2835.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

--
2.25.1

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

end of thread, other threads:[~2021-07-21 12:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-16 21:02 [PATCH 0/1] spi: spi-bcm2835: Fix deadlock alexandru.tachici
2021-07-16 21:02 ` [PATCH 1/1] " alexandru.tachici
2021-07-19 23:50   ` Florian Fainelli
2021-07-20 12:33 ` [PATCH 0/1] " Mark Brown
2021-07-20 18:48 ` Mark Brown
2021-07-21  6:47   ` Sa, Nuno
2021-07-21 12:32     ` Mark Brown

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