Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1262239

Re: [PATCH v2] ipc/msg: Implement lockless pipelined wakeups

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2] ipc/msg: Implement lockless pipelined wakeups
Date 2015-11-04 13:00 +0100
Message-ID <qr4To-8nc-21@gated-at.bofh.it> (permalink)
References <qqLnI-4ku-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Nov 03, 2015 at 04:03:29PM +0100, Sebastian Andrzej Siewior wrote:

> -	struct msg_msg		*volatile r_msg;
> +	struct msg_msg		*r_msg;

> +				wake_q_add(wake_q, msr->r_tsk);
>  				msr->r_msg = msg;
> +				/*
> +				 * Rely on the implicit cmpxchg barrier from
> +				 * wake_q_add such that we can ensure that

Davidlohr, didn't you want to make that cmpxchg_relaxed() or
cmpxchg_release() ?

> +				 * updating msr->r_msg is the last write
> +				 * operation: As once set, the receiver can
> +				 * continue, and if we don't have the reference

Which seems to suggest you want to at least make that WRITE_ONCE()

> +				 * count from the wake_q, yet, at that point we
> +				 * can later have a use-after-free condition and
> +				 * bogus wakeup.
> +				 */

And I agree with DAvidlohr that the comment is placed oddly, one would
expect it between wake_q_add() and the store in question.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] ipc/msg: Implement lockless pipelined wakeups Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2015-11-03 16:10 +0100
  Re: [PATCH v2] ipc/msg: Implement lockless pipelined wakeups Davidlohr Bueso <dave@stgolabs.net> - 2015-11-03 18:40 +0100
    Re: [PATCH v2] ipc/msg: Implement lockless pipelined wakeups Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2015-11-03 21:20 +0100
      Re: [PATCH v2] ipc/msg: Implement lockless pipelined wakeups Davidlohr Bueso <dave@stgolabs.net> - 2015-11-04 19:20 +0100
  Re: [PATCH v2] ipc/msg: Implement lockless pipelined wakeups Peter Zijlstra <peterz@infradead.org> - 2015-11-04 13:00 +0100
    Re: [PATCH v2] ipc/msg: Implement lockless pipelined wakeups Davidlohr Bueso <dave@stgolabs.net> - 2015-11-04 18:40 +0100
  Re: [PATCH v2] ipc/msg: Implement lockless pipelined wakeups Peter Zijlstra <peterz@infradead.org> - 2015-11-04 13:10 +0100

csiph-web