AnsweredAssumed Answered

Linux LED trigger bug scheduling on I2C GPIO expander

Question asked by Abhisit Sangjan on Feb 20, 2017
Latest reply on Feb 23, 2017 by igorpadykov

Dear all,

 

Question

Please help me to fix issue "BUG: scheduling while atomic: swapper...Preemption disabled at:[< (null)>] (null)".

 

Extra Information

I have check function regmap (used to read/write I2C) is using mutex lock.

I also try to use LED hearbeat trigger, the LED is working and I see the same error message all the time on the terminal and demsg.

 

Device Tree

card-leds {
        compatible = "gpio-leds";

        active-load {
                label = "active-load";
                gpios = <&lmp92001_gpio 0 GPIO_ACTIVE_HIGH>;
                default-state = "off";
                linux,default-trigger = "oneshot";
        };
};

 

Shell operation

root@alc-imx6:~# uname -a
Linux alc-imx6 4.1.15-g12145c5-dirty #2 SMP PREEMPT Mon Feb 20 17:40:17 ICT 2017 armv7l GNU/Linux

root@alc-imx6:~# cd /sys/class/leds/active-load
root@alc-imx6:/sys/class/leds/active-load# ls
brightness delay_on invert power subsystem uevent
delay_off device max_brightness shot trigger
root@alc-imx6:/sys/class/leds/active-load# cat trigger
none nand-disk mmc0 mmc1 mmc2 timer [oneshot] heartbeat backlight gpio default-on rfkill0

root@alc-imx6:/sys/class/leds/active-load# echo 33 > delay_on
root@alc-imx6:/sys/class/leds/active-load# echo 33 > delay_off
root@alc-imx6:/sys/class/leds/active-load# echo 1 > shot

root@alc-imx6:/sys/class/leds/active-load# BUG: scheduling while atomic: swapper/0/0/0x00000102
Modules linked in:
Preemption disabled at:[< (null)>] (null)

CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.1.15-g12145c5-dirty #2
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[<80016390>] (unwind_backtrace) from [<800123d4>] (show_stack+0x10/0x14)
[<800123d4>] (show_stack) from [<806d6064>] (dump_stack+0x80/0xc0)
[<806d6064>] (dump_stack) from [<806d3f2c>] (__schedule_bug+0xa8/0xbc)
[<806d3f2c>] (__schedule_bug) from [<806d91b8>] (__schedule+0x480/0x4f4)
[<806d91b8>] (__schedule) from [<806d926c>] (schedule+0x40/0x98)
[<806d926c>] (schedule) from [<8042eb14>] (i2c_imx_bus_busy+0x68/0xf0)
[<8042eb14>] (i2c_imx_bus_busy) from [<8042f15c>] (i2c_imx_xfer+0x308/0xe84)
[<8042f15c>] (i2c_imx_xfer) from [<8042bb44>] (__i2c_transfer+0x144/0x284)
[<8042bb44>] (__i2c_transfer) from [<8042bd24>] (i2c_transfer+0xa0/0xd8)
[<8042bd24>] (i2c_transfer) from [<8042bff0>] (i2c_smbus_xfer+0x1f8/0x58c)
[<8042bff0>] (i2c_smbus_xfer) from [<8042c7a4>] (i2c_smbus_write_byte_data+0x40/0x48)
[<8042c7a4>] (i2c_smbus_write_byte_data) from [<8033813c>] (_regmap_update_bits+0x50/0x74)
[<8033813c>] (_regmap_update_bits) from [<80338eec>] (regmap_update_bits+0x40/0x5c)
[<80338eec>] (regmap_update_bits) from [<804ebaec>] (led_timer_function+0xdc/0xe4)
[<804ebaec>] (led_timer_function) from [<8007b814>] (call_timer_fn+0x24/0x98)
[<8007b814>] (call_timer_fn) from [<8007be10>] (run_timer_softirq+0x1e4/0x260)
[<8007be10>] (run_timer_softirq) from [<80039f14>] (__do_softirq+0x108/0x260)
[<80039f14>] (__do_softirq) from [<8003a30c>] (irq_exit+0xc0/0xfc)
[<8003a30c>] (irq_exit) from [<8006d720>] (__handle_domain_irq+0x80/0xe8)
[<8006d720>] (__handle_domain_irq) from [<800093cc>] (gic_handle_irq+0x24/0x5c)
[<800093cc>] (gic_handle_irq) from [<80012ec0>] (__irq_svc+0x40/0x74)
Exception stack(0x809bff18 to 0x809bff60)
ff00: 809bff60 fffffff7
ff20: 43b4bb93 0000001a 62fe91d9 0000001a 8bb22e90 00000000 629d88b4 0000001a
ff40: 809b9304 00000001 a6aaaaab 809bff60 00000017 80488ad4 00010013 ffffffff
[<80012ec0>] (__irq_svc) from [<80488ad4>] (cpuidle_enter_state+0xb8/0x1e0)
[<80488ad4>] (cpuidle_enter_state) from [<80065440>] (cpu_startup_entry+0x220/0x344)
[<80065440>] (cpu_startup_entry) from [<80960c50>] (start_kernel+0x3a8/0x3b4)
BUG: scheduling while atomic: swapper/0/0/0x00000102
Modules linked in:
Preemption disabled at:[< (null)>] (null)

CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 4.1.15-g12145c5-dirty #2
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[<80016390>] (unwind_backtrace) from [<800123d4>] (show_stack+0x10/0x14)
[<800123d4>] (show_stack) from [<806d6064>] (dump_stack+0x80/0xc0)
[<806d6064>] (dump_stack) from [<806d3f2c>] (__schedule_bug+0xa8/0xbc)
[<806d3f2c>] (__schedule_bug) from [<806d91b8>] (__schedule+0x480/0x4f4)
[<806d91b8>] (__schedule) from [<806d926c>] (schedule+0x40/0x98)
[<806d926c>] (schedule) from [<806db9c4>] (schedule_timeout+0x110/0x170)
[<806db9c4>] (schedule_timeout) from [<8042eddc>] (i2c_imx_trx_complete+0x50/0xc8)
[<8042eddc>] (i2c_imx_trx_complete) from [<8042f2b8>] (i2c_imx_xfer+0x464/0xe84)
[<8042f2b8>] (i2c_imx_xfer) from [<8042bb44>] (__i2c_transfer+0x144/0x284)
[<8042bb44>] (__i2c_transfer) from [<8042bd24>] (i2c_transfer+0xa0/0xd8)
[<8042bd24>] (i2c_transfer) from [<8042bff0>] (i2c_smbus_xfer+0x1f8/0x58c)
[<8042bff0>] (i2c_smbus_xfer) from [<8042c7a4>] (i2c_smbus_write_byte_data+0x40/0x48)
[<8042c7a4>] (i2c_smbus_write_byte_data) from [<8033813c>] (_regmap_update_bits+0x50/0x74)
[<8033813c>] (_regmap_update_bits) from [<80338eec>] (regmap_update_bits+0x40/0x5c)
[<80338eec>] (regmap_update_bits) from [<804ebaec>] (led_timer_function+0xdc/0xe4)
[<804ebaec>] (led_timer_function) from [<8007b814>] (call_timer_fn+0x24/0x98)
[<8007b814>] (call_timer_fn) from [<8007be10>] (run_timer_softirq+0x1e4/0x260)
[<8007be10>] (run_timer_softirq) from [<80039f14>] (__do_softirq+0x108/0x260)
[<80039f14>] (__do_softirq) from [<8003a30c>] (irq_exit+0xc0/0xfc)
[<8003a30c>] (irq_exit) from [<8006d720>] (__handle_domain_irq+0x80/0xe8)
[<8006d720>] (__handle_domain_irq) from [<800093cc>] (gic_handle_irq+0x24/0x5c)
[<800093cc>] (gic_handle_irq) from [<80012ec0>] (__irq_svc+0x40/0x74)
Exception stack(0x809bff18 to 0x809bff60)
ff00: 809bff60 fffffff7
ff20: 43b4bb93 0000001a 62fe91d9 0000001a 8bb22e90 00000000 629d88b4 0000001a
ff40: 809b9304 00000001 a6aaaaab 809bff60 00000017 80488ad4 00010013 ffffffff
[<80012ec0>] (__irq_svc) from [<80488ad4>] (cpuidle_enter_state+0xb8/0x1e0)
[<80488ad4>] (cpuidle_enter_state) from [<80065440>] (cpu_startup_entry+0x220/0x344)
[<80065440>] (cpu_startup_entry) from [<80960c50>] (start_kernel+0x3a8/0x3b4)
BUG: scheduling while atomic: swapper/0/0/0x00000102
Modules linked in:
Preemption disabled at:[< (null)>] (null)

CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 4.1.15-g12145c5-dirty #2
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[<80016390>] (unwind_backtrace) from [<800123d4>] (show_stack+0x10/0x14)
[<800123d4>] (show_stack) from [<806d6064>] (dump_stack+0x80/0xc0)
[<806d6064>] (dump_stack) from [<806d3f2c>] (__schedule_bug+0xa8/0xbc)
[<806d3f2c>] (__schedule_bug) from [<806d91b8>] (__schedule+0x480/0x4f4)
[<806d91b8>] (__schedule) from [<806d926c>] (schedule+0x40/0x98)
[<806d926c>] (schedule) from [<8042eb14>] (i2c_imx_bus_busy+0x68/0xf0)
[<8042eb14>] (i2c_imx_bus_busy) from [<8042f8a0>] (i2c_imx_xfer+0xa4c/0xe84)
[<8042f8a0>] (i2c_imx_xfer) from [<8042bb44>] (__i2c_transfer+0x144/0x284)
[<8042bb44>] (__i2c_transfer) from [<8042bd24>] (i2c_transfer+0xa0/0xd8)
[<8042bd24>] (i2c_transfer) from [<8042bff0>] (i2c_smbus_xfer+0x1f8/0x58c)
[<8042bff0>] (i2c_smbus_xfer) from [<8042c7a4>] (i2c_smbus_write_byte_data+0x40/0x48)
[<8042c7a4>] (i2c_smbus_write_byte_data) from [<8033813c>] (_regmap_update_bits+0x50/0x74)
[<8033813c>] (_regmap_update_bits) from [<80338eec>] (regmap_update_bits+0x40/0x5c)
[<80338eec>] (regmap_update_bits) from [<804ebaec>] (led_timer_function+0xdc/0xe4)
[<804ebaec>] (led_timer_function) from [<8007b814>] (call_timer_fn+0x24/0x98)
[<8007b814>] (call_timer_fn) from [<8007be10>] (run_timer_softirq+0x1e4/0x260)
[<8007be10>] (run_timer_softirq) from [<80039f14>] (__do_softirq+0x108/0x260)
[<80039f14>] (__do_softirq) from [<8003a30c>] (irq_exit+0xc0/0xfc)
[<8003a30c>] (irq_exit) from [<8006d720>] (__handle_domain_irq+0x80/0xe8)
[<8006d720>] (__handle_domain_irq) from [<800093cc>] (gic_handle_irq+0x24/0x5c)
[<800093cc>] (gic_handle_irq) from [<80012ec0>] (__irq_svc+0x40/0x74)
Exception stack(0x809bff18 to 0x809bff60)
ff00: 809bff60 fffffff7
ff20: 43b4bb93 0000001a 62fe91d9 0000001a 8bb22e90 00000000 629d88b4 0000001a
ff40: 809b9304 00000001 a6aaaaab 809bff60 00000017 80488ad4 00010013 ffffffff
[<80012ec0>] (__irq_svc) from [<80488ad4>] (cpuidle_enter_state+0xb8/0x1e0)
[<80488ad4>] (cpuidle_enter_state) from [<80065440>] (cpu_startup_entry+0x220/0x344)
[<80065440>] (cpu_startup_entry) from [<80960c50>] (start_kernel+0x3a8/0x3b4)
BUG: scheduling while atomic: swapper/0/0/0x00000102
Modules linked in:
Preemption disabled at:[< (null)>] (null)

CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 4.1.15-g12145c5-dirty #2
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[<80016390>] (unwind_backtrace) from [<800123d4>] (show_stack+0x10/0x14)
[<800123d4>] (show_stack) from [<806d6064>] (dump_stack+0x80/0xc0)
[<806d6064>] (dump_stack) from [<806d3f2c>] (__schedule_bug+0xa8/0xbc)
[<806d3f2c>] (__schedule_bug) from [<806d91b8>] (__schedule+0x480/0x4f4)
[<806d91b8>] (__schedule) from [<806d926c>] (schedule+0x40/0x98)
[<806d926c>] (schedule) from [<8042eb14>] (i2c_imx_bus_busy+0x68/0xf0)
[<8042eb14>] (i2c_imx_bus_busy) from [<8042f15c>] (i2c_imx_xfer+0x308/0xe84)
[<8042f15c>] (i2c_imx_xfer) from [<8042bb44>] (__i2c_transfer+0x144/0x284)
[<8042bb44>] (__i2c_transfer) from [<8042bd24>] (i2c_transfer+0xa0/0xd8)
[<8042bd24>] (i2c_transfer) from [<8042bff0>] (i2c_smbus_xfer+0x1f8/0x58c)
[<8042bff0>] (i2c_smbus_xfer) from [<8042c7a4>] (i2c_smbus_write_byte_data+0x40/0x48)
[<8042c7a4>] (i2c_smbus_write_byte_data) from [<8033813c>] (_regmap_update_bits+0x50/0x74)
[<8033813c>] (_regmap_update_bits) from [<80338eec>] (regmap_update_bits+0x40/0x5c)
[<80338eec>] (regmap_update_bits) from [<804ebaec>] (led_timer_function+0xdc/0xe4)
[<804ebaec>] (led_timer_function) from [<8007b814>] (call_timer_fn+0x24/0x98)
[<8007b814>] (call_timer_fn) from [<8007be10>] (run_timer_softirq+0x1e4/0x260)
[<8007be10>] (run_timer_softirq) from [<80039f14>] (__do_softirq+0x108/0x260)
[<80039f14>] (__do_softirq) from [<8003a30c>] (irq_exit+0xc0/0xfc)
[<8003a30c>] (irq_exit) from [<8006d720>] (__handle_domain_irq+0x80/0xe8)
[<8006d720>] (__handle_domain_irq) from [<800093cc>] (gic_handle_irq+0x24/0x5c)
[<800093cc>] (gic_handle_irq) from [<80012ec0>] (__irq_svc+0x40/0x74)
Exception stack(0x809bff18 to 0x809bff60)
ff00: 809bff60 fffffff7
ff20: 7f4f8593 0000001a 8b868d27 0000001a 8bb22e90 00000000 8aee8db1 0000001a
ff40: 809b9304 00000001 a6aaaaab 809bff60 00000017 80488ad4 900f0013 ffffffff
[<80012ec0>] (__irq_svc) from [<80488ad4>] (cpuidle_enter_state+0xb8/0x1e0)
[<80488ad4>] (cpuidle_enter_state) from [<80065440>] (cpu_startup_entry+0x220/0x344)
[<80065440>] (cpu_startup_entry) from [<80960c50>] (start_kernel+0x3a8/0x3b4)
BUG: scheduling while atomic: swapper/0/0/0x00000102
Modules linked in:
Preemption disabled at:[< (null)>] (null)

CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 4.1.15-g12145c5-dirty #2
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[<80016390>] (unwind_backtrace) from [<800123d4>] (show_stack+0x10/0x14)
[<800123d4>] (show_stack) from [<806d6064>] (dump_stack+0x80/0xc0)
[<806d6064>] (dump_stack) from [<806d3f2c>] (__schedule_bug+0xa8/0xbc)
[<806d3f2c>] (__schedule_bug) from [<806d91b8>] (__schedule+0x480/0x4f4)
[<806d91b8>] (__schedule) from [<806d926c>] (schedule+0x40/0x98)
[<806d926c>] (schedule) from [<806db9c4>] (schedule_timeout+0x110/0x170)
[<806db9c4>] (schedule_timeout) from [<8042eddc>] (i2c_imx_trx_complete+0x50/0xc8)
[<8042eddc>] (i2c_imx_trx_complete) from [<8042f2b8>] (i2c_imx_xfer+0x464/0xe84)
[<8042f2b8>] (i2c_imx_xfer) from [<8042bb44>] (__i2c_transfer+0x144/0x284)
[<8042bb44>] (__i2c_transfer) from [<8042bd24>] (i2c_transfer+0xa0/0xd8)
[<8042bd24>] (i2c_transfer) from [<8042bff0>] (i2c_smbus_xfer+0x1f8/0x58c)
[<8042bff0>] (i2c_smbus_xfer) from [<8042c7a4>] (i2c_smbus_write_byte_data+0x40/0x48)
[<8042c7a4>] (i2c_smbus_write_byte_data) from [<8033813c>] (_regmap_update_bits+0x50/0x74)
[<8033813c>] (_regmap_update_bits) from [<80338eec>] (regmap_update_bits+0x40/0x5c)
[<80338eec>] (regmap_update_bits) from [<804ebaec>] (led_timer_function+0xdc/0xe4)
[<804ebaec>] (led_timer_function) from [<8007b814>] (call_timer_fn+0x24/0x98)
[<8007b814>] (call_timer_fn) from [<8007be10>] (run_timer_softirq+0x1e4/0x260)
[<8007be10>] (run_timer_softirq) from [<80039f14>] (__do_softirq+0x108/0x260)
[<80039f14>] (__do_softirq) from [<8003a30c>] (irq_exit+0xc0/0xfc)
[<8003a30c>] (irq_exit) from [<8006d720>] (__handle_domain_irq+0x80/0xe8)
[<8006d720>] (__handle_domain_irq) from [<800093cc>] (gic_handle_irq+0x24/0x5c)
[<800093cc>] (gic_handle_irq) from [<80012ec0>] (__irq_svc+0x40/0x74)
Exception stack(0x809bff18 to 0x809bff60)
ff00: 809bff60 fffffff7
ff20: 7f4f8593 0000001a 8b868d27 0000001a 8bb22e90 00000000 8aee8db1 0000001a
ff40: 809b9304 00000001 a6aaaaab 809bff60 00000017 80488ad4 900f0013 ffffffff
[<80012ec0>] (__irq_svc) from [<80488ad4>] (cpuidle_enter_state+0xb8/0x1e0)
[<80488ad4>] (cpuidle_enter_state) from [<80065440>] (cpu_startup_entry+0x220/0x344)
[<80065440>] (cpu_startup_entry) from [<80960c50>] (start_kernel+0x3a8/0x3b4)
BUG: scheduling while atomic: swapper/0/0/0x00000102
Modules linked in:
Preemption disabled at:[< (null)>] (null)

CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 4.1.15-g12145c5-dirty #2
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[<80016390>] (unwind_backtrace) from [<800123d4>] (show_stack+0x10/0x14)
[<800123d4>] (show_stack) from [<806d6064>] (dump_stack+0x80/0xc0)
[<806d6064>] (dump_stack) from [<806d3f2c>] (__schedule_bug+0xa8/0xbc)
[<806d3f2c>] (__schedule_bug) from [<806d91b8>] (__schedule+0x480/0x4f4)
[<806d91b8>] (__schedule) from [<806d926c>] (schedule+0x40/0x98)
[<806d926c>] (schedule) from [<8042eb14>] (i2c_imx_bus_busy+0x68/0xf0)
[<8042eb14>] (i2c_imx_bus_busy) from [<8042f8a0>] (i2c_imx_xfer+0xa4c/0xe84)
[<8042f8a0>] (i2c_imx_xfer) from [<8042bb44>] (__i2c_transfer+0x144/0x284)
[<8042bb44>] (__i2c_transfer) from [<8042bd24>] (i2c_transfer+0xa0/0xd8)
[<8042bd24>] (i2c_transfer) from [<8042bff0>] (i2c_smbus_xfer+0x1f8/0x58c)
[<8042bff0>] (i2c_smbus_xfer) from [<8042c7a4>] (i2c_smbus_write_byte_data+0x40/0x48)
[<8042c7a4>] (i2c_smbus_write_byte_data) from [<8033813c>] (_regmap_update_bits+0x50/0x74)
[<8033813c>] (_regmap_update_bits) from [<80338eec>] (regmap_update_bits+0x40/0x5c)
[<80338eec>] (regmap_update_bits) from [<804ebaec>] (led_timer_function+0xdc/0xe4)
[<804ebaec>] (led_timer_function) from [<8007b814>] (call_timer_fn+0x24/0x98)
[<8007b814>] (call_timer_fn) from [<8007be10>] (run_timer_softirq+0x1e4/0x260)
[<8007be10>] (run_timer_softirq) from [<80039f14>] (__do_softirq+0x108/0x260)
[<80039f14>] (__do_softirq) from [<8003a30c>] (irq_exit+0xc0/0xfc)
[<8003a30c>] (irq_exit) from [<8006d720>] (__handle_domain_irq+0x80/0xe8)
[<8006d720>] (__handle_domain_irq) from [<800093cc>] (gic_handle_irq+0x24/0x5c)
[<800093cc>] (gic_handle_irq) from [<80012ec0>] (__irq_svc+0x40/0x74)
Exception stack(0x809bff18 to 0x809bff60)
ff00: 809bff60 fffffff7
ff20: 7f4f8593 0000001a 8b868d27 0000001a 8bb22e90 00000000 8aee8db1 0000001a
ff40: 809b9304 00000001 a6aaaaab 809bff60 00000017 80488ad4 900f0013 ffffffff
[<80012ec0>] (__irq_svc) from [<80488ad4>] (cpuidle_enter_state+0xb8/0x1e0)
[<80488ad4>] (cpuidle_enter_state) from [<80065440>] (cpu_startup_entry+0x220/0x344)
[<80065440>] (cpu_startup_entry) from [<80960c50>] (start_kernel+0x3a8/0x3b4)

 

Thank you for your reply,

Abhisit Sangjan

Outcomes