public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Wander Lairson Costa <wander@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-rt-users@vger.kernel.org
Subject: Re: [PATCH v2 1/2] block: Avoid sleeping function called from invalid context bug
Date: Wed, 15 Dec 2021 17:58:18 +0100	[thread overview]
Message-ID: <YboeqlSsoFRbjEv2@linutronix.de> (raw)
In-Reply-To: <20211213123737.9147-2-wander@redhat.com>

On 2021-12-13 09:37:36 [-0300], Wander Lairson Costa wrote:
> ---
>  block/blk-cgroup.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
> index 663aabfeba18..0a532bb3003c 100644
> --- a/block/blk-cgroup.c
> +++ b/block/blk-cgroup.c
> @@ -1911,7 +1911,7 @@ void blk_cgroup_bio_start(struct bio *bio)
>  	struct blkg_iostat_set *bis;
>  	unsigned long flags;
>  
> -	cpu = get_cpu();
> +	cpu = get_cpu_light();
>  	bis = per_cpu_ptr(bio->bi_blkg->iostat_cpu, cpu);
>  	flags = u64_stats_update_begin_irqsave(&bis->sync);
>  
> @@ -1928,7 +1928,7 @@ void blk_cgroup_bio_start(struct bio *bio)
>  	u64_stats_update_end_irqrestore(&bis->sync, flags);
>  	if (cgroup_subsys_on_dfl(io_cgrp_subsys))
>  		cgroup_rstat_updated(bio->bi_blkg->blkcg->css.cgroup, cpu);
> -	put_cpu();
> +	put_cpu_light();
>  }

Are you sure patch and backtrace match? There is also
u64_stats_update_begin_irqsave() which disables preemption on RT. So by
doing what you are suggesting, you only avoid disabling preemption in
cgroup_rstat_updated() which acquires a raw_spinlock_t.

Sebastian

  parent reply	other threads:[~2021-12-15 16:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-13 12:37 [PATCH v2 0/2] Fix warnings in blktrace Wander Lairson Costa
2021-12-13 12:37 ` [PATCH v2 1/2] block: Avoid sleeping function called from invalid context bug Wander Lairson Costa
2021-12-14  7:13   ` kernel test robot
2021-12-15 16:58   ` Sebastian Andrzej Siewior [this message]
2021-12-16 20:21     ` Wander Costa
2021-12-13 12:37 ` [PATCH v2 2/2] blktrace: switch trace spinlock to a raw spinlock Wander Lairson Costa
2021-12-15 17:08   ` Sebastian Andrzej Siewior
2021-12-15 17:31     ` Steven Rostedt
2021-12-15 19:34       ` Jens Axboe
2021-12-16 20:21         ` Wander Costa
2021-12-15 13:29 ` [PATCH v2 0/2] Fix warnings in blktrace Sebastian Andrzej Siewior

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=YboeqlSsoFRbjEv2@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=wander@redhat.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