From: Tvrtko Ursulin <tursulin@ursulin.net>
To: Boris Brezillon <boris.brezillon@collabora.com>
Cc: "Adrián Larumbe" <adrian.larumbe@collabora.com>,
"Steven Price" <steven.price@arm.com>,
"Liviu Dudau" <liviu.dudau@arm.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
kernel@collabora.com, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] drm/panthor: Replace sleep locks with spinlocks in fdinfo path
Date: Wed, 12 Feb 2025 16:47:31 +0000 [thread overview]
Message-ID: <b0664a84-6bef-44b6-90bd-7c60e9875933@ursulin.net> (raw)
In-Reply-To: <20250212173356.10f47318@collabora.com>
On 12/02/2025 16:33, Boris Brezillon wrote:
> On Tue, 11 Feb 2025 11:39:49 +0000
> Tvrtko Ursulin <tursulin@ursulin.net> wrote:
>
>> On 10/02/2025 16:08, Adrián Larumbe wrote:
>>> Hi Tvrtko,
>>
>> Thanks!
>>
>>> [18153.770244] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:562
>>> [18153.771059] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 203412, name: cat
>>> [18153.771757] preempt_count: 1, expected: 0
>>> [18153.772164] RCU nest depth: 0, expected: 0
>>> [18153.772538] INFO: lockdep is turned off.
>>> [18153.772898] CPU: 4 UID: 0 PID: 203412 Comm: cat Tainted: G W 6.14.0-rc1-panthor-next-rk3588-fdinfo+ #1
>>> [18153.772906] Tainted: [W]=WARN
>>> [18153.772908] Hardware name: Radxa ROCK 5B (DT)
>>> [18153.772911] Call trace:
>>> [18153.772913] show_stack+0x24/0x38 (C)
>>> [18153.772927] dump_stack_lvl+0x3c/0x98
>>> [18153.772935] dump_stack+0x18/0x24
>>> [18153.772941] __might_resched+0x298/0x2b0
>>> [18153.772948] __might_sleep+0x6c/0xb0
>>> [18153.772953] __mutex_lock_common+0x7c/0x1950
>>> [18153.772962] mutex_lock_nested+0x38/0x50
>>> [18153.772969] panthor_fdinfo_gather_group_samples+0x80/0x138 [panthor]
>>> [18153.773042] panthor_show_fdinfo+0x80/0x228 [panthor]
>>> [18153.773109] drm_show_fdinfo+0x1a4/0x1e0 [drm]
>>> [18153.773397] seq_show+0x274/0x358
>>> [18153.773404] seq_read_iter+0x1d4/0x630
>>
>> There is a mutex_lock literally in seq_read_iter.
>>
>> So colour me confused. What created the atomic context between then and
>> Panthor code?! I just don't see it.
>
> It's actually the xa_lock() we take when gathering fdinfo data that
> puts us in this atomic context. In other words, the fix is correct, but
> the explanation is wrong :-).
Huh I did not spot that when glancing over it yesterday or so, but
anyway, excellent you figured it out! Now the commit message can be
fixed and not mislead someone in the future to think mutexes cannot be
used in fdinfo. Thanks for taking time to check it!
Regards,
Tvrtko
next prev parent reply other threads:[~2025-02-12 16:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-10 12:41 Adrián Larumbe
2025-02-10 12:42 ` [PATCH 2/2] drm/panthor: Avoid sleep locking in the internal BO size path Adrián Larumbe
2025-02-10 13:18 ` Boris Brezillon
2025-02-10 13:43 ` Liviu Dudau
2025-02-10 14:15 ` Boris Brezillon
2025-02-10 13:08 ` [PATCH 1/2] drm/panthor: Replace sleep locks with spinlocks in fdinfo path Boris Brezillon
2025-02-10 13:37 ` Liviu Dudau
2025-02-10 15:52 ` Tvrtko Ursulin
2025-02-10 16:08 ` Adrián Larumbe
2025-02-11 11:39 ` Tvrtko Ursulin
2025-02-11 12:41 ` Boris Brezillon
2025-02-12 14:23 ` Adrián Larumbe
2025-02-12 16:33 ` Boris Brezillon
2025-02-12 16:47 ` Tvrtko Ursulin [this message]
2025-02-10 16:10 ` Adrián Larumbe
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=b0664a84-6bef-44b6-90bd-7c60e9875933@ursulin.net \
--to=tursulin@ursulin.net \
--cc=adrian.larumbe@collabora.com \
--cc=airlied@gmail.com \
--cc=boris.brezillon@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liviu.dudau@arm.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=steven.price@arm.com \
--cc=tzimmermann@suse.de \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®