Re: [PATCH] semaphore: Add might_sleep() to down_*() family

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

 



Hi,

On Mon, Aug 09, 2021 at 10:12:15AM +0800, Xiaoming Ni wrote:
> Semaphore is sleeping lock. Add might_sleep() to down*() family
> (with exception of down_trylock()) to detect atomic context sleep.
> 
> Previously discussed with Peter Zijlstra, see link:
>  https://lore.kernel.org/lkml/20210806082320.GD22037@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> 
> Signed-off-by: Xiaoming Ni <nixiaoming@xxxxxxxxxx>
> Acked-by: Will Deacon <will@xxxxxxxxxx>

This patch results in the following traceback on all arm64 boots with
EFI BIOS.

The problem is only seen with CONFIG_ACPI_PPTT=y, and thus only on arm64.

Guenter

---
[   14.048540] BUG: sleeping function called from invalid context at kernel/locking/semaphore.c:163
[   14.048700] in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 14, name: cpuhp/0
[   14.048865] 2 locks held by cpuhp/0/14:
[   14.048943]  #0: ffff8000125799b0 (cpu_hotplug_lock){++++}-{0:0}, at: cpuhp_thread_fun+0x38/0x254
[   14.049320]  #1: ffff8000125799d8 (cpuhp_state-up){+.+.}-{0:0}, at: cpuhp_thread_fun+0x38/0x254
[   14.049523] irq event stamp: 62
[   14.049580] hardirqs last  enabled at (61): [<ffff800010269690>] finish_task_switch.isra.0+0xd0/0x2f0
[   14.049689] hardirqs last disabled at (62): [<ffff800010313ce8>] generic_exec_single+0x138/0x190
[   14.049785] softirqs last  enabled at (0): [<ffff8000102245d4>] copy_process+0x634/0x1af4
[   14.049876] softirqs last disabled at (0): [<0000000000000000>] 0x0
[   14.050299] CPU: 0 PID: 14 Comm: cpuhp/0 Not tainted 5.14.0-01100-gb91db6a0b52e #1
[   14.050452] Hardware name: QEMU QEMU Virtual Machine, BIOS 0.0.0 02/06/2015
[   14.050694] Call trace:
[   14.050753]  dump_backtrace+0x0/0x19c
[   14.050839]  show_stack+0x1c/0x30
[   14.050892]  dump_stack_lvl+0x9c/0xd8
[   14.050949]  dump_stack+0x1c/0x38
[   14.050999]  ___might_sleep+0x154/0x200
[   14.051053]  __might_sleep+0x54/0x90
[   14.051106]  down_timeout+0x34/0x90
[   14.051159]  acpi_os_wait_semaphore+0x68/0x9c
[   14.051218]  acpi_ut_acquire_mutex+0x50/0xbc
[   14.051277]  acpi_get_table+0x3c/0xc0
[   14.051330]  acpi_find_last_cache_level+0x44/0x12c
[   14.051391]  _init_cache_level+0xd8/0xe4
[   14.051446]  generic_exec_single+0xf8/0x190
[   14.051502]  smp_call_function_single+0x174/0x1e0
[   14.051561]  init_cache_level+0x30/0x60
[   14.051614]  cacheinfo_cpu_online+0x28/0x840
[   14.051675]  cpuhp_invoke_callback+0x168/0x2ac
[   14.051751]  cpuhp_thread_fun+0x198/0x254
[   14.051810]  smpboot_thread_fn+0x200/0x2c0
[   14.051867]  kthread+0x164/0x170
[   14.051921]  ret_from_fork+0x10/0x18



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux