Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Shawn Guo <shengchao.guo@oss.qualcomm.com>
To: Vinayak Katoch <vinayak.katoch@oss.qualcomm.com>
Cc: Srinivas Kandagatla <srini@kernel.org>,
	Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Anandu Krishnan E <anandu.e@oss.qualcomm.com>,
	Bharath Kumar <bkumar@qti.qualcomm.com>,
	Chenna Kesava Raju <chennak@qti.qualcomm.com>,
	Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>,
	linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] misc: fastrpc: make put_work scheduling lock-free
Date: Tue, 1 Dec 2026 09:46:31 +0800	[thread overview]
Message-ID: <aw4m92rfWsHbwKDR@QCOM-aGQu4IUr3Y> (raw)
In-Reply-To: <20261127-fix-put-work-irq-deadlock-v1-1-3aa66fe4f2c9@oss.qualcomm.com>

On Fri, Nov 27, 2026 at 03:34:09PM +0530, Vinayak Katoch wrote:
> fastrpc_context_schedule_put_work() guards the once-only schedule_work()
> with fl->lock. That helper is called from fastrpc_rpmsg_callback(), which
> runs in hard-IRQ context on the glink rx interrupt, while every other
> user of fl->lock takes it with a plain spin_lock() in process context
> with interrupts enabled.
> 
> If the glink interrupt fires on a CPU that is already holding fl->lock,
> for example fastrpc_context_put_wq() -> fastrpc_context_free() or
> fastrpc_free_map() running in a kworker on that CPU, the handler spins
> on the lock the interrupted code holds. The holder can never run again,
> so the CPU hangs with interrupts masked, an RCU stall is reported for
> it, and the system is eventually reset by the watchdog. It is easy to
> hit because schedule_work() queues onto the local CPU's worker pool, so
> the worker that takes fl->lock tends to run on the very CPU that
> receives the glink interrupt.
> 
> The same helper is also called by fastrpc_notify_users() while it holds
> user->lock, and ctx->fl == user, so a context left on fl->pending or
> fl->interrupted when the channel is removed deadlocks on the same lock
> there too.
> 
> The flag is only used to make sure put_work is queued once, so no lock
> is needed. Turn it into an atomic_t and claim it with atomic_xchg().
> Whichever caller sees the old value 0 queues the work; any later or
> racing caller sees 1 and does nothing. This makes the helper safe from
> hard-IRQ context and with fl->lock already held.
> 
> Fixes: 3f645f6884b5 ("misc: fastrpc: fix context leak and hang on signal-interrupted invoke")
> Cc: stable@vger.kernel.org
> Signed-off-by: Vinayak Katoch <vinayak.katoch@oss.qualcomm.com>

It fixes the regression [1] on Nord I reported yesterday.

Tested-by: Shawn Guo <shengchao.guo@oss.qualcomm.com>

Shawn

[1] https://lore.kernel.org/all/awz0TMG1-NdBWqyZ@QCOM-aGQu4IUr3Y/

      parent reply	other threads:[~2026-12-01  1:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 10:04 [PATCH] misc: fastrpc: make put_work scheduling lock-free Vinayak Katoch
2026-11-30  8:09 ` Ekansh Gupta
2026-12-01  1:46 ` Shawn Guo [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=aw4m92rfWsHbwKDR@QCOM-aGQu4IUr3Y \
    --to=shengchao.guo@oss.qualcomm.com \
    --cc=anandu.e@oss.qualcomm.com \
    --cc=arnd@arndb.de \
    --cc=bkumar@qti.qualcomm.com \
    --cc=chennak@qti.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ekansh.gupta@oss.qualcomm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=srini@kernel.org \
    --cc=srinivas.kandagatla@oss.qualcomm.com \
    --cc=stable@vger.kernel.org \
    --cc=vinayak.katoch@oss.qualcomm.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