gpiod_set_value(): BUG: sleeping function called from invalid context

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

While testing the media cec-gpio driver on a Raspberry Pi 4B with CONFIG_DEBUG_ATOMIC_SLEEP
set I got this stack trace:

[ 1674.731319] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:281
[ 1674.739891] in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 0, name: swapper/3
[ 1674.748011] Preemption disabled at:
[ 1674.748015] [<ffff80001019887c>] find_vm_area+0x28/0x9c
[ 1674.756851] CPU: 3 PID: 0 Comm: swapper/3 Tainted: G         C        5.14.0-hdmi-dbg #58
[ 1674.765149] Hardware name: Raspberry Pi 4 Model B Rev 1.4 (DT)
[ 1674.771061] Call trace:
[ 1674.773534]  dump_backtrace+0x0/0x1b0
[ 1674.777251]  show_stack+0x18/0x24
[ 1674.780612]  dump_stack_lvl+0x68/0x84
[ 1674.784326]  dump_stack+0x18/0x34
[ 1674.787685]  ___might_sleep+0x148/0x180
[ 1674.791572]  __might_sleep+0x54/0x90
[ 1674.795195]  mutex_lock+0x28/0x80
[ 1674.798556]  pinctrl_get_device_gpio_range+0x3c/0x110
[ 1674.803677]  pinctrl_gpio_direction+0x3c/0xd0
[ 1674.808093]  pinctrl_gpio_direction_output+0x14/0x20
[ 1674.813124]  bcm2835_gpio_direction_output+0x64/0x80
[ 1674.818160]  gpio_set_open_drain_value_commit+0x6c/0xf0
[ 1674.823458]  gpiod_set_value_nocheck+0x8c/0xb0
[ 1674.827961]  gpiod_set_value+0x4c/0xd0
[ 1674.831760]  cec_gpio_low+0x34/0x40
[ 1674.835295]  cec_pin_timer+0x58c/0x11c4
[ 1674.839182]  __hrtimer_run_queues+0x140/0x1e0
[ 1674.843602]  hrtimer_interrupt+0xf4/0x2cc
[ 1674.847668]  arch_timer_handler_phys+0x38/0x50
[ 1674.852174]  handle_percpu_devid_irq+0x9c/0x160
[ 1674.856768]  handle_domain_irq+0x98/0xe4
[ 1674.860742]  gic_handle_irq+0x4c/0xd0
[ 1674.864452]  call_on_irq_stack+0x2c/0x5c
[ 1674.868428]  do_interrupt_handler+0x54/0x60
[ 1674.872669]  el1_interrupt+0x30/0x80
[ 1674.876291]  el1h_64_irq_handler+0x18/0x24
[ 1674.880443]  el1h_64_irq+0x78/0x7c
[ 1674.883889]  arch_cpu_idle+0x18/0x2c
[ 1674.887512]  default_idle_call+0x28/0x74
[ 1674.891486]  do_idle+0x23c/0x27c
[ 1674.894754]  cpu_startup_entry+0x24/0x70
[ 1674.898725]  secondary_start_kernel+0x140/0x164
[ 1674.903315]  __secondary_switched+0x94/0x98

The drivers/media/cec/platform/cec-gpio/cec-gpio.c driver uses an open drain
gpio connected to the HDMI CEC pin. From the dts:

        cec-gpio-sink {
                compatible = "cec-gpio";
                cec-gpios = <&gpio 6 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
                hpd-gpios = <&gpio 23 GPIO_ACTIVE_HIGH>;
        };

gpiod_set_value() is supposed to be usable from an atomic context, so this
appears to be a bug. It's probably been there for quite a long time. I suspect
OPEN_DRAIN isn't very common, and I think this might be the first time I tested
this driver with this kernel config option set.

Any suggestions?

Regards,

	Hans



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux