linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Corey Minyard <cminyard@mvista.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Steven Rostedt <rostedt@goodmis.org>,
	linux-rt-users <linux-rt-users@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Tejun Heo <tj@kernel.org>
Subject: Re: Warning from swake_up_all in 4.14.15-rt13 non-RT
Date: Fri, 9 Mar 2018 18:46:05 +0100	[thread overview]
Message-ID: <20180309174605.GC4064@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20180309110418.lwtennjqwqcxh422@linutronix.de>

On Fri, Mar 09, 2018 at 12:04:18PM +0100, Sebastian Andrzej Siewior wrote:
> +void swake_add_all_wq(struct swait_queue_head *q, struct wake_q_head *wq)
>  {
>  	struct swait_queue *curr;
>  
>  	while (!list_empty(&q->task_list)) {
>  
>  		curr = list_first_entry(&q->task_list, typeof(*curr),
>  					task_list);
>  		list_del_init(&curr->task_list);
> +		wake_q_add(wq, curr->task);
>  	}
>  }
> +EXPORT_SYMBOL(swake_add_all_wq);
>  
>  void swake_up(struct swait_queue_head *q)
>  {
> @@ -66,25 +62,14 @@ EXPORT_SYMBOL(swake_up);
>   */
>  void swake_up_all(struct swait_queue_head *q)
>  {
> +	unsigned long flags;
> +	DEFINE_WAKE_Q(wq);
>  
> +	raw_spin_lock_irqsave(&q->lock, flags);
> +	swake_add_all_wq(q, &wq);
> +	raw_spin_unlock_irqrestore(&q->lock, flags);
>  
> +	wake_up_q(&wq);
>  }
>  EXPORT_SYMBOL(swake_up_all);

This is fundamentally wrong. The whole point of wake_up_all() is that
_all_ is unbounded and should not ever land in a single critical
section, be it IRQ or PREEMPT disabled. The above does both.

Yes, wake_up_all() is crap, it is also fundamentally incompatible with
in-*irq usage. Nothing to be done about that.

So NAK on this.

  parent reply	other threads:[~2018-03-09 17:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-05 15:08 Warning from swake_up_all in 4.14.15-rt13 non-RT Corey Minyard
2018-03-06 17:46 ` Sebastian Andrzej Siewior
2018-03-06 22:51   ` Corey Minyard
2018-03-07 15:45   ` Corey Minyard
2018-03-08 17:41     ` Sebastian Andrzej Siewior
2018-03-08 19:54       ` Corey Minyard
2018-03-09 11:04         ` Sebastian Andrzej Siewior
2018-03-09 13:29           ` Corey Minyard
2018-03-09 14:58             ` Sebastian Andrzej Siewior
2018-03-09 16:03               ` Corey Minyard
2018-03-09 17:46           ` Peter Zijlstra [this message]
2018-03-09 20:25             ` Sebastian Andrzej Siewior
2018-03-09 22:26               ` Peter Zijlstra
2018-03-12 10:51                 ` Sebastian Andrzej Siewior
2018-03-12 13:27                   ` Peter Zijlstra
2018-03-12 14:11                     ` Sebastian Andrzej Siewior
2018-03-12 14:29                       ` Peter Zijlstra
2018-03-12 19:51                         ` Sebastian Andrzej Siewior
2018-03-13 18:40                           ` [RT PATCH 1/2] Revert "block: blk-mq: Use swait" Sebastian Andrzej Siewior
2018-03-13 18:42                             ` [RT PATCH 2/2] block: blk-mq: move blk_queue_usage_counter_release() into process context Sebastian Andrzej Siewior
2018-03-13 20:10                               ` Peter Zijlstra
2018-03-14 15:23                                 ` Sebastian Andrzej Siewior
2018-03-09 22:02             ` Warning from swake_up_all in 4.14.15-rt13 non-RT Corey Minyard

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=20180309174605.GC4064@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bigeasy@linutronix.de \
    --cc=cminyard@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    /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).