Re: Warning from swake_up_all in 4.14.15-rt13 non-RT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/09/2018 11:46 AM, Peter Zijlstra wrote:
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.

It seems to me to be better than what was there, certainly more efficient.

And if I understand this correctly it is unbounded when !RT, but it is bounded
on RT.

And I'm biased, because it should fix my problem :).

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.

So what would you suggest?  At this point getting rid of all the users of
wake_up_all() from interrupt context is not really an option, though as
an eventual goal it would be good.

-corey

--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux