From: Sean Anderson <sean.anderson@linux.dev>
To: Leo Yan <leo.yan@arm.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>,
coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
Yeoreum Yun <yeoreum.yun@arm.com>,
Mike Leach <mike.leach@linaro.org>,
Linu Cherian <lcherian@marvell.com>,
linux-kernel@vger.kernel.org,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
James Clark <james.clark@linaro.org>
Subject: Re: [PATCH v3] coresight: Fix possible deadlock in coresight_panic_cb
Date: Tue, 16 Sep 2025 12:14:40 -0400 [thread overview]
Message-ID: <a35e2d54-f1f5-4ae4-9daa-ae1f3a8a302b@linux.dev> (raw)
In-Reply-To: <20250916160027.GK12516@e132581.arm.com>
On 9/16/25 12:00, Leo Yan wrote:
> On Mon, Sep 15, 2025 at 10:31:24AM -0400, Sean Anderson wrote:
>> On 9/15/25 05:58, Leo Yan wrote:
>> > On Fri, Sep 12, 2025 at 11:13:14AM -0400, Sean Anderson wrote:
>> >> coresight_panic_cb is called with interrupts disabled during panics.
>> >> However, bus_for_each_dev calls bus_to_subsys which takes
>> >> bus_kset->list_lock without disabling IRQs. This may cause a deadlock.
>> >
>> > I would rephrase it to make it clearer for anyone reading it later:
>> >
>> > coresight_panic_cb() is called during panics, which can preempt a flow
>> > that triggers exceptions (such as data or instruction aborts).
>>
>> I don't see what exceptions have to do with it. You can also panic
>> during a regular interrupt.
>
> The commit mentioned "without disabling IRQs" gives the impression that
> the deadlock is caused by IRQ-unsafe locking, which might mislead into
> thinking why the issue cannot be fixed with IRQ-safe locking.
>
> Regardless of whether IRQs are disabled, and regardless of the context
> (interrupt, bottom-half, or normal thread), the conditions for the
> deadlock are only about:
>
> (a) The bus lock has been acquired;
> (b) A panic is triggered to try to acquire the same lock.
>
> [...]
>
>> > When I review this patch, I recognize we can consolidate panic notifier
>> > in coresight-tmc-core.c, so we don't need to distribute the changes
>> > into ETF and ETR drivers (sorry if I misled you in my previous reply).
>>
>> And this kind of thing is why I went with the straightforward fix
>> initially. I do not want to bikeshed the extent that this gets removed.
>> IMO the whole "panic ops" stuff should be done directly with the panic
>> notifier, hence this patch. If you do not agree with that, then ack v2
>> and send a follow up of your own to fix it how you see fit.
>
> I would fix it in one go.
>
> I agree with you that "the whole panic ops stuff should be done directly
> with the panic". The only difference between us is that I would keep the
> `panic_ops` callback. To me, this encapsulates panic callbacks into
> different modules, to make the code more general.
>
> Could you check if the drafted patch below looks good to you? If so, I
As stated above I disagree with a half-hearted removal. If you want to do that,
then I will resend v2 done with an rcu list and you can make your own follow-up.
--Sean
next prev parent reply other threads:[~2025-09-16 16:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-12 15:13 [PATCH v3] coresight: Fix possible deadlock in coresight_panic_cb Sean Anderson
2025-09-15 9:58 ` Leo Yan
2025-09-15 14:31 ` Sean Anderson
2025-09-16 16:00 ` Leo Yan
2025-09-16 16:09 ` Suzuki K Poulose
2025-09-16 16:38 ` Leo Yan
2025-09-16 16:42 ` Suzuki K Poulose
2025-09-16 16:55 ` Leo Yan
2025-09-16 16:14 ` Sean Anderson [this message]
2025-09-16 16:48 ` Leo Yan
2025-09-16 16:51 ` Sean Anderson
2025-09-16 17:17 ` Leo Yan
2025-09-17 8:31 ` Suzuki K Poulose
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=a35e2d54-f1f5-4ae4-9daa-ae1f3a8a302b@linux.dev \
--to=sean.anderson@linux.dev \
--cc=alexander.shishkin@linux.intel.com \
--cc=coresight@lists.linaro.org \
--cc=james.clark@linaro.org \
--cc=lcherian@marvell.com \
--cc=leo.yan@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mike.leach@linaro.org \
--cc=suzuki.poulose@arm.com \
--cc=yeoreum.yun@arm.com \
/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