[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YS4VO7iz73jXR9nN@hirez.programming.kicks-ass.net>
Date: Tue, 31 Aug 2021 13:40:43 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Guenter Roeck <linux@...ck-us.net>
Cc: Xiaoming Ni <nixiaoming@...wei.com>, linux-kernel@...r.kernel.org,
mingo@...hat.com, will@...nel.org, longman@...hat.com,
boqun.feng@...il.com, wangle6@...wei.com, xiaoqian9@...wei.com,
shaolexi@...wei.com, linux-acpi@...r.kernel.org,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Hanjun Guo <guohanjun@...wei.com>,
Sudeep Holla <sudeep.holla@....com>
Subject: Re: [PATCH] semaphore: Add might_sleep() to down_*() family
On Tue, Aug 31, 2021 at 04:13:22AM -0700, Guenter Roeck wrote:
> 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@worktop.programming.kicks-ass.net
> >
> > Signed-off-by: Xiaoming Ni <nixiaoming@...wei.com>
> > Acked-by: Will Deacon <will@...nel.org>
>
> 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
This is the patch working as intended.. You simply cannot schedule with
interrupts disabled as per the callchain.
Powered by blists - more mailing lists