lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 18 Oct 2014 23:34:17 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Paul Gortmaker <paul.gortmaker@...driver.com>
Cc:	linux-rt-users@...r.kernel.org, linux-kernel@...r.kernel.org,
	Thomas Gleixner <tglx@...utronix.de>,
	Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH 3/7] wait.[ch]: Introduce the simple waitqueue (swait)
 implementation

On Fri, Oct 17, 2014 at 08:22:58PM -0400, Paul Gortmaker wrote:
> @@ -75,6 +123,32 @@ static void __cwake_up_common(struct cwait_head *q, unsigned int mode,
>  	}
>  }
>  
> +static void __swake_up_common(struct swait_head *q, unsigned int mode,
> +			      int nr_exclusive)
> +{
> +	struct swait *curr, *next;
> +	int woken = 0;
> +
> +	list_for_each_entry_safe(curr, next, &q->task_list, node) {
> +		if (wake_up_state(curr->task, mode)) { /* <-- calls ttwu() */
> +			__remove_swait(q, curr);
> +			curr->task = NULL;
> +			/*
> +			 * The waiting task can free the waiter as
> +			 * soon as curr->task = NULL is written,
> +			 * without taking any locks. A memory barrier
> +			 * is required here to prevent the following
> +			 * store to curr->task from getting ahead of
> +			 * the dequeue operation.
> +			 */
> +			smp_wmb();
> +			if (++woken == nr_exclusive)
> +				break;
> +		}
> +
> +	}
> +}
> +
>  /**
>   * __cwake_up - wake up threads blocked on a waitqueue.
>   * @q: the complex waitqueue
> @@ -96,6 +170,19 @@ void __cwake_up(struct cwait_head *q, unsigned int mode, int nr_exclusive,
>  }
>  EXPORT_SYMBOL(__cwake_up);
>  
> +void __swake_up(struct swait_head *q, unsigned int mode, int nr_exclusive)
> +{
> +	unsigned long flags;
> +
> +	if (!swait_active(q))
> +		return;
> +
> +	raw_spin_lock_irqsave(&q->lock, flags);
> +	__swake_up_common(q, mode, nr_exclusive);
> +	raw_spin_unlock_irqrestore(&q->lock, flags);
> +}
> +EXPORT_SYMBOL(__swake_up);

Same comment as before, that is an unbounded loop in a non preemptible
section and therefore violates RT design principles.

We actually did talk about ways of fixing that.

Also, I'm not entirely sure we want to do the cwait thing, it looks
painful.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists