From mboxrd@z Thu Jan 1 00:00:00 1970 From: jiri.prchal@aksignal.cz (=?UTF-8?B?SmnFmcOtIFByY2hhbA==?=) Date: Mon, 10 Mar 2014 09:11:55 +0100 Subject: [BUG] atmel: spi: scheduling while atomic In-Reply-To: References: <5315E33C.5000205@aksignal.cz> <20140304214039.GA4441@piout.net> <5316CA84.4080907@aksignal.cz> <20140307225810.GB2918@piout.net> Message-ID: <531D73CB.7040402@aksignal.cz> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi all, at first: warning is on all spi devices. at second: its with CONFIG_PREEMPT=y, without (# CONFIG_PREEMPT_RCU is not set) is OK, but I wonder if this config will be fast enough for our usage (nearly RT)? Dne 8.3.2014 01:41, Rabin Vincent napsal(a): > 2014-03-07 23:58 GMT+01:00 Alexandre Belloni > : >> On 05/03/2014 at 07:56:04 +0100, Ji?? Prchal wrote : >>> [ 0.902343] BUG: scheduling while atomic: spi0/383/0x00000002 >>> [ 0.906250] Modules linked in: >>> [ 0.906250] CPU: 0 PID: 383 Comm: spi0 Not tainted 3.14.0-rc4_cpm9g25+ #1 >>> [ 0.906250] [] (unwind_backtrace) from [] (show_stack+0x10/0x14) >>> [ 0.906250] [] (show_stack) from [] (__schedule_bug+0x48/0x60) >>> [ 0.906250] [] (__schedule_bug) from [] (__schedule+0x60/0x484) >>> [ 0.906250] [] (__schedule) from [] (schedule_timeout+0x17c/0x1ac) >>> [ 0.906250] [] (schedule_timeout) from [] (wait_for_common+0x10c/0x1f0) >>> [ 0.906250] [] (wait_for_common) from [] (atmel_spi_transfer_one_message+0x71c/0xa48) >>> [ 0.906250] [] (atmel_spi_transfer_one_message) from [] (spi_pump_messages+0x210/0x238) >>> [ 0.906250] [] (spi_pump_messages) from [] (kthread_worker_fn+0x15c/0x1b4) >>> [ 0.906250] [] (kthread_worker_fn) from [] (kthread+0xb8/0xcc) >>> [ 0.906250] [] (kthread) from [] (ret_from_fork+0x14/0x24) >>> [ 0.906250] at25 spi0.0: 128 KByte at25 eeprom, pagesize 512 >> >> Actually, I'm not quite sure how spi_pump_messages can be called from an >> atomic context. > > spi_pump_messages() is not called from atomic context. Rather, > atmel_spi_transfer_one_message() does a spin_lock_irqsave() (via > atmel_spi_lock()) and then calls atmel_spi_one_transfer(), which calls > wait_for_completion_timeout(). That's why schedule is being called > from atomic context. This was introduced by 8090d6d1a4 ("spi: atmel: > Refactor spi-atmel to use SPI framework queue"). I think you should > see the warning with CONFIG_PREEMPT=y. >