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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 7 Jun 2016 07:59:45 -0700
From:	Davidlohr Bueso <dave@...olabs.net>
To:	Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc:	linux-kernel@...r.kernel.org,
	Peter Zijlstra <peterz@...radead.org>, tglx@...utronix.de,
	Manfred Spraul <manfred@...orfullife.com>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v3] ipc/msg: Implement lockless pipelined wakeups

On Mon, 06 Jun 2016, Sebastian Andrzej Siewior wrote:

>-static void expunge_all(struct msg_queue *msq, int res)
>+static void expunge_all(struct msg_queue *msq, int res,
>+			struct wake_q_head *wake_q)
> {
> 	struct msg_receiver *msr, *t;
>
> 	list_for_each_entry_safe(msr, t, &msq->q_receivers, r_list) {
>-		msr->r_msg = NULL; /* initialize expunge ordering */
>-		wake_up_process(msr->r_tsk);
>-		/*
>-		 * Ensure that the wakeup is visible before setting r_msg as
>-		 * the receiving end depends on it: either spinning on a nil,
>-		 * or dealing with -EAGAIN cases. See lockless receive part 1
>-		 * and 2 in do_msgrcv().
>-		 */
>+
>+		WRITE_ONCE(msr->r_msg, ERR_PTR(res));
> 		smp_wmb(); /* barrier (B) */
>-		msr->r_msg = ERR_PTR(res);
>+		wake_q_add(wake_q, msr->r_tsk);

Given that wake_q_add() implies barriers on both sides (cmpxchg), I think we
can rely on that instead of the explicit smp_wmb() for barrier B. While a failed
call doesn't imply the barriers, we're already in a world of trouble _anyways_
if that's the case. Same for pipelined_send, obviously.

Thanks,
Davidlohr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ