LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: cgroups@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Rik van Riel <riel@surriel.com>
Subject: Re: [PATCH cgroup/for-5.14-fixes] cgroup: rstat: fix A-A deadlock on 32bit around u64_stats_sync
Date: Tue, 27 Jul 2021 13:13:21 -1000	[thread overview]
Message-ID: <YQCTEYhcxKccOamq@slm.duckdns.org> (raw)
In-Reply-To: <YQCREXMBq1EPoQWu@slm.duckdns.org>

On Tue, Jul 27, 2021 at 01:04:49PM -1000, Tejun Heo wrote:
> 0fa294fb1985 ("cgroup: Replace cgroup_rstat_mutex with a spinlock") added
> cgroup_rstat_flush_irqsafe() allowing flushing to happen from the irq
> context. However, rstat paths use u64_stats_sync to synchronize access to
> 64bit stat counters on 32bit machines. u64_stats_sync is implemented using
> seq_lock and trying to read from an irq context can lead to A-A deadlock if
> the irq happens to interrupt the stat update.
> 
> Fix it by using the irqsafe variants - u64_stats_update_begin_irqsave() and
> u64_stats_update_end_irqrestore() - in the update paths. Note that none of
> this matters on 64bit machines. All these are just for 32bit SMP setups.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Reported-by: Rik van Riel <riel@surriel.com>

Applying this to cgroup/for-5.14-fixes with stable tag added.

Thanks.

-- 
tejun

      reply	other threads:[~2021-07-27 23:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27 23:04 Tejun Heo
2021-07-27 23:13 ` Tejun Heo [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=YQCTEYhcxKccOamq@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=riel@surriel.com \
    --subject='Re: [PATCH cgroup/for-5.14-fixes] cgroup: rstat: fix A-A deadlock on 32bit around u64_stats_sync' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).