LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Xiaoming Ni <nixiaoming@huawei.com>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
	mingo@redhat.com, will@kernel.org, longman@redhat.com,
	boqun.feng@gmail.com, wangle6@huawei.com, xiaoqian9@huawei.com,
	shaolexi@huawei.com, linux-acpi@vger.kernel.org,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Hanjun Guo <guohanjun@huawei.com>,
	Sudeep Holla <sudeep.holla@arm.com>
Subject: Re: [PATCH] semaphore: Add might_sleep() to down_*() family
Date: Tue, 31 Aug 2021 04:13:22 -0700	[thread overview]
Message-ID: <20210831111322.GA1687117@roeck-us.net> (raw)
In-Reply-To: <20210809021215.19991-1-nixiaoming@huawei.com>

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@huawei.com>
> Acked-by: Will Deacon <will@kernel.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
[   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

  parent reply	other threads:[~2021-08-31 11:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-09  2:12 Xiaoming Ni
2021-08-09  3:01 ` Waiman Long
2021-08-09  3:51   ` Xiaoming Ni
2021-08-09 12:52     ` Waiman Long
2021-08-09 14:33       ` Xiaoming Ni
2021-08-13 17:27   ` Thomas Gleixner
2021-08-13 18:47     ` Waiman Long
2021-08-13 14:43 ` Will Deacon
2021-08-23  9:39 ` [tip: locking/core] locking/semaphore: " tip-bot2 for Xiaoming Ni
2021-08-31 11:13 ` Guenter Roeck [this message]
2021-08-31 11:39   ` [PATCH] semaphore: " Hanjun Guo
2021-08-31 12:20     ` Thomas Gleixner
2021-08-31 11:40   ` Peter Zijlstra
2021-08-31 12:13   ` Thomas Gleixner
2021-08-31 12:34     ` Will Deacon
2021-08-31 17:42     ` Guenter Roeck
2021-09-01  8:37     ` [tip: smp/urgent] drivers: base: cacheinfo: Get rid of DEFINE_SMP_CALL_CACHE_FUNCTION() tip-bot2 for Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210831111322.GA1687117@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=boqun.feng@gmail.com \
    --cc=guohanjun@huawei.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mingo@redhat.com \
    --cc=nixiaoming@huawei.com \
    --cc=peterz@infradead.org \
    --cc=shaolexi@huawei.com \
    --cc=sudeep.holla@arm.com \
    --cc=wangle6@huawei.com \
    --cc=will@kernel.org \
    --cc=xiaoqian9@huawei.com \
    --subject='Re: [PATCH] semaphore: Add might_sleep() to down_*() family' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).