public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Anderson <sean.anderson@linux.dev>
To: Yeoreum Yun <yeoreum.yun@arm.com>, Leo Yan <leo.yan@arm.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>,
	coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Mike Leach <mike.leach@linaro.org>,
	Linu Cherian <lcherian@marvell.com>,
	James Clark <james.clark@linaro.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] coresight: Fix possible deadlock in coresight_panic_cb
Date: Fri, 12 Sep 2025 10:38:44 -0400	[thread overview]
Message-ID: <6d833ea6-328f-4743-abfa-fb09b168849e@linux.dev> (raw)
In-Reply-To: <aMP95WqHyIQq8TcS@e129823.arm.com>

On 9/12/25 07:03, Yeoreum Yun wrote:
> Hi,
> 
>> Hi Sean,
>>
>> On Thu, Sep 11, 2025 at 11:33:15AM -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 will cause a deadlock
>> > if a panic occurs while one of the other coresight functions that uses
>> > bus_for_each_dev is running.
>>
>> The decription is a bit misleading. Even when IRQ is disabled, if an
>> exception happens, a CPU still can be trapped for handling kernel panic.
>>
>> > Maintain a separate list of coresight devices to access during a panic.
>>
>> Rather than maintaining a separate list and introducing a new spinlock,
>> I would argue if we can simply register panic notifier in TMC ETR and
>> ETF drviers (see tmc_panic_sync_etr() and tmc_panic_sync_etf()).
>>
>> If there is no dependency between CoreSight modules in panic sync flow,
>> it is not necessary to maintain list (and lock) for these modules.

Yeah, I was thinking about this as I was preparing v2 of this patch.

> +1 for this.
> and using the spinlock in the panic_cb doesn't work on PREEMPT_RT side.

What do you mean by this? I am using lockdep and it did not warn about this,
so I assume that on PREEMPT_RT IRQs remain enabled in this path.

--Sean

  reply	other threads:[~2025-09-12 14:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-11 15:33 [PATCH v2] coresight: Fix possible deadlock in coresight_panic_cb Sean Anderson
2025-09-12  9:35 ` Leo Yan
2025-09-12 11:03   ` Yeoreum Yun
2025-09-12 14:38     ` Sean Anderson [this message]
2025-09-13  4:30       ` Yeoreum Yun
2025-09-15 14:32         ` Sean Anderson

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=6d833ea6-328f-4743-abfa-fb09b168849e@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