Greetings, 0day kernel testing robot got the below dmesg and the first bad commit is https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master commit 17e5888e4e180b45af7bafe7f3a86440d42717f3 Author: Hans de Goede AuthorDate: Thu Jan 23 22:02:42 2020 +0100 Commit: Thomas Gleixner CommitDate: Wed Mar 11 22:39:39 2020 +0100 x86: Select HARDIRQS_SW_RESEND on x86 Modern x86 laptops are starting to use GPIO pins as interrupts more and more, e.g. touchpads and touchscreens have almost all moved away from PS/2 and USB to using I2C with a GPIO pin as interrupt. Modern x86 laptops also have almost all moved to using s2idle instead of using the system S3 ACPI power state to suspend. The Intel and AMD pinctrl drivers do not define irq_retrigger handlers for the irqchips they register, this is causing edge triggered interrupts which happen while suspended using s2idle to get lost. One specific example of this is the lid switch on some devices, lid switches used to be handled by the embedded-controller, but now the lid open/closed sensor is sometimes directly connected to a GPIO pin. On most devices the ACPI code for this looks like this: Method (_E00, ...) { Notify (LID0, 0x80) // Status Change } Where _E00 is an ACPI event handler for changes on both edges of the GPIO connected to the lid sensor, this event handler is then combined with an _LID method which directly reads the pin. When the device is resumed by opening the lid, the GPIO interrupt will wake the system, but because the pinctrl irqchip doesn't have an irq_retrigger handler, the Notify will not happen. This is not a problem in the case the _LID method directly reads the GPIO, because the drivers/acpi/button.c code will call _LID on resume anyways. But some devices have an event handler for the GPIO connected to the lid sensor which looks like this: Method (_E00, ...) { if (LID_GPIO == One) LIDS = One else LIDS = Zero Notify (LID0, 0x80) // Status Change } And the _LID method returns the cached LIDS value, since on open we do not re-run the edge-interrupt handler when we re-enable IRQS on resume (because of the missing irq_retrigger handler), _LID now will keep reporting closed, as LIDS was never changed to reflect the open status, this causes userspace to re-resume the laptop again shortly after opening the lid. The Intel GPIO controllers do not allow implementing irq_retrigger without emulating it in software, at which point we are better of just using the generic HARDIRQS_SW_RESEND mechanism rather then re-implementing software emulation for this separately in aprox. 14 different pinctrl drivers. Select HARDIRQS_SW_RESEND to solve the problem of edge-triggered GPIO interrupts not being re-triggered on resume when they were triggered during suspend (s2idle) and/or when they were the cause of the wakeup. This requires 008f1d60fe25 ("x86/apic/vector: Force interupt handler invocation to irq context") c16816acd086 ("genirq: Add protection against unsafe usage of generic_handle_irq()") to protect the APIC based interrupts from being wreckaged by a software resend. Signed-off-by: Hans de Goede Signed-off-by: Thomas Gleixner Link: https://lkml.kernel.org/r/20200123210242.53367-1-hdegoede@redhat.com 87f2d1c662 genirq/irqdomain: Check pointer in irq_domain_alloc_irqs_hierarchy() 17e5888e4e x86: Select HARDIRQS_SW_RESEND on x86 92ed301919 Linux 5.8-rc7 +---------------------------------------------------------------+------------+------------+----------+ | | 87f2d1c662 | 17e5888e4e | v5.8-rc7 | +---------------------------------------------------------------+------------+------------+----------+ | boot_successes | 93 | 15 | 11 | | boot_failures | 39 | 25 | 3 | | WARNING:suspicious_RCU_usage | 38 | 10 | | | net/ipv4/fib_trie.c:#RCU-list_traversed_in_non-reader_section | 38 | 10 | | | invoked_oom-killer:gfp_mask=0x | 1 | | | | Mem-Info | 1 | | | | WARNING:possible_circular_locking_dependency_detected | 0 | 15 | 3 | +---------------------------------------------------------------+------------+------------+----------+ If you fix the issue, kindly add following tag Reported-by: kernel test robot [ 12.156126] ALSA device list: [ 12.156425] #0: Dummy 1 [ 12.156679] #1: Loopback 1 [ 12.157322] [ 12.157531] ====================================================== [ 12.158111] WARNING: possible circular locking dependency detected [ 12.158694] 5.6.0-rc4-00010-g17e5888e4e180 #1 Not tainted [ 12.159215] ------------------------------------------------------ [ 12.159795] swapper/1 is trying to acquire lock: [ 12.160230] c0011e70 (&irq_desc_lock_class){-.-.}, at: __irq_get_desc_lock+0x41/0x70 [ 12.160961] [ 12.160961] but task is already holding lock: [ 12.161580] c3326f90 (&port_lock_key){-.-.}, at: serial8250_do_startup+0x527/0x730 [ 12.162277] [ 12.162277] which lock already depends on the new lock. [ 12.162277] [ 12.163030] [ 12.163030] the existing dependency chain (in reverse order) is: [ 12.163728] [ 12.163728] -> #3 (&port_lock_key){-.-.}: [ 12.164249] arch_stack_walk+0x52/0x90 [ 12.164656] __lock_acquire+0xdbf/0x1160 [ 12.165070] lock_acquire+0x9a/0x130 [ 12.165455] serial8250_console_write+0x74/0x230 [ 12.165934] _raw_spin_lock_irqsave+0x28/0x40 [ 12.166387] serial8250_console_write+0x74/0x230 [ 12.166862] serial8250_console_write+0x74/0x230 [ 12.167348] console_unlock+0x172/0x5d0 [ 12.167755] univ8250_console_write+0x0/0x40 [ 12.168198] console_unlock+0x373/0x5d0 [ 12.168604] register_console+0x37e/0x3b0 [ 12.169024] univ8250_console_match+0x0/0x100 [ 12.169511] register_console+0x1f2/0x3b0 [ 12.169955] univ8250_console_init+0x0/0x20 [ 12.170422] univ8250_console_init+0x1d/0x20 [ 12.170866] console_init+0x131/0x1c9 [ 12.171261] start_kernel+0x4fc/0x603 [ 12.175485] startup_32_smp+0x164/0x170 [ 12.175890] [ 12.175890] -> #2 (console_owner){-.-.}: [ 12.176393] check_usage_forwards+0x0/0x120 [ 12.176828] __lock_acquire+0xdbf/0x1160 [ 12.177238] lock_acquire+0x9a/0x130 [ 12.177619] console_unlock+0x172/0x5d0 [ 12.178021] console_unlock+0x1c4/0x5d0 [ 12.178424] console_unlock+0x172/0x5d0 [ 12.178827] vprintk_emit+0xd6/0x290 [ 12.179221] vprintk_default+0xf/0x20 [ 12.179611] printk+0xd/0xe [ 12.179925] mask_and_ack_8259A.cold+0xb/0x5d [ 12.180376] handle_level_irq+0x24/0x100 [ 12.180788] resend_irqs+0x4b/0x60 [ 12.181156] tasklet_action_common+0x3c/0x80 [ 12.181726] __do_softirq+0xd2/0x440 [ 12.182111] __do_softirq+0x0/0x440 [ 12.182488] do_softirq_own_stack+0x1d/0x30 [ 12.182928] irq_exit+0x66/0x80 [ 12.183280] do_IRQ+0x59/0xe0 [ 12.183607] common_interrupt+0x113/0x120 [ 12.184028] memset+0xa/0x10 [ 12.184347] memset+0xa/0x10 [ 12.184668] kmem_cache_alloc+0x21c/0x2c0 [ 12.185088] __kernfs_new_node+0x3b/0x180 [ 12.185508] __lock_acquire+0x8f5/0x1160 [ 12.185918] __lock_acquire+0x8f5/0x1160 [ 12.186329] kernfs_new_node+0x27/0x50 [ 12.186724] kernfs_create_dir_ns+0x1e/0x60 [ 12.187158] sysfs_create_dir_ns+0x47/0x90 [ 12.187592] kobject_add_internal+0xa4/0x310 [ 12.188032] kobject_init_and_add+0x36/0x40 [ 12.188467] bus_add_driver+0x7d/0x200 [ 12.188863] i2c_device_shutdown+0x0/0x30 [ 12.189280] i2c_device_shutdown+0x0/0x30 [ 12.189697] driver_register+0x4e/0xd0 [ 12.190099] i2c_register_driver+0x39/0x90 [ 12.190526] rcu_read_lock_sched_held+0x3f/0x70 [ 12.190992] ds1621_driver_init+0x0/0xc [ 12.191403] do_one_initcall+0x5f/0x250 [ 12.191897] parse_args+0x1bf/0x310 [ 12.192270] rcu_read_lock_sched_held+0x3f/0x70 [ 12.192741] kernel_init_freeable+0x12d/0x24a [ 12.193194] kernel_init_freeable+0x1e9/0x24a [ 12.193647] kernel_init+0x0/0xe5 [ 12.194006] kernel_init+0x6/0xe5 [ 12.194362] kernel_init+0x0/0xe5 [ 12.194719] ret_from_fork+0x19/0x30 [ 12.195098] [ 12.195098] -> #1 (i8259A_lock){-.-.}: [ 12.195663] __lock_acquire+0xdbf/0x1160 [ 12.196166] lock_acquire+0x9a/0x130 [ 12.196628] unmask_8259A_irq+0x16/0x60 [ 12.197126] _raw_spin_lock_irqsave+0x28/0x40 [ 12.197670] unmask_8259A_irq+0x16/0x60 [ 12.198084] unmask_8259A_irq+0x16/0x60 [ 12.198486] irq_enable+0x27/0x60 [ 12.198840] irq_startup+0x89/0xa0 [ 12.199231] __setup_irq+0x64e/0x6e0 [ 12.199609] setup_irq+0x39/0x80 [ 12.199960] start_kernel+0x48f/0x603 [ 12.200345] startup_32_smp+0x164/0x170 [ 12.200745] [ 12.200745] -> #0 (&irq_desc_lock_class){-.-.}: [ 12.201297] print_circular_bug+0x4d/0xa0 [ 12.203541] check_noncircular+0x116/0x140 [ 12.203975] check_prev_add+0x6c/0x930 [ 12.204375] check_noncircular+0x60/0x140 [ 12.204798] __lock_acquire+0xdbf/0x1160 [ 12.205214] lock_acquire+0x9a/0x130 [ 12.205602] __irq_get_desc_lock+0x41/0x70 [ 12.206037] _raw_spin_lock_irqsave+0x28/0x40 [ 12.206493] __irq_get_desc_lock+0x41/0x70 [ 12.206925] __irq_get_desc_lock+0x41/0x70 [ 12.207367] __disable_irq_nosync+0x13/0x60 [ 12.207809] serial8250_do_startup+0x628/0x730 [ 12.208275] uart_port_startup+0xcd/0x250 [ 12.208700] uart_port_activate+0x5b/0xa0 [ 12.209124] tty_port_open+0x64/0xb0 [ 12.209511] _raw_spin_unlock+0x16/0x20 [ 12.209920] uart_open+0x12/0x20 [ 12.210273] tty_open+0xcb/0x450 [ 12.210628] chrdev_open+0x5a/0x170 [ 12.211006] do_dentry_open+0x1a3/0x380 [ 12.211497] chrdev_open+0x0/0x170 [ 12.211866] do_last+0x386/0x860 [ 12.212217] path_openat+0x73/0x1f0 [ 12.212590] do_filp_open+0x58/0xb0 [ 12.212963] _raw_spin_unlock+0x16/0x20 [ 12.213368] __alloc_fd+0xbe/0x1b0 [ 12.213734] do_sys_openat2+0x1ef/0x280 [ 12.214138] do_sys_open+0x49/0x80 [ 12.214502] console_on_rootfs+0x16/0x2d [ 12.214923] kernel_init_freeable+0x206/0x24a [ 12.215361] kernel_init+0x0/0xe5 [ 12.215699] kernel_init+0x6/0xe5 [ 12.216038] kernel_init+0x0/0xe5 [ 12.216378] ret_from_fork+0x19/0x30 [ 12.216738] [ 12.216738] other info that might help us debug this: [ 12.216738] [ 12.217432] Chain exists of: [ 12.217432] &irq_desc_lock_class --> console_owner --> &port_lock_key [ 12.217432] [ 12.218380] Possible unsafe locking scenario: [ 12.218380] [ 12.218895] CPU0 CPU1 [ 12.219301] ---- ---- [ 12.219697] lock(&port_lock_key); [ 12.220005] lock(console_owner); [ 12.220551] lock(&port_lock_key); [ 12.221099] lock(&irq_desc_lock_class); [ 12.221805] [ 12.221805] *** DEADLOCK *** [ 12.221805] [ 12.222353] 3 locks held by swapper/1: [ 12.222703] #0: f6c8e8d4 (&tty->legacy_mutex){+.+.}, at: tty_init_dev+0x34/0x170 [ 12.223402] #1: c02c7954 (&port->mutex){+.+.}, at: tty_port_open+0x40/0xb0 [ 12.224009] #2: c3326f90 (&port_lock_key){-.-.}, at: serial8250_do_startup+0x527/0x730 [ 12.224706] [ 12.224706] stack backtrace: [ 12.225092] CPU: 0 PID: 1 Comm: swapper Not tainted 5.6.0-rc4-00010-g17e5888e4e180 #1 [ 12.225780] Call Trace: [ 12.226003] ? check_noncircular+0x116/0x140 [ 12.226380] ? check_prev_add+0x6c/0x930 [ 12.226771] ? check_noncircular+0x60/0x140 [ 12.227157] ? __lock_acquire+0xdbf/0x1160 [ 12.227543] ? lock_acquire+0x9a/0x130 [ 12.227892] ? __irq_get_desc_lock+0x41/0x70 [ 12.228289] ? _raw_spin_lock_irqsave+0x28/0x40 [ 12.228708] ? __irq_get_desc_lock+0x41/0x70 [ 12.229102] ? __irq_get_desc_lock+0x41/0x70 [ 12.229497] ? __disable_irq_nosync+0x13/0x60 [ 12.229900] ? serial8250_do_startup+0x628/0x730 [ 12.230323] ? uart_port_startup+0xcd/0x250 [ 12.230708] ? uart_port_activate+0x5b/0xa0 [ 12.231094] ? tty_port_open+0x64/0xb0 [ 12.231642] ? _raw_spin_unlock+0x16/0x20 [ 12.232017] ? uart_open+0x12/0x20 [ 12.232334] ? tty_open+0xcb/0x450 [ 12.232653] ? chrdev_open+0x5a/0x170 [ 12.232999] ? do_dentry_open+0x1a3/0x380 [ 12.233374] ? cdev_init+0x50/0x50 [ 12.233692] ? do_last+0x386/0x860 [ 12.234010] ? path_openat+0x73/0x1f0 [ 12.234351] ? do_filp_open+0x58/0xb0 [ 12.234691] ? _raw_spin_unlock+0x16/0x20 [ 12.235062] ? __alloc_fd+0xbe/0x1b0 [ 12.235404] ? do_sys_openat2+0x1ef/0x280 [ 12.235777] ? do_sys_open+0x49/0x80 [ 12.236109] ? console_on_rootfs+0x16/0x2d [ 12.236491] ? kernel_init_freeable+0x206/0x24a [ 12.236908] ? rest_init+0x17b/0x17b [ 12.237239] ? kernel_init+0x6/0xe5 [ 12.237562] ? rest_init+0x17b/0x17b [ 12.237894] ? ret_from_fork+0x19/0x30 [ 12.238643] Freeing unused kernel image (initmem) memory: 540K [ 12.239343] Write protecting kernel text and read-only data: 24424k [ 12.239944] rodata_test: all tests were successful [ 12.240400] Run /init as init process [ 12.240751] with arguments: # HH:MM RESULT GOOD BAD GOOD_BUT_DIRTY DIRTY_NOT_BAD git bisect start v5.7 v5.6 -- git bisect bad ceb1adbacb4971cd47533d667f91ed06a38d7d4a # 23:43 B 11 2 0 0 Merge tag 'mtd/fixes-for-5.7-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux git bisect bad 6f43bae38269a55534e1f86a9917318167de6639 # 00:04 B 3 1 0 0 Merge tag 'dma-mapping-5.7' of git://git.infradead.org/users/hch/dma-mapping git bisect bad dfabb077d62552797ca0ae7756cb30d3e195ead5 # 00:13 B 2 1 1 1 Merge tag 'mmc-v5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc git bisect good 642e53ead6aea8740a219ede509a5d138fd4f780 # 00:23 G 40 0 13 13 Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip git bisect bad 9589351ccf47a85a75180a430627c16bc28da929 # 00:34 B 0 1 17 0 Merge branch 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip git bisect bad 2853d5fafb1e21707e89aa2e227c90bb2c1ea4a9 # 00:44 B 12 1 3 3 Merge tag 'x86-splitlock-2020-03-30' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip git bisect bad 992a1a3b45b5c0b6e69ecc2a3f32b0d02da28d58 # 01:06 B 2 2 1 1 Merge tag 'smp-core-2020-03-30' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip git bisect good 673b41e04a035d760bc0aff83fa9ee24fd9c2779 # 01:43 G 40 0 8 8 staging/octeon: fix up merge error git bisect bad 2d385336afcc43732aef1d51528c03f177ecd54e # 01:51 B 0 1 17 0 Merge tag 'irq-core-2020-03-30' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip git bisect good 00760d3cd9de2ccee6b73e30b53e71704a99209e # 02:11 G 37 0 9 9 irqchip/stm32: Retrigger both in eoi and unmask callbacks git bisect good 771df8cf0bc3a9a94bc16a58da136cad186cea27 # 02:28 G 40 0 13 13 Merge branch 'irq/gic-v4.1' into irq/irqchip-next git bisect good 9ae0522537852408f0f48af888e44d6876777463 # 02:56 G 37 0 15 15 PCI/AER: Fix the broken interrupt injection git bisect bad e13b99f3005829acc64287271fa6cacec6e3aeab # 03:07 B 2 1 0 0 c6x: Replace setup_irq() by request_irq() git bisect bad 17e5888e4e180b45af7bafe7f3a86440d42717f3 # 03:21 B 1 1 0 0 x86: Select HARDIRQS_SW_RESEND on x86 git bisect good 87f2d1c662fa1761359fdf558246f97e484d177a # 03:48 G 38 0 12 12 genirq/irqdomain: Check pointer in irq_domain_alloc_irqs_hierarchy() # first bad commit: [17e5888e4e180b45af7bafe7f3a86440d42717f3] x86: Select HARDIRQS_SW_RESEND on x86 git bisect good 87f2d1c662fa1761359fdf558246f97e484d177a # 04:11 G 113 0 26 38 genirq/irqdomain: Check pointer in irq_domain_alloc_irqs_hierarchy() # extra tests with debug options git bisect bad 17e5888e4e180b45af7bafe7f3a86440d42717f3 # 04:24 B 3 1 1 1 x86: Select HARDIRQS_SW_RESEND on x86 # extra tests on head commit of linus/master git bisect bad 92ed301919932f777713b9172e525674157e983d # 04:24 B 0 3 20 0 Linux 5.8-rc7 # bad: [92ed301919932f777713b9172e525674157e983d] Linux 5.8-rc7 # extra tests on revert first bad commit git bisect good f58225ec2998b6ce80864fcb609b369eac45c36c # 04:55 G 37 0 1 1 Revert "x86: Select HARDIRQS_SW_RESEND on x86" # good: [f58225ec2998b6ce80864fcb609b369eac45c36c] Revert "x86: Select HARDIRQS_SW_RESEND on x86" # extra tests on linus/master # duplicated: [92ed301919932f777713b9172e525674157e983d] Linux 5.8-rc7 # extra tests on linux-next/master # 119: [e9a523ff8f76de0768857f02ea76437d3b39d151] Add linux-next specific files for 20200727 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/lkp@lists.01.org