2008-07-08 04:00:23     spi_bfin5xx causes a ksoftirqd heavy load

Document created by Aaronwu Employee on Aug 7, 2013
Version 1Show Document
  • View in full screen mode

2008-07-08 04:00:23     spi_bfin5xx causes a ksoftirqd heavy load

Michele d'Amico (ITALY)

Message: 58467   


Hi all,

I found an issue on bfin spi master implementation when it is not used in DMA mode:

every transaction run in soft irq context (tasklets) and they are implemented by busy cycle like

while (drv_data->rx < drv_data->rx_end) {

    write_TDBR(*(u8 *)(drv_data->tx));

    do {} while (!(read_STAT() & BIT_STAT_SPIF));

    do {} while (!(read_STAT() & BIT_STAT_RXS));

    *(u8 *)(drv_data->rx) = read_RDBR();






When we use this implementation to drive slow device the ksoftirqd kernel thread eats all cpu resources until the transaction is done.


IMHO: no busy cycle should run in atomic context like soft/hard irq.


I would like implement an irq driven version of that, but, before start, I've some questions:

1)  Somebody knows some issues related on implement the transaction by interrupt driven read/write on spi framework?

2) I must do it on an old release (R0602) and I could test in only on some little cases: If the blackfin uclinux's community is interested on that patch I could spend some effort on port to the svn trunk but I need some support for test it on other devices.








2008-07-09 10:54:41     Re: spi_bfin5xx causes a ksoftirqd heavy load

Michele d'Amico (ITALY)

Message: 58557   




I did a patch for duplex cases (all my devices use just these kind of transactions) and the results are great. Now ksoftirqd don't waste the cpu's  time and there aren't  regressions on my devices.


I think that I wrote could be applied to all case except the delayed chip select transaction.


Anyway, I can't write the code for handling other cases because I can't test them: if you are interested I can post the patched code and explain the idea, after that the implementation should be straightforward. Otherwise we can leave the code as it is and I maintain my patch without include it in trunk.








2008-07-09 21:53:46     Re: spi_bfin5xx causes a ksoftirqd heavy load


Message: 58578   




We are always interested in things getting better. Either post your code here (as an attachment), or on the patch tracker (prefer the patch tracker).






2008-07-24 04:55:56     Re: spi_bfin5xx causes a ksoftirqd heavy load


Message: 59309   


Hi Michele,


I opened a tracker :




to track the problem you mentioned. Could you please post your patch here or add the patch to the tracker?