linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-perf-users@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [bug report] irq_work: Allow irq_work_sync() to sleep if irq_work() no IRQ support.
Date: Wed, 26 Jan 2022 13:11:13 +0100	[thread overview]
Message-ID: <YfE6YV7V2s89A55f@linutronix.de> (raw)
In-Reply-To: <20220119133729.GA14183@kili>

+peterz, tglx

On 2022-01-19 16:37:29 [+0300], Dan Carpenter wrote:
> Hello Sebastian Andrzej Siewior,
> 
> The patch 810979682ccc: "irq_work: Allow irq_work_sync() to sleep if
> irq_work() no IRQ support." from Oct 6, 2021, leads to the following
> Smatch static checker warning:
> 
> 	kernel/events/core.c:4955 _free_event()
> 	warn: sleeping in atomic context
> 
> There are two potential call trees where preemption is disabled.
> 
> perf_remove_from_context() <- disables preempt
 raw_spin_lock_irq(&ctx->lock)

> __perf_event_exit_context() <- disables preempt
don't see additional one.

> -> __perf_remove_from_context()
>    -> perf_group_detach()
>       -> perf_put_aux_event()
>          -> put_event()
>             -> _free_event()
> 
> _free_event() calls irq_work_sync() which can now sleep.

That is true. There is also 
|	if (event->rb) 
|		mutex_lock(&event->mmap_mutex);

Can we somehow delay the whole thing? There are also kfree() and
spinlock_t usage which are not very RT compatible with disabled
preemption.

> regards,
> dan carpenter

Sebastian

  reply	other threads:[~2022-01-26 12:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-19 13:37 [bug report] irq_work: Allow irq_work_sync() to sleep if irq_work() no IRQ support Dan Carpenter
2022-01-26 12:11 ` Sebastian Andrzej Siewior [this message]
2022-01-26 13:24   ` Dan Carpenter

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=YfE6YV7V2s89A55f@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).