Linux Trace Kernel
 help / color / mirror / Atom feed
From: Paul Walmsley <pjw@kernel.org>
To: Martin Kaiser <martin@kaiser.cx>
Cc: Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	 linux-riscv@lists.infradead.org,
	linux-trace-kernel@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH] riscv: trace: fix snapshot deadlock with sbi ecall
Date: Wed, 7 Jan 2026 15:36:57 -0700 (MST)	[thread overview]
Message-ID: <e06402bf-a612-4d9c-c5f6-5361826f5fdf@kernel.org> (raw)
In-Reply-To: <20251223135043.1336524-1-martin@kaiser.cx>

On Tue, 23 Dec 2025, Martin Kaiser wrote:

> If sbi_ecall.c's functions are traceable,
> 
> echo "__sbi_ecall:snapshot" > /sys/kernel/tracing/set_ftrace_filter
> 
> may get the kernel into a deadlock.
> 
> (Functions in sbi_ecall.c are excluded from tracing if
> CONFIG_RISCV_ALTERNATIVE_EARLY is set.)
> 
> __sbi_ecall triggers a snapshot of the ringbuffer. The snapshot code
> raises an IPI interrupt, which results in another call to __sbi_ecall
> and another snapshot...
> 
> All it takes to get into this endless loop is one initial __sbi_ecall.
> On RISC-V systems without SSTC extension, the clock events in
> timer-riscv.c issue periodic sbi ecalls, making the problem easy to
> trigger.
> 
> Always exclude the sbi_ecall.c functions from tracing to fix the
> potential deadlock.
> 
> sbi ecalls can easiliy be logged via trace events, excluding ecall
> functions from function tracing is not a big limitation.
> 
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>

Thanks, queued for v6.19-rc.

- Paul

      reply	other threads:[~2026-01-07 22:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-23 13:50 [PATCH] riscv: trace: fix snapshot deadlock with sbi ecall Martin Kaiser
2026-01-07 22:36 ` Paul Walmsley [this message]

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=e06402bf-a612-4d9c-c5f6-5361826f5fdf@kernel.org \
    --to=pjw@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=martin@kaiser.cx \
    --cc=palmer@dabbelt.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